btrfs-progs: convert: rename context volume_name to label

The name was derived from ext2 but we use label elsewhere.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2021-08-17 22:39:33 +02:00
parent 03a9dbf784
commit 9f2bfd966e
4 changed files with 8 additions and 8 deletions

View File

@ -38,7 +38,7 @@ struct btrfs_convert_context {
u64 free_inodes_count;
u64 total_bytes;
u64 free_bytes_initial;
char *volume_name;
char *label;
u8 fs_uuid[SOURCE_FS_UUID_SIZE];
const struct btrfs_convert_operations *convert_ops;

View File

@ -1210,7 +1210,7 @@ static int do_convert(const char *devname, u32 convert_flags, u32 nodesize,
printf("\tfree: %llu (%.2f%%)\n", cctx.free_bytes_initial,
100.0 * cctx.free_bytes_initial / cctx.total_bytes);
mkfs_cfg.csum_type = csum_type;
mkfs_cfg.label = cctx.volume_name;
mkfs_cfg.label = cctx.label;
mkfs_cfg.num_bytes = total_bytes;
mkfs_cfg.nodesize = nodesize;
mkfs_cfg.sectorsize = blocksize;
@ -1289,7 +1289,7 @@ static int do_convert(const char *devname, u32 convert_flags, u32 nodesize,
memset(root->fs_info->super_copy->label, 0, BTRFS_LABEL_SIZE);
if (convert_flags & CONVERT_FLAG_COPY_LABEL) {
__strncpy_null(root->fs_info->super_copy->label,
cctx.volume_name, BTRFS_LABEL_SIZE - 1);
cctx.label, BTRFS_LABEL_SIZE - 1);
printf("copy label '%s'\n", root->fs_info->super_copy->label);
} else if (convert_flags & CONVERT_FLAG_SET_LABEL) {
strcpy(root->fs_info->super_copy->label, fslabel);

View File

@ -94,7 +94,7 @@ static int ext2_open_fs(struct btrfs_convert_context *cctx, const char *name)
cctx->blocksize = ext2_fs->blocksize;
cctx->block_count = ext2_fs->super->s_blocks_count;
cctx->total_bytes = (u64)ext2_fs->super->s_blocks_count * ext2_fs->blocksize;
cctx->volume_name = strndup((char *)ext2_fs->super->s_volume_name, 16);
cctx->label = strndup((char *)ext2_fs->super->s_volume_name, 16);
cctx->first_data_block = ext2_fs->super->s_first_data_block;
cctx->inodes_count = ext2_fs->super->s_inodes_count;
cctx->free_inodes_count = ext2_fs->super->s_free_inodes_count;
@ -182,9 +182,9 @@ static int ext2_read_used_space(struct btrfs_convert_context *cctx)
static void ext2_close_fs(struct btrfs_convert_context *cctx)
{
if (cctx->volume_name) {
free(cctx->volume_name);
cctx->volume_name = NULL;
if (cctx->label) {
free(cctx->label);
cctx->label = NULL;
}
ext2fs_close(cctx->fs_data);
ext2fs_free(cctx->fs_data);

View File

@ -82,7 +82,7 @@ static int reiserfs_open_fs(struct btrfs_convert_context *cxt, const char *name)
cxt->blocksize = fs->fs_blocksize;
cxt->block_count = get_sb_block_count(fs->fs_ondisk_sb);
cxt->total_bytes = (u64)cxt->block_count * cxt->blocksize;
cxt->volume_name = strndup(fs->fs_ondisk_sb->s_label, 16);
cxt->label = strndup(fs->fs_ondisk_sb->s_label, 16);
cxt->first_data_block = 0;
cxt->inodes_count = reiserfs_count_objectids(fs);
cxt->free_inodes_count = 0;