Browse Source

ext4_mkfs: Added UUID parameter to create new filesystems with non-zero UUID

pull/36/head
Max Maisel 7 years ago
parent
commit
151cd9f6e9
  1. 1
      include/ext4_mkfs.h
  2. 3
      src/ext4_mkfs.c

1
include/ext4_mkfs.h

@ -63,6 +63,7 @@ struct ext4_mkfs_info {
uint16_t feat_incompat;
uint32_t bg_desc_reserve_blocks;
uint16_t dsc_size;
uint8_t uuid[UUID_SIZE];
bool journal;
const char *label;
};

3
src/ext4_mkfs.c

@ -95,6 +95,7 @@ static int sb2info(struct ext4_sblock *sb, struct ext4_mkfs_info *info)
info->label = sb->volume_name;
info->len = (uint64_t)info->block_size * ext4_sb_get_blocks_cnt(sb);
info->dsc_size = to_le16(sb->desc_size);
memcpy(info->uuid, sb->uuid, UUID_SIZE);
return EOK;
}
@ -260,7 +261,7 @@ static void fill_sb(struct fs_aux_info *aux_info, struct ext4_mkfs_info *info)
sb->features_incompatible = to_le32(info->feat_incompat);
sb->features_read_only = to_le32(info->feat_ro_compat);
memset(sb->uuid, 0, sizeof(sb->uuid));
memcpy(sb->uuid, info->uuid, UUID_SIZE);
memset(sb->volume_name, 0, sizeof(sb->volume_name));
strncpy(sb->volume_name, info->label, sizeof(sb->volume_name));

Loading…
Cancel
Save