Skip to content

Commit

Permalink
MDRAID: Minor fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Tomas Mudrunka <[email protected]>
  • Loading branch information
Harvie committed Dec 29, 2024
1 parent 09806bf commit f6bdf28
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions image-mdraid.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ static int mdraid_generate(struct image *image) {
}

static int mdraid_setup(struct image *image, cfg_t *cfg) {
if(!mdraid_time) {
if (!mdraid_time) {
mdraid_time = time(NULL);
srandom(mdraid_time); //For UUID generation
}
Expand All @@ -287,15 +287,19 @@ static int mdraid_setup(struct image *image, cfg_t *cfg) {
//Find data image to be put inside the array
struct image *img_in = NULL;
char *src = cfg_getstr(image->imagesec, "image");
if(src) {
if (src) {
struct partition *part;
part = xzalloc(sizeof *part);
part->image = src;
list_add_tail(&part->list, &image->partitions);

if (part->image) {
image_info(image, "MDRAID using data from: %s\n", part->image);
img_in = image_get(part->image);
img_in = image_get(part->image); //TODO: will this work for pre-existing images not generated by genimage???
if (!img_in) {
image_error(image, "MDRAID cannot get image definition: %s\n", part->image);
return 8;
}
if (image->size == 0)
image->size = roundup(img_in->size + DATA_OFFSET_BYTES, MDRAID_ALIGN_BYTES);
if (image->size < (img_in->size + DATA_OFFSET_BYTES)) {
Expand Down

0 comments on commit f6bdf28

Please sign in to comment.