Bug fix: File path of imported BIOS boot image was forgotten when it gets overwritten by a file of the same name. Thanks Brian C. Lane.

This commit is contained in:
Thomas Schmitt 2024-05-12 13:56:29 +02:00
parent 8ed27c6255
commit d9c548dbfc
8 changed files with 203 additions and 47 deletions

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2007 Vreixo Formoso * Copyright (c) 2007 Vreixo Formoso
* Copyright (c) 2010 - 2016 Thomas Schmitt * Copyright (c) 2010 - 2024 Thomas Schmitt
* *
* This file is part of the libisofs project; you can redistribute it and/or * This file is part of the libisofs project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2 * modify it under the terms of the GNU General Public License version 2
@ -845,6 +845,8 @@ void el_torito_boot_catalog_free(struct el_torito_boot_catalog *cat)
continue; continue;
if ((IsoNode*)image->image != NULL) if ((IsoNode*)image->image != NULL)
iso_node_unref((IsoNode*)image->image); iso_node_unref((IsoNode*)image->image);
if (image->image_path != NULL)
free(image->image_path);
free(image); free(image);
} }
if ((IsoNode*)cat->node != NULL) if ((IsoNode*)cat->node != NULL)

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2007 Vreixo Formoso * Copyright (c) 2007 Vreixo Formoso
* Copyright (c) 2010 - 2018 Thomas Schmitt * Copyright (c) 2010 - 2024 Thomas Schmitt
* *
* This file is part of the libisofs project; you can redistribute it and/or * This file is part of the libisofs project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2 * modify it under the terms of the GNU General Public License version 2
@ -53,6 +53,9 @@ struct el_torito_boot_catalog {
struct el_torito_boot_image { struct el_torito_boot_image {
IsoFile *image; IsoFile *image;
/* Path of image at the time of ISO image loading (NULL = hidden image) */
char *image_path;
/* Overrides .image if >= 0 : array index of appended partition */ /* Overrides .image if >= 0 : array index of appended partition */
int appended_idx; int appended_idx;
uint32_t appended_start; /* In blocks of 2048 bytes */ uint32_t appended_start; /* In blocks of 2048 bytes */

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2007 Vreixo Formoso * Copyright (c) 2007 Vreixo Formoso
* Copyright (c) 2009 - 2023 Thomas Schmitt * Copyright (c) 2009 - 2024 Thomas Schmitt
* *
* This file is part of the libisofs project; you can redistribute it and/or * This file is part of the libisofs project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2 * modify it under the terms of the GNU General Public License version 2
@ -4143,12 +4143,14 @@ ex:;
static static
int iso_analyze_mbr(IsoImage *image, IsoDataSource *src, int flag) int iso_analyze_mbr(IsoImage *image, IsoDataSource *src, int flag)
{ {
int sub_type = 2, ret, is_isohybrid = 0, is_grub2_mbr = 0; int sub_type = 2, ret, i, is_isohybrid = 0, is_grub2_mbr = 0;
int is_protective_label = 0; int is_protective_label = 0;
uint32_t next_above = 0;
uint64_t part2_start; uint64_t part2_start;
char *sad; char *sad;
struct iso_imported_sys_area *sai; struct iso_imported_sys_area *sai;
struct iso_mbr_partition_request *part; struct iso_mbr_partition_request *part;
IsoNode *node;
sad = image->system_area_data; sad = image->system_area_data;
sai = image->imported_sa_info; sai = image->imported_sa_info;
@ -4167,6 +4169,17 @@ int iso_analyze_mbr(IsoImage *image, IsoDataSource *src, int flag)
goto ex; goto ex;
} }
/* Possibly obtain ISO paths of MBR partition content */
for (i = 0; i < sai->mbr_req_count; i++) {
part = sai->mbr_req[i];
if (part->block_count == 0 || part->image_path != NULL)
continue;
ret = iso_tree_get_node_of_block(image, NULL, part->start_block / 4,
&node, &next_above, 0);
if (ret > 0)
part->image_path = iso_tree_get_node_path(node);
}
ret = iso_analyze_isohybrid(image, 0); ret = iso_analyze_isohybrid(image, 0);
if (ret < 0) if (ret < 0)
goto ex; goto ex;
@ -4477,15 +4490,17 @@ ex:
} }
/* @param flag bit0= Pre-run: Only assess partition table. /* @param flag bit0= Pre-run: Only assess partition table.
(Yet without effect, because nothing else is done)
*/ */
static static
int iso_analyze_gpt(IsoImage *image, IsoDataSource *src, int flag) int iso_analyze_gpt(IsoImage *image, IsoDataSource *src, int flag)
{ {
int ret, i, j; int ret, i, j;
uint64_t start_block, block_count, flags, end_block, j_end, j_start; uint64_t start_block, block_count, flags, end_block, j_end, j_start;
uint32_t next_above;
uint8_t *part; uint8_t *part;
struct iso_imported_sys_area *sai; struct iso_imported_sys_area *sai;
struct iso_gpt_partition_request *gpt_entry;
IsoNode *node;
sai = image->imported_sa_info; sai = image->imported_sa_info;
@ -4566,6 +4581,21 @@ int iso_analyze_gpt(IsoImage *image, IsoDataSource *src, int flag)
} }
} }
if (flag & 1)
return 1;
/* Possibly obtain ISO paths of GPT partition content */
for (i = 0; i < sai->gpt_req_count; i++) {
gpt_entry = sai->gpt_req[i];
if (gpt_entry->block_count == 0 || gpt_entry->image_path != NULL)
continue;
ret = iso_tree_get_node_of_block(image, NULL,
(uint32_t) (gpt_entry->start_block / 4),
&node, &next_above, 0);
if (ret > 0)
gpt_entry->image_path = iso_tree_get_node_path(node);
}
return 1; return 1;
} }
@ -4592,15 +4622,16 @@ int iso_analyze_apm_head(IsoImage *image, IsoDataSource *src, int flag)
} }
/* @param flag bit0= Pre-run: Only assess partition table. /* @param flag bit0= Pre-run: Only assess partition table.
(Yet without effect, because nothing else is done)
*/ */
static static
int iso_analyze_apm(IsoImage *image, IsoDataSource *src, int flag) int iso_analyze_apm(IsoImage *image, IsoDataSource *src, int flag)
{ {
int ret, i; int ret, i;
uint32_t map_entries, start_block, block_count, flags; uint32_t map_entries, start_block, block_count, flags, next_above;
char *sad, *part, name[33], type_string[33]; char *sad, *part, name[33], type_string[33];
struct iso_imported_sys_area *sai; struct iso_imported_sys_area *sai;
struct iso_apm_partition_request *apm_entry;
IsoNode *node;
sai = image->imported_sa_info; sai = image->imported_sa_info;
sad = image->system_area_data; sad = image->system_area_data;
@ -4645,6 +4676,22 @@ int iso_analyze_apm(IsoImage *image, IsoDataSource *src, int flag)
} }
} }
} }
if (flag & 1)
return 1;
/* Possibly obtain ISO paths of APM partition content */
for (i = 0; i < sai->apm_req_count; i++) {
apm_entry = sai->apm_req[i];
if (apm_entry->block_count == 0 || apm_entry->image_path != NULL)
continue;
ret = iso_tree_get_node_of_block(image, NULL,
(uint32_t) (apm_entry->start_block /
(2048 / sai->apm_block_size)),
&node, &next_above, 0);
if (ret > 0)
apm_entry->image_path = iso_tree_get_node_path(node);
}
return 1; return 1;
} }
@ -4868,6 +4915,7 @@ int iso_analyze_sun(IsoImage *image, IsoDataSource *src, int flag)
if (ret > 0) { if (ret > 0) {
iso_node_ref(node); iso_node_ref(node);
sai->sparc_core_node = (IsoFile *) node; sai->sparc_core_node = (IsoFile *) node;
sai->sparc_core_node_path = iso_tree_get_node_path(node);
} }
} else { } else {
sai->sparc_grub2_core_adr = 0; sai->sparc_grub2_core_adr = 0;
@ -5326,9 +5374,13 @@ int iso_impsysa_report(IsoImage *image, struct iso_impsysa_result *target,
if (part->block_count == 0) if (part->block_count == 0)
continue; continue;
sprintf(msg, "MBR partition path : %3d ", part->desired_slot); sprintf(msg, "MBR partition path : %3d ", part->desired_slot);
if (part->image_path != NULL) {
iso_impsysa_report_text(target, msg, part->image_path, 0);
} else {
iso_impsysa_report_blockpath(image, target, msg, iso_impsysa_report_blockpath(image, target, msg,
(uint32_t) (part->start_block / 4), 0); (uint32_t) (part->start_block / 4), 0);
} }
}
if (sai->prep_part_start > 0 && sai->prep_part_size > 0) { if (sai->prep_part_start > 0 && sai->prep_part_size > 0) {
sprintf(msg, "PReP boot partition: %u %u", sprintf(msg, "PReP boot partition: %u %u",
sai->prep_part_start, sai->prep_part_size); sai->prep_part_start, sai->prep_part_size);
@ -5392,10 +5444,16 @@ int iso_impsysa_report(IsoImage *image, struct iso_impsysa_result *target,
sai->sparc_grub2_core_size); sai->sparc_grub2_core_size);
iso_impsysa_line(target, msg); iso_impsysa_line(target, msg);
if (sai->sparc_core_node != NULL) { if (sai->sparc_core_node != NULL) {
path = iso_tree_get_node_path((IsoNode *) sai->sparc_core_node); if(sai->sparc_core_node_path != NULL) {
path = sai->sparc_core_node_path;
} else {
path = iso_tree_get_node_path(
(IsoNode *) sai->sparc_core_node);
}
if (path != NULL) { if (path != NULL) {
sprintf(msg, "SPARC GRUB2 path : "); sprintf(msg, "SPARC GRUB2 path : ");
iso_impsysa_report_text(target, msg, path, 0); iso_impsysa_report_text(target, msg, path, 0);
if (sai->sparc_core_node_path == NULL)
free(path); free(path);
} }
} }
@ -5486,9 +5544,13 @@ int iso_impsysa_report(IsoImage *image, struct iso_impsysa_result *target,
if (gpt_entry->block_count == 0) if (gpt_entry->block_count == 0)
continue; continue;
sprintf(msg, "GPT partition path : %3d ", idx); sprintf(msg, "GPT partition path : %3d ", idx);
if (gpt_entry->image_path != NULL) {
iso_impsysa_report_text(target, msg, gpt_entry->image_path, 0);
} else {
iso_impsysa_report_blockpath(image, target, msg, iso_impsysa_report_blockpath(image, target, msg,
(uint32_t) (gpt_entry->start_block / 4), 0); (uint32_t) (gpt_entry->start_block / 4), 0);
} }
}
if (sai->apm_req_count > 0) { if (sai->apm_req_count > 0) {
sprintf(msg, "APM : N Info"); sprintf(msg, "APM : N Info");
@ -5512,11 +5574,15 @@ int iso_impsysa_report(IsoImage *image, struct iso_impsysa_result *target,
if (apm_entry->block_count == 0) if (apm_entry->block_count == 0)
continue; continue;
sprintf(msg, "APM partition path : %3d ", idx); sprintf(msg, "APM partition path : %3d ", idx);
if (apm_entry->image_path != NULL) {
iso_impsysa_report_text(target, msg, apm_entry->image_path, 0);
} else {
iso_impsysa_report_blockpath(image, target, msg, iso_impsysa_report_blockpath(image, target, msg,
(uint32_t) (apm_entry->start_block / (uint32_t) (apm_entry->start_block /
(2048 / sai->apm_block_size)), (2048 / sai->apm_block_size)),
0); 0);
} }
}
ret = 1; ret = 1;
ex: ex:
@ -5671,9 +5737,13 @@ int iso_eltorito_report(IsoImage *image, struct iso_impsysa_result *target,
} }
for (i= 0; i < bootcat->num_bootimages; i++) { for (i= 0; i < bootcat->num_bootimages; i++) {
img = bootcat->bootimages[i]; img = bootcat->bootimages[i];
if (lba_mem[i] != 0xffffffff) {
sprintf(msg, "El Torito img path : %3d ", i + 1); sprintf(msg, "El Torito img path : %3d ", i + 1);
if (img->image_path != NULL) {
iso_impsysa_report_text(target, msg, img->image_path, 0);
} else if (lba_mem[i] != 0xffffffff) {
iso_impsysa_report_blockpath(image, target, msg, lba_mem[i], 1); iso_impsysa_report_blockpath(image, target, msg, lba_mem[i], 1);
}
if (lba_mem[i] != 0xffffffff) {
if (img->type == 4 && img->emul_hdd_size > 0) { if (img->type == 4 && img->emul_hdd_size > 0) {
sprintf(msg, "El Torito hdsiz/512: %3d %u", sprintf(msg, "El Torito hdsiz/512: %3d %u",
i + 1, (unsigned int) img->emul_hdd_size); i + 1, (unsigned int) img->emul_hdd_size);
@ -6444,7 +6514,7 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
struct el_torito_boot_catalog *oldbootcat; struct el_torito_boot_catalog *oldbootcat;
uint8_t *rpt; uint8_t *rpt;
IsoFileSource *boot_src; IsoFileSource *boot_src;
IsoNode *node; IsoNode *node, *boot_image_node;
char *old_checksum_array = NULL; char *old_checksum_array = NULL;
char checksum_type[81]; char checksum_type[81];
uint32_t checksum_size, truncate_mode, truncate_length; uint32_t checksum_size, truncate_mode, truncate_length;
@ -6653,6 +6723,7 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
goto import_revert; goto import_revert;
} }
boot_image->image = NULL; boot_image->image = NULL;
boot_image->image_path = NULL;
boot_image->bootable = data->boot_flags[idx] & 1; boot_image->bootable = data->boot_flags[idx] & 1;
boot_image->type = data->media_types[idx]; boot_image->type = data->media_types[idx];
boot_image->partition_type = data->partition_types[idx]; boot_image->partition_type = data->partition_types[idx];
@ -6781,6 +6852,19 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
} }
} }
} }
/* Try to obtain boot image paths */
for (idx = 0; idx < image->bootcat->num_bootimages; idx++) {
boot_image_node =
(IsoNode *) image->bootcat->bootimages[idx]->image;
if (boot_image_node == NULL)
continue;
if (image->bootcat->bootimages[idx]->image_path != NULL)
free(image->bootcat->bootimages[idx]->image_path);
image->bootcat->bootimages[idx]->image_path =
iso_tree_get_node_path(boot_image_node);
}
if (image->bootcat->node == NULL) { if (image->bootcat->node == NULL) {
IsoNode *node; IsoNode *node;
IsoBoot *bootcat; IsoBoot *bootcat;

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2007 Vreixo Formoso * Copyright (c) 2007 Vreixo Formoso
* Copyright (c) 2009 - 2022 Thomas Schmitt * Copyright (c) 2009 - 2024 Thomas Schmitt
* *
* This file is part of the libisofs project; you can redistribute it and/or * This file is part of the libisofs project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2 * modify it under the terms of the GNU General Public License version 2
@ -17,6 +17,7 @@
#include "node.h" #include "node.h"
#include "messages.h" #include "messages.h"
#include "eltorito.h" #include "eltorito.h"
#include "system_area.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -43,6 +44,7 @@ int iso_imported_sa_new(struct iso_imported_sys_area **boots, int flag)
b->sparc_disc_label = NULL; b->sparc_disc_label = NULL;
b->sparc_core_node = NULL; b->sparc_core_node = NULL;
b->sparc_core_node_path = NULL;
b->sparc_entries = NULL; b->sparc_entries = NULL;
b->hppa_cmdline = NULL; b->hppa_cmdline = NULL;
@ -71,18 +73,27 @@ int iso_imported_sa_unref(struct iso_imported_sys_area **boots, int flag)
return 2; return 2;
if (b->mbr_req != NULL) { if (b->mbr_req != NULL) {
for (i = 0; i < b->mbr_req_count; i++) for (i = 0; i < b->mbr_req_count; i++) {
if (b->mbr_req[i] != NULL)
LIBISO_FREE_MEM(b->mbr_req[i]->image_path);
LIBISO_FREE_MEM(b->mbr_req[i]); LIBISO_FREE_MEM(b->mbr_req[i]);
}
LIBISO_FREE_MEM(b->mbr_req); LIBISO_FREE_MEM(b->mbr_req);
} }
if (b->apm_req != NULL) { if (b->apm_req != NULL) {
for (i = 0; i < b->apm_req_count; i++) for (i = 0; i < b->apm_req_count; i++) {
if (b->apm_req[i] != NULL)
LIBISO_FREE_MEM(b->apm_req[i]->image_path);
LIBISO_FREE_MEM(b->apm_req[i]); LIBISO_FREE_MEM(b->apm_req[i]);
}
LIBISO_FREE_MEM(b->apm_req); LIBISO_FREE_MEM(b->apm_req);
} }
if (b->gpt_req != NULL) { if (b->gpt_req != NULL) {
for (i = 0; i < b->gpt_req_count; i++) for (i = 0; i < b->gpt_req_count; i++) {
if (b->gpt_req[i] != NULL)
LIBISO_FREE_MEM(b->gpt_req[i]->image_path);
LIBISO_FREE_MEM(b->gpt_req[i]); LIBISO_FREE_MEM(b->gpt_req[i]);
}
LIBISO_FREE_MEM(b->gpt_req); LIBISO_FREE_MEM(b->gpt_req);
} }
LIBISO_FREE_MEM(b->gpt_backup_comments); LIBISO_FREE_MEM(b->gpt_backup_comments);
@ -102,6 +113,7 @@ int iso_imported_sa_unref(struct iso_imported_sys_area **boots, int flag)
LIBISO_FREE_MEM(b->sparc_disc_label); LIBISO_FREE_MEM(b->sparc_disc_label);
if (b->sparc_core_node != NULL) if (b->sparc_core_node != NULL)
iso_node_unref((IsoNode *) b->sparc_core_node); iso_node_unref((IsoNode *) b->sparc_core_node);
LIBISO_FREE_MEM(b->sparc_core_node_path);
LIBISO_FREE_MEM(b->sparc_entries); LIBISO_FREE_MEM(b->sparc_entries);
LIBISO_FREE_MEM(b->hppa_cmdline); LIBISO_FREE_MEM(b->hppa_cmdline);

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2007 Vreixo Formoso * Copyright (c) 2007 Vreixo Formoso
* Copyright (c) 2009 - 2022 Thomas Schmitt * Copyright (c) 2009 - 2024 Thomas Schmitt
* *
* This file is part of the libisofs project; you can redistribute it and/or * This file is part of the libisofs project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2 * modify it under the terms of the GNU General Public License version 2
@ -418,6 +418,12 @@ struct iso_imported_sys_area {
uint32_t sparc_grub2_core_size; uint32_t sparc_grub2_core_size;
IsoFile *sparc_core_node; IsoFile *sparc_core_node;
/* Only for representing the imported ISO:
Path of file which held the partition content.
NULL = no such file
*/
char *sparc_core_node_path;
/* see image.h : struct Iso_Image */ /* see image.h : struct Iso_Image */
int hppa_hdrversion; int hppa_hdrversion;
char *hppa_cmdline; char *hppa_cmdline;

View File

@ -4,7 +4,7 @@
/* /*
* Copyright (c) 2007-2008 Vreixo Formoso, Mario Danic * Copyright (c) 2007-2008 Vreixo Formoso, Mario Danic
* Copyright (c) 2009-2023 Thomas Schmitt * Copyright (c) 2009-2024 Thomas Schmitt
* *
* This file is part of the libisofs project; you can redistribute it and/or * This file is part of the libisofs project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2 * modify it under the terms of the GNU General Public License version 2
@ -4465,8 +4465,8 @@ int iso_image_get_system_area(IsoImage *img, char data[32768],
" gives partition number, status byte, type byte, start block,", \ " gives partition number, status byte, type byte, start block,", \
" and number of blocks. 512 bytes per block.", \ " and number of blocks. 512 bytes per block.", \
" MBR partition path : X path", \ " MBR partition path : X path", \
" the path of a file in the ISO image which begins at the partition", \ " the path of a file in the ISO image which began at the start block", \
" start block of partition X.", \ " of partition X when the ISO filesystem was imported.", \
" PReP boot partition: decimal decimal", \ " PReP boot partition: decimal decimal", \
" gives start block and size of a PReP boot partition in ISO 9660", \ " gives start block and size of a PReP boot partition in ISO 9660", \
" block units of 2048 bytes.", \ " block units of 2048 bytes.", \
@ -4532,8 +4532,8 @@ int iso_image_get_system_area(IsoImage *img, char data[32768],
" GPT start and size : X decimal decimal", \ " GPT start and size : X decimal decimal", \
" start block and number of blocks of partition X. 512 bytes per block.", \ " start block and number of blocks of partition X. 512 bytes per block.", \
" GPT partition path : X path", \ " GPT partition path : X path", \
" the path of a file in the ISO image which begins at the partition", \ " the path of a file in the ISO image which began at the start block", \
" start block of partition X.", \ " of partition X when the ISO filesystem was imported.", \
"" ""
#define ISO_SYSAREA_REPORT_DOC_APM \ #define ISO_SYSAREA_REPORT_DOC_APM \
\ \
@ -4553,8 +4553,8 @@ int iso_image_get_system_area(IsoImage *img, char data[32768],
" APM start and size : X decimal decimal", \ " APM start and size : X decimal decimal", \
" start block and number of blocks of partition X.", \ " start block and number of blocks of partition X.", \
" APM partition path : X path", \ " APM partition path : X path", \
" the path of a file in the ISO image which begins at the partition", \ " the path of a file in the ISO image which began at the start block", \
" start block of partition X.", \ " of partition X when the ISO filesystem was imported.", \
"" ""
#define ISO_SYSAREA_REPORT_DOC_MIPS \ #define ISO_SYSAREA_REPORT_DOC_MIPS \
\ \
@ -4564,8 +4564,9 @@ int iso_image_get_system_area(IsoImage *img, char data[32768],
" MIPS-BE boot entry : X upto8chr decimal decimal", \ " MIPS-BE boot entry : X upto8chr decimal decimal", \
" tells name, 512-byte block address, and byte count of boot entry X.", \ " tells name, 512-byte block address, and byte count of boot entry X.", \
" MIPS-BE boot path : X path", \ " MIPS-BE boot path : X path", \
" tells the path to the boot image file in the ISO image which belongs", \ " tells the path to the boot image file in the ISO image which began", \
" to the block address given by boot entry X.", \ " at the block address given by boot entry X when the ISO filesystem", \
" was imported.", \
"", \ "", \
"If a DEC Boot Block for MIPS Little Endian is detected, there may be:", \ "If a DEC Boot Block for MIPS Little Endian is detected, there may be:", \
" MIPS-LE boot map : LoadAddr ExecAddr SegmentSize SegmentStart", \ " MIPS-LE boot map : LoadAddr ExecAddr SegmentSize SegmentStart", \
@ -4575,8 +4576,9 @@ int iso_image_get_system_area(IsoImage *img, char data[32768],
" of the boot file. The first two are counted in bytes, the other two", \ " of the boot file. The first two are counted in bytes, the other two", \
" are counted in blocks of 512 bytes.", \ " are counted in blocks of 512 bytes.", \
" MIPS-LE boot path : path", \ " MIPS-LE boot path : path", \
" tells the path to the boot file in the ISO image which belongs to the", \ " tells the path to the boot image file in the ISO image which began", \
" address given by SegmentStart.", \ " at the block address given by SegmentStart when the ISO filesystem", \
" was imported.", \
" MIPS-LE elf offset : decimal", \ " MIPS-LE elf offset : decimal", \
" tells the relative 512-byte block offset inside the boot file:", \ " tells the relative 512-byte block offset inside the boot file:", \
" SegmentStart - FileStartBlock", \ " SegmentStart - FileStartBlock", \
@ -4600,8 +4602,8 @@ int iso_image_get_system_area(IsoImage *img, char data[32768],
" SPARC GRUB2 core : decimal decimal", \ " SPARC GRUB2 core : decimal decimal", \
" tells byte address and byte count of the GRUB2 SPARC core file.", \ " tells byte address and byte count of the GRUB2 SPARC core file.", \
" SPARC GRUB2 path : path", \ " SPARC GRUB2 path : path", \
" tells the path to the data file in the ISO image which belongs to the", \ " tells the path to the data file in the ISO image which began at the", \
" address given by core.", \ " address given by core when the ISO filesystem was imported.", \
"" ""
#define ISO_SYSAREA_REPORT_DOC_HPPA \ #define ISO_SYSAREA_REPORT_DOC_HPPA \
\ \
@ -4613,7 +4615,9 @@ int iso_image_get_system_area(IsoImage *img, char data[32768],
" HP-PA boot files : ByteAddr ByteSize Path", \ " HP-PA boot files : ByteAddr ByteSize Path", \
" headline for human readers.", \ " headline for human readers.", \
" HP-PA 32-bit kernel: decimal decimal path", \ " HP-PA 32-bit kernel: decimal decimal path", \
" tells start byte, byte count, and file path of the 32-bit kernel.", \ " tells start byte and byte count of the 32-bit kernel and the path", \
" to the data file in the ISO image which began at the start byte", \
" when the ISO filesystem was imported.", \
" HP-PA 64-bit kernel: decimal decimal path", \ " HP-PA 64-bit kernel: decimal decimal path", \
" tells the same for the 64-bit kernel.", \ " tells the same for the 64-bit kernel.", \
" HP-PA ramdisk : decimal decimal path", \ " HP-PA ramdisk : decimal decimal path", \
@ -4629,8 +4633,8 @@ int iso_image_get_system_area(IsoImage *img, char data[32768],
" DEC Alpha ldr adr : decimal", \ " DEC Alpha ldr adr : decimal", \
" tells the start of the loader file in units of 512-byte blocks.", \ " tells the start of the loader file in units of 512-byte blocks.", \
" DEC Alpha ldr path : path", \ " DEC Alpha ldr path : path", \
" tells the path of a file in the ISO image which starts at the loader", \ " tells the path to a file in the ISO image which began at the", \
" start address." " loader start address when the ISO filesystem was imported."
/** /**
* Obtain an array of texts describing the detected properties of the * Obtain an array of texts describing the detected properties of the
@ -4698,12 +4702,13 @@ int iso_image_report_system_area(IsoImage *image,
"", \ "", \
"The following lines appear conditionally:", \ "The following lines appear conditionally:", \
" El Torito cat path : iso_rr_path", \ " El Torito cat path : iso_rr_path", \
" tells the path to the data file in the ISO image which belongs to", \ " tells the path to the data file in the ISO image which began at the", \
" the block address where the boot catalog starts.", \ " block address where the boot catalog starts when the ISO filesystem", \
" was imported.", \
" (This line is not reported if no path points to that block.)", \ " (This line is not reported if no path points to that block.)", \
" El Torito img path : X iso_rr_path", \ " El Torito img path : X iso_rr_path", \
" tells the path to the data file in the ISO image which belongs to", \ " tells the path to the data file in the ISO image which began at the", \
" the block address given by LBA of boot image X.", \ " LBA of boot image X when the ISO filesystem was imported.", \
" (This line is not reported if no path points to that block.)", \ " (This line is not reported if no path points to that block.)", \
" El Torito img opts : X word ... word", \ " El Torito img opts : X word ... word", \
" tells the presence of extra features:", \ " tells the presence of extra features:", \
@ -8565,15 +8570,16 @@ int iso_file_get_md5(IsoImage *image, IsoFile *file, char md5[16], int flag);
int iso_file_make_md5(IsoFile *file, int flag); int iso_file_make_md5(IsoFile *file, int flag);
/** /**
* Check a data block whether it is a libisofs session checksum tag and * Check a data block whether it is a libisofs checksum tag and if so, obtain
* eventually obtain its recorded parameters. These tags get written after * its recorded parameters. These tags get written after volume descriptors,
* volume descriptors, directory tree and checksum array and can be detected * directory tree and checksum array and can be detected without loading the
* without loading the image tree. * image tree.
* One may start reading and computing MD5 at the suspected image session * One may start reading and computing MD5 at the suspected image session
* start and look out for a session tag on the fly. See doc/checksum.txt . * start and look out for a checksum tag on the fly. See doc/checksum.txt .
* @param data * @param data
* A complete and aligned data block read from an ISO image session. * A complete and aligned data block read from an ISO image session.
* @param tag_type * @param tag_type
* Returns the tag type:
* 0= no tag * 0= no tag
* 1= session tag * 1= session tag
* 2= superblock tag * 2= superblock tag
@ -8593,7 +8599,7 @@ int iso_file_make_md5(IsoFile *file, int flag);
* covered by parameter md5. * covered by parameter md5.
* @param next_tag * @param next_tag
* Returns the predicted block address of the next tag. * Returns the predicted block address of the next tag.
* next_tag is valid only if not 0 and only with return values 2, 3, 4. * next_tag is valid only if not 0 and only with tag types 2, 3, 4.
* With tag types 2 and 3, reading shall go on sequentially and the MD5 * With tag types 2 and 3, reading shall go on sequentially and the MD5
* computation shall continue up to that address. * computation shall continue up to that address.
* With tag type 4, reading shall resume either at LBA 32 for the first * With tag type 4, reading shall resume either at LBA 32 for the first

View File

@ -1053,6 +1053,7 @@ int iso_quick_apm_entry(struct iso_apm_partition_request **req_array,
if (l > 0) if (l > 0)
memcpy((char *) entry->type, type, l); memcpy((char *) entry->type, type, l);
entry->req_status = 0; entry->req_status = 0;
entry->image_path = NULL;
ret = iso_register_apm_entry(req_array, apm_req_count, entry, 0); ret = iso_register_apm_entry(req_array, apm_req_count, entry, 0);
free(entry); free(entry);
return ret; return ret;
@ -1099,6 +1100,7 @@ int iso_quick_gpt_entry(struct iso_gpt_partition_request **req_array,
entry->flags = flags; entry->flags = flags;
memcpy(entry->name, name, 72); memcpy(entry->name, name, 72);
entry->req_status = 0; entry->req_status = 0;
entry->image_path = NULL;
ret = iso_register_gpt_entry(req_array, gpt_req_count, entry, 0); ret = iso_register_gpt_entry(req_array, gpt_req_count, entry, 0);
free(entry); free(entry);
return ret; return ret;
@ -1128,6 +1130,7 @@ int iso_quick_mbr_entry(struct iso_mbr_partition_request **req_array,
entry->type_byte = type_byte; entry->type_byte = type_byte;
entry->status_byte = status_byte; entry->status_byte = status_byte;
entry->desired_slot = desired_slot; entry->desired_slot = desired_slot;
entry->image_path = NULL;
ret = iso_register_mbr_entry(req_array, mbr_req_count, entry, 0); ret = iso_register_mbr_entry(req_array, mbr_req_count, entry, 0);
free(entry); free(entry);
return ret; return ret;
@ -2542,6 +2545,13 @@ int iso_register_apm_entry(struct iso_apm_partition_request **req_array,
return ISO_OUT_OF_MEM; return ISO_OUT_OF_MEM;
memcpy(entry, req, sizeof(struct iso_apm_partition_request)); memcpy(entry, req, sizeof(struct iso_apm_partition_request));
if (req->image_path != NULL) {
entry->image_path = strdup(req->image_path);
if (entry->image_path == NULL) {
LIBISO_FREE_MEM(entry);
return ISO_OUT_OF_MEM;
}
}
req_array[*apm_req_count] = entry; req_array[*apm_req_count] = entry;
(*apm_req_count)++; (*apm_req_count)++;
return ISO_SUCCESS; return ISO_SUCCESS;
@ -2561,6 +2571,13 @@ int iso_register_mbr_entry(struct iso_mbr_partition_request **req_array,
return ISO_OUT_OF_MEM; return ISO_OUT_OF_MEM;
memcpy(entry, req, sizeof(struct iso_mbr_partition_request)); memcpy(entry, req, sizeof(struct iso_mbr_partition_request));
if (req->image_path != NULL) {
entry->image_path = strdup(req->image_path);
if (entry->image_path == NULL) {
LIBISO_FREE_MEM(entry);
return ISO_OUT_OF_MEM;
}
}
req_array[*mbr_req_count] = entry; req_array[*mbr_req_count] = entry;
(*mbr_req_count)++; (*mbr_req_count)++;
return ISO_SUCCESS; return ISO_SUCCESS;
@ -2579,6 +2596,13 @@ int iso_register_gpt_entry(struct iso_gpt_partition_request **req_array,
return ISO_OUT_OF_MEM; return ISO_OUT_OF_MEM;
memcpy(entry, req, sizeof(struct iso_gpt_partition_request)); memcpy(entry, req, sizeof(struct iso_gpt_partition_request));
if (req->image_path != NULL) {
entry->image_path = strdup(req->image_path);
if (entry->image_path == NULL) {
LIBISO_FREE_MEM(entry);
return ISO_OUT_OF_MEM;
}
}
req_array[*gpt_req_count] = entry; req_array[*gpt_req_count] = entry;
(*gpt_req_count)++; (*gpt_req_count)++;
return ISO_SUCCESS; return ISO_SUCCESS;

View File

@ -104,6 +104,12 @@ struct iso_mbr_partition_request {
*/ */
int desired_slot; int desired_slot;
/* Only when representing an imported partition:
Path of file in imported ISO which holds the partition content.
NULL = no such file
*/
char *image_path;
}; };
/* Copies the content of req and registers it in t.mbr_req[]. /* Copies the content of req and registers it in t.mbr_req[].
@ -162,6 +168,13 @@ struct iso_apm_partition_request {
bit0= this is an automatically placed filler partition bit0= this is an automatically placed filler partition
*/ */
uint32_t req_status; uint32_t req_status;
/* Only when representing an imported partition:
Path of file in imported ISO which holds the partition content.
NULL = no such file
*/
char *image_path;
}; };
/* Copies the content of req and registers it in t.apm_req[]. /* Copies the content of req and registers it in t.apm_req[].
@ -260,6 +273,12 @@ struct iso_gpt_partition_request {
note is issued and the partition gets into the higher slot. note is issued and the partition gets into the higher slot.
*/ */
int desired_slot; int desired_slot;
/* Only when representing an imported partition:
Path of file in imported ISO which holds the partition content.
NULL = no such file
*/
char *image_path;
}; };
/* Copies the content of req and registers it in t.gpt_req[]. /* Copies the content of req and registers it in t.gpt_req[].