diff options
| author | Max Maisel <max.maisel@posteo.de> | 2018-03-01 17:31:32 +0100 |
|---|---|---|
| committer | Max Maisel <max.maisel@posteo.de> | 2018-03-01 17:57:53 +0100 |
| commit | 151cd9f6e9120e3c41600875c6cfa42dc1321a0b (patch) | |
| tree | 699ede624f2f82b107c467318903d8cf978763a9 | |
| parent | fa7ef73d810310ca42d361d337aeb5fea87c3ae4 (diff) | |
ext4_mkfs: Added UUID parameter to create new filesystems with non-zero UUID
| -rw-r--r-- | include/ext4_mkfs.h | 1 | ||||
| -rw-r--r-- | src/ext4_mkfs.c | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/include/ext4_mkfs.h b/include/ext4_mkfs.h index 2438e7d..53f1820 100644 --- a/include/ext4_mkfs.h +++ b/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; }; diff --git a/src/ext4_mkfs.c b/src/ext4_mkfs.c index 5942055..355b20a 100644 --- a/src/ext4_mkfs.c +++ b/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)); |
