ref: fa7ef73d810310ca42d361d337aeb5fea87c3ae4
parent: bc9b9b57b60cf85fc159c264e5faab6f6263a062
author: Max Maisel <max.maisel@posteo.de>
date: Thu Mar 1 12:28:40 EST 2018
ext4_mbr: Added "disk_id" parameter to MBR creation function
--- a/include/ext4_mbr.h
+++ b/include/ext4_mbr.h
@@ -60,7 +60,7 @@
uint8_t division[4];
};
-int ext4_mbr_write(struct ext4_blockdev *parent, struct ext4_mbr_parts *parts);
+int ext4_mbr_write(struct ext4_blockdev *parent, struct ext4_mbr_parts *parts, uint32_t disk_id);
#ifdef __cplusplus
}
--- a/src/ext4_mbr.c
+++ b/src/ext4_mbr.c
@@ -59,7 +59,8 @@
};
struct ext4_mbr {
- uint8_t bootstrap[446];
+ uint8_t bootstrap[442];
+ uint32_t disk_id;
struct ext4_part_entry part_entry[4];
uint16_t signature;
};
@@ -126,7 +127,7 @@
return r;
}
-int ext4_mbr_write(struct ext4_blockdev *parent, struct ext4_mbr_parts *parts)
+int ext4_mbr_write(struct ext4_blockdev *parent, struct ext4_mbr_parts *parts, uint32_t disk_id)
{
int r;
uint64_t disk_size = parent->part_size;
@@ -155,6 +156,7 @@
struct ext4_mbr *mbr = (void *)parent->bdif->ph_bbuf;
memset(mbr, 0, sizeof(struct ext4_mbr));
+ mbr->disk_id = disk_id;
uint32_t cyl_it = 0;
for (int i = 0; i < 4; ++i) {