Home | History | Annotate | Download | only in misc

Lines Matching refs:fs

225 static void write_image_file(ext2_filsys fs, int fd)
231 write_header(fd, NULL, sizeof(struct ext2_image_hdr), fs->blocksize);
235 retval = ext2fs_image_super_write(fs, fd, 0);
243 retval = ext2fs_image_inode_write(fs, fd,
252 retval = ext2fs_image_bitmap_write(fs, fd, 0);
260 retval = ext2fs_image_bitmap_write(fs, fd, IMAGER_FLAG_INODEMAP);
272 hdr.fs_blocksize = fs->blocksize;
281 memcpy(hdr.fs_uuid, fs->super->s_uuid, sizeof(hdr.fs_uuid));
284 write_header(fd, &hdr, sizeof(struct ext2_image_hdr), fs->blocksize);
308 static errcode_t meta_get_blocks(ext2_filsys fs EXT2FS_ATTR((unused)),
322 static errcode_t meta_check_directory(ext2_filsys fs EXT2FS_ATTR((unused)),
333 static errcode_t meta_read_inode(ext2_filsys fs EXT2FS_ATTR((unused)),
343 static void use_inode_shortcuts(ext2_filsys fs, int use_shortcuts)
346 fs->get_blocks = meta_get_blocks;
347 fs->check_directory = meta_check_directory;
348 fs->read_inode = meta_read_inode;
351 fs->get_blocks = 0;
352 fs->check_directory = 0;
353 fs->read_inode = 0;
357 static int process_dir_block(ext2_filsys fs EXT2FS_ATTR((unused)),
375 static int process_file_block(ext2_filsys fs EXT2FS_ATTR((unused)),
389 static void mark_table_blocks(ext2_filsys fs)
394 first_block = fs->super->s_first_data_block;
404 for (j = 0; j < fs->desc_blocks; j++) {
406 ext2fs_descriptor_block_loc2(fs, first_block, j));
408 meta_blocks_count += fs->desc_blocks;
410 for (i = 0; i < fs->group_desc_count; i++) {
415 !ext2fs_bg_flags_test(fs, i, EXT2_BG_INODE_UNINIT)) &&
416 ext2fs_inode_table_loc(fs, i)) {
417 unsigned int end = (unsigned) fs->inode_blocks_per_group;
420 EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
422 end -= (ext2fs_bg_itable_unused(fs, i) /
423 EXT2_INODES_PER_BLOCK(fs->super));
424 for (j = 0, b = ext2fs_inode_table_loc(fs, i);
435 if (!ext2fs_bg_flags_test(fs, i, EXT2_BG_BLOCK_UNINIT) &&
436 ext2fs_block_bitmap_loc(fs, i)) {
438 ext2fs_block_bitmap_loc(fs, i));
445 if (!ext2fs_bg_flags_test(fs, i, EXT2_BG_INODE_UNINIT) &&
446 ext2fs_inode_bitmap_loc(fs, i)) {
448 ext2fs_inode_bitmap_loc(fs, i));
476 static void scramble_dir_block(ext2_filsys fs, blk64_t blk, char *buf)
483 end = buf + fs->blocksize;
491 rec_len = fs->blocksize;
503 (void) ext2fs_set_rec_len(fs, rec_len,
556 static void output_meta_data_blocks(ext2_filsys fs, int fd, int flags)
564 blk64_t end = ext2fs_blocks_count(fs->super);
570 retval = ext2fs_get_mem(fs->blocksize, &buf);
575 retval = ext2fs_get_memzero(fs->blocksize, &zero_buf);
589 divide the fs up into distance size chunks and write them
592 distance = (dest_offset - source_offset) / fs->blocksize;
593 if (distance < ext2fs_blocks_count(fs->super))
594 start = ext2fs_blocks_count(fs->super) - distance;
600 seek_set(fd, (start * fs->blocksize) + dest_offset);
605 if (distance >= ext2fs_blocks_count(fs->super) ||
606 start == ext2fs_blocks_count(fs->super) - distance)
610 if (blk < (source_offset - dest_offset) / fs->blocksize)
643 fs->blocksize,
648 if ((blk >= fs->super->s_first_data_block) &&
650 retval = io_channel_read_blk64(fs->io, blk, 1, buf);
658 scramble_dir_block(fs, blk, buf);
660 check_zero_block(buf, fs->blocksize))
665 fs->blocksize)) {
666 seek_relative(fd, fs->blocksize);
669 generic_write(fd, buf, fs->blocksize, blk);
675 fs->blocksize, blk);
678 sparse += fs->blocksize;
712 calc_rate(total_written, fs->blocksize, duration));
719 fs->blocksize * ext2fs_blocks_count(fs->super) + dest_offset);
862 static int initialize_qcow2_image(int fd, ext2_filsys fs,
868 int cluster_bits = get_bits_from_size(fs->blocksize);
869 struct ext2_super_block *sb = fs->super;
877 image->cluster_size = fs->blocksize;
1122 static void output_qcow2_meta_data_blocks(ext2_filsys fs, int fd)
1138 retval = initialize_qcow2_image(fd, fs, img);
1164 retval = ext2fs_get_mem(fs->blocksize, &buf);
1170 for (blk = 0; blk < ext2fs_blocks_count(fs->super); blk++) {
1171 if ((blk >= fs->super->s_first_data_block) &&
1173 retval = io_channel_read_blk64(fs->io, blk, 1, buf);
1181 scramble_dir_block(fs, blk, buf);
1182 if (check_zero_block(buf, fs->blocksize))
1205 generic_write(fd, buf, fs->blocksize, blk);
1242 static void write_raw_image_file(ext2_filsys fs, int fd, int type, int flags)
1252 retval = ext2fs_allocate_block_bitmap(fs, _("in-use block map"),
1261 retval = ext2fs_allocate_block_bitmap(fs, "scramble block map",
1270 mark_table_blocks(fs);
1274 retval = ext2fs_open_inode_scan(fs, 0, &scan);
1281 retval = ext2fs_get_mem(fs->blocksize * 3, &block_buf);
1288 use_inode_shortcuts(fs, 1);
1303 if (ext2fs_file_acl_block(fs
1305 ext2fs_file_acl_block(fs, &inode));
1308 if (!ext2fs_inode_has_valid_blocks2(fs, &inode))
1316 ext2fs_inode_has_valid_blocks2(fs, &inode)) ||
1317 ino == fs->super->s_journal_inum) {
1318 retval = ext2fs_block_iterate3(fs, ino,
1332 retval = ext2fs_block_iterate3(fs,
1343 use_inode_shortcuts(fs, 0);
1346 output_qcow2_meta_data_blocks(fs, fd);
1348 output_meta_data_blocks(fs, fd, flags);
1360 ext2_filsys fs;
1381 io_ptr, &fs);
1388 retval = ext2fs_read_bitmaps (fs);
1406 ext2fs_rewrite_to_io(fs, io);
1408 seek_set(fd, fs->image_header->offset_inode);
1410 retval = ext2fs_image_inode_read(fs, fd, 0);
1417 ext2fs_close (fs);
1434 ext2_filsys fs;
1564 unix_io_manager, &fs);
1633 retval = ext2fs_get_mem(fs->blocksize, &check_buf);
1646 write_raw_image_file(fs, fd, img_type, flags);
1648 write_image_file(fs, fd);
1650 ext2fs_close (fs);