Compare commits

..

1 Commits

18 changed files with 139 additions and 515 deletions

View File

@ -1,12 +1,7 @@
git clone git@dev.lovelyhq.com:libburnia/libisofs.git libisofs-1.5.6.pl01.tar.gz Mon Jun 12 2023
(to become libisofs-1.5.8 or higher)
===============================================================================
- no novelties yet -
libisofs-1.5.6.pl01.tar.gz Fri Jun 09 2023
=============================================================================== ===============================================================================
* Bug fix: On non-GNU/Linux systems ssize_t was not defined in rockridge.h . * Bug fix: On non-GNU/Linux systems ssize_t was not defined in rockridge.h .
Report and fix proposal by Rui Chen Report and fix proposal by Rui Chen.
libisofs-1.5.6.tar.gz Wed Jun 07 2023 libisofs-1.5.6.tar.gz Wed Jun 07 2023
=============================================================================== ===============================================================================
@ -27,6 +22,7 @@ libisofs-1.5.6.tar.gz Wed Jun 07 2023
Proof-of-concept by Ivan Shmakov. Proof-of-concept by Ivan Shmakov.
* New API call iso_write_opts_set_max_ce_entries() * New API call iso_write_opts_set_max_ce_entries()
libisofs-1.5.4.tar.gz Sat Jan 30 2021 libisofs-1.5.4.tar.gz Sat Jan 30 2021
=============================================================================== ===============================================================================
* Bug fix: Large amounts of AAIP data or many long file names could cause with * Bug fix: Large amounts of AAIP data or many long file names could cause with

2
README
View File

@ -5,7 +5,7 @@
Released under GNU General Public License version 2 or later. Released under GNU General Public License version 2 or later.
See COPYING file for details. See COPYING file for details.
Copyright (C) 2008 - 2023 Vreixo Formoso, Copyright (C) 2008 - 2021 Vreixo Formoso,
Mario Danic, Mario Danic,
Vladimir Serbinenko, Vladimir Serbinenko,
Thomas Schmitt Thomas Schmitt

View File

@ -1,4 +1,4 @@
AC_INIT([libisofs], [1.5.7], [http://libburnia-project.org]) AC_INIT([libisofs], [1.5.6], [http://libburnia-project.org])
AC_PREREQ([2.50]) AC_PREREQ([2.50])
dnl AC_CONFIG_HEADER([config.h]) dnl AC_CONFIG_HEADER([config.h])
@ -41,7 +41,7 @@ dnl If LIBISOFS_*_VERSION changes, be sure to change AC_INIT above to match.
dnl dnl
LIBISOFS_MAJOR_VERSION=1 LIBISOFS_MAJOR_VERSION=1
LIBISOFS_MINOR_VERSION=5 LIBISOFS_MINOR_VERSION=5
LIBISOFS_MICRO_VERSION=7 LIBISOFS_MICRO_VERSION=6
LIBISOFS_VERSION=$LIBISOFS_MAJOR_VERSION.$LIBISOFS_MINOR_VERSION.$LIBISOFS_MICRO_VERSION LIBISOFS_VERSION=$LIBISOFS_MAJOR_VERSION.$LIBISOFS_MINOR_VERSION.$LIBISOFS_MICRO_VERSION
AC_SUBST(LIBISOFS_MAJOR_VERSION) AC_SUBST(LIBISOFS_MAJOR_VERSION)

View File

@ -956,35 +956,17 @@ Updated change log
* Bug fix: Size of further CE area was calculated wrong if its CE entry ended * Bug fix: Size of further CE area was calculated wrong if its CE entry ended
exactly at a block boundary exactly at a block boundary
07 Jun 2023 [5a867c4]
configure.ac
libisofs/libisofs.h
Version leap to 1.5.7
[master: ][branch 1.5.6.pl01: ] 12 Jun 2023 [branch-1.5.6.pl01: ]
libisofs/rockridge.h libisofs/rockridge.h
ChangeLog ChangeLog
libisofs/changelog.txt libisofs/changelog.txt
Bug fix: On non-GNU/Linux systems ssize_t was not defined in rockridge.h . Bug fix: On non-GNU/Linux systems ssize_t was not defined in rockridge.h .
Report and fix proposal by Rui Chen Report and fix proposal by Rui Chen.
------------------------------- release - libisofs-1.5.6.pl01 - 09 Jun 2023 ------------------------------- release - libisofs-1.5.6.pl01 - 12 Jun 2023
* Bug fix: On non-GNU/Linux systems ssize_t was not defined in rockridge.h . * Bug fix: On non-GNU/Linux systems ssize_t was not defined in rockridge.h .
Report and fix proposal by Rui Chen Report and fix proposal by Rui Chen.
[]
libisofs/ecma119.c
libisofs/fs_image.c
libisofs/rockridge.c
libisofs/stream.c
[]
README
Updated copyright year in README
------------------------------------ release - libisofs-1.5.8 -
------------------------------------------------------------------------ ------------------------------------------------------------------------

View File

@ -41,7 +41,6 @@
#include <locale.h> #include <locale.h>
#include <langinfo.h> #include <langinfo.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h>
#ifdef Xorriso_standalonE #ifdef Xorriso_standalonE
@ -2764,8 +2763,6 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *in_opts, Ecma119Image **img)
target->joliet_ucs2_failures = 0; target->joliet_ucs2_failures = 0;
target->joliet_symlinks = 0; target->joliet_symlinks = 0;
target->joliet_specials = 0; target->joliet_specials = 0;
target->iso1999_symlinks = 0;
target->iso1999_specials = 0;
/* If partitions get appended, then the backup GPT cannot be part of /* If partitions get appended, then the backup GPT cannot be part of
the ISO filesystem. the ISO filesystem.
@ -3305,16 +3302,6 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *in_opts, Ecma119Image **img)
"Number of special files omitted from Joliet tree: %lu", "Number of special files omitted from Joliet tree: %lu",
target->joliet_specials); target->joliet_specials);
} }
if (target->iso1999_symlinks > 0) {
iso_msg_submit(target->image->id, ISO_FILE_IGNORED, 0,
"Number of symbolic links omitted from ISO 9660:1999 tree: %lu",
target->iso1999_symlinks);
}
if (target->iso1999_specials > 0) {
iso_msg_submit(target->image->id, ISO_FILE_IGNORED, 0,
"Number of special files omitted from ISO 9660:1999 tree: %lu",
target->iso1999_specials);
}
*img = target; *img = target;
return ISO_SUCCESS; return ISO_SUCCESS;
@ -4705,9 +4692,6 @@ void iso_tell_max_part_range(IsoWriteOpts *opts,
if (sa_type == 3) { /* SUN Disk Label */ if (sa_type == 3) { /* SUN Disk Label */
*first_partition = 2; *first_partition = 2;
*last_partition = 8; *last_partition = 8;
} else if(sa_type == 0 && opts->appended_as_gpt) {
*first_partition = 1;
*last_partition = 8;
} else { } else {
*first_partition = 1; *first_partition = 1;
*last_partition = 4; *last_partition = 4;

View File

@ -933,12 +933,6 @@ struct ecma119_image
unsigned long joliet_symlinks; unsigned long joliet_symlinks;
unsigned long joliet_specials; unsigned long joliet_specials;
/* Count of symbolic links and special files which could not be represented
in ISO 9660:1999.
*/
unsigned long iso1999_symlinks;
unsigned long iso1999_specials;
}; };
#define BP(a,b) [(b) - (a) + 1] #define BP(a,b) [(b) - (a) + 1]

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2007 Vreixo Formoso * Copyright (c) 2007 Vreixo Formoso
* Copyright (c) 2010 - 2024 Thomas Schmitt * Copyright (c) 2010 - 2016 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,8 +845,6 @@ 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 - 2024 Thomas Schmitt * Copyright (c) 2010 - 2018 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,9 +53,6 @@ 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 - 2024 Thomas Schmitt * Copyright (c) 2009 - 2022 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
@ -36,7 +36,6 @@
#include <limits.h> #include <limits.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <unistd.h>
/* Enable this and write the correct absolute path into the include statement /* Enable this and write the correct absolute path into the include statement
@ -550,10 +549,6 @@ struct image_fs_data
}; };
static int iso_impsysa_reduce_next_above(IsoImage *image, uint32_t block,
uint32_t *next_above, int flag);
struct child_list struct child_list
{ {
IsoFileSource *file; IsoFileSource *file;
@ -1796,7 +1791,7 @@ if (name != NULL && !namecont) {
if (linkdest != NULL && linkdestcont == 0) { if (linkdest != NULL && linkdestcont == 0) {
/* ups, RR standard violation */ /* ups, RR standard violation */
ret = iso_rr_msg_submit(fsdata, 4, ISO_WRONG_RR_WARN, 0, ret = iso_rr_msg_submit(fsdata, 4, ISO_WRONG_RR_WARN, 0,
"New SL entry found without previous " "New SL entry found without previous"
"CONTINUE flag. Ignored"); "CONTINUE flag. Ignored");
continue; continue;
} }
@ -3602,8 +3597,6 @@ int create_boot_img_filesrc(IsoImageFilesystem *fs, IsoImage *image, int idx,
_ImageFsData *fsdata; _ImageFsData *fsdata;
IsoFileSource *ifsrc = NULL; IsoFileSource *ifsrc = NULL;
ImageFileSourceData *ifsdata = NULL; ImageFileSourceData *ifsdata = NULL;
IsoNode *node;
uint32_t size, next_above = 0, start_block;
if (fs == NULL || fs->data == NULL || src == NULL) { if (fs == NULL || fs->data == NULL || src == NULL) {
return ISO_NULL_POINTER; return ISO_NULL_POINTER;
@ -3617,32 +3610,12 @@ int create_boot_img_filesrc(IsoImageFilesystem *fs, IsoImage *image, int idx,
atts.st_nlink = 1; atts.st_nlink = 1;
/* /*
* Old comment from Vreixo Formoso:
* this is the greater problem. We don't know the size. For now, we * this is the greater problem. We don't know the size. For now, we
* just use a single block of data. In a future, maybe we could figure out * just use a single block of data. In a future, maybe we could figure out
* a better idea. Another alternative is to use several blocks, that way * a better idea. Another alternative is to use several blocks, that way
* is less probable that we throw out valid data. * is less probable that we throw out valid data.
*/ */
/* ts C31112 : Make use of size estimation "El Torito img blks :" */ atts.st_size = (off_t)BLOCK_SIZE;
/* (Code from iso_impsysa_report_blockpath() ) */
size = 1;
start_block = fsdata->bootblocks[idx];
iso_tree_get_node_of_block(image, NULL, start_block, &node, &next_above,
0);
ret = iso_impsysa_reduce_next_above(image, start_block, &next_above, 0);
if (ret >= 0) {
if (next_above != 0) {
/* It has to fit in a single extent */
if ((off_t) (next_above - start_block) * BLOCK_SIZE <
(off_t) 0xffffffff) {
size = next_above - start_block;
} else {
size = 0xffffffff / BLOCK_SIZE;
}
}
}
atts.st_size = (off_t) size * BLOCK_SIZE;
/* Fill last entries */ /* Fill last entries */
atts.st_dev = fsdata->id; atts.st_dev = fsdata->id;
@ -3674,7 +3647,7 @@ int create_boot_img_filesrc(IsoImageFilesystem *fs, IsoImage *image, int idx,
ifsdata->info = atts; ifsdata->info = atts;
ifsdata->name = NULL; ifsdata->name = NULL;
ifsdata->sections[0].block = fsdata->bootblocks[idx]; ifsdata->sections[0].block = fsdata->bootblocks[idx];
ifsdata->sections[0].size = size * BLOCK_SIZE; ifsdata->sections[0].size = BLOCK_SIZE;
ifsdata->nsections = 1; ifsdata->nsections = 1;
ifsrc->class = &ifs_class; ifsrc->class = &ifs_class;
@ -3691,7 +3664,7 @@ boot_fs_cleanup: ;
} }
/** ??? >>> ts B00428 : should the max size become public ? */ /** ??? >>> ts B00428 : should the max size become public ? */
#define Libisofs_boot_info_image_max_sizE (4096*1024) #define Libisofs_boot_image_max_sizE (4096*1024)
/** Guess which of the loaded boot images contain boot information tables. /** Guess which of the loaded boot images contain boot information tables.
Set boot->seems_boot_info_table accordingly. Set boot->seems_boot_info_table accordingly.
@ -3719,7 +3692,7 @@ int iso_image_eval_boot_info_table(IsoImage *image, struct iso_read_opts *opts,
boot->seems_grub2_boot_info = 0; boot->seems_grub2_boot_info = 0;
boot->seems_isohybrid_capable = 0; boot->seems_isohybrid_capable = 0;
img_size = iso_file_get_size(boot_file); img_size = iso_file_get_size(boot_file);
if (img_size > Libisofs_boot_info_image_max_sizE || img_size < 64) if (img_size > Libisofs_boot_image_max_sizE || img_size < 64)
continue; continue;
img_lba = 0; img_lba = 0;
sections = NULL; sections = NULL;
@ -4138,19 +4111,15 @@ ex:;
return ret; return ret;
} }
/* @param flag bit0= Pre-run: Only assess partition table.
*/
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, i, is_isohybrid = 0, is_grub2_mbr = 0; int sub_type = 2, ret, 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;
@ -4164,22 +4133,6 @@ int iso_analyze_mbr(IsoImage *image, IsoDataSource *src, int flag)
if (ret <= 0) if (ret <= 0)
goto ex; goto ex;
if((flag & 1)) {
ret= 1;
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;
@ -4489,8 +4442,6 @@ ex:
return ret; return ret;
} }
/* @param flag bit0= Pre-run: Only assess partition table.
*/
static static
int iso_analyze_gpt(IsoImage *image, IsoDataSource *src, int flag) int iso_analyze_gpt(IsoImage *image, IsoDataSource *src, int flag)
{ {
@ -4498,8 +4449,6 @@ int iso_analyze_gpt(IsoImage *image, IsoDataSource *src, int flag)
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;
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;
@ -4580,21 +4529,6 @@ 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, NULL, 0);
if (ret > 0)
gpt_entry->image_path = iso_tree_get_node_path(node);
}
return 1; return 1;
} }
@ -4620,8 +4554,6 @@ int iso_analyze_apm_head(IsoImage *image, IsoDataSource *src, int flag)
return 1; return 1;
} }
/* @param flag bit0= Pre-run: Only assess partition table.
*/
static static
int iso_analyze_apm(IsoImage *image, IsoDataSource *src, int flag) int iso_analyze_apm(IsoImage *image, IsoDataSource *src, int flag)
{ {
@ -4629,8 +4561,6 @@ int iso_analyze_apm(IsoImage *image, IsoDataSource *src, int flag)
uint32_t map_entries, start_block, block_count, flags; uint32_t map_entries, start_block, block_count, flags;
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;
@ -4675,27 +4605,9 @@ 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, NULL, 0);
if (ret > 0)
apm_entry->image_path = iso_tree_get_node_path(node);
}
return 1; return 1;
} }
/* @param flag bit0= Pre-run: Only assess partition table.
*/
static static
int iso_analyze_mips(IsoImage *image, IsoDataSource *src, int flag) int iso_analyze_mips(IsoImage *image, IsoDataSource *src, int flag)
{ {
@ -4764,13 +4676,11 @@ int iso_analyze_mips(IsoImage *image, IsoDataSource *src, int flag)
sai->mips_vd_entries[idx]->name[8] = 0; sai->mips_vd_entries[idx]->name[8] = 0;
sai->mips_vd_entries[idx]->boot_block = iso_read_msb(upart + 8, 4); sai->mips_vd_entries[idx]->boot_block = iso_read_msb(upart + 8, 4);
sai->mips_vd_entries[idx]->boot_bytes = iso_read_msb(upart + 12, 4); sai->mips_vd_entries[idx]->boot_bytes = iso_read_msb(upart + 12, 4);
if (!(flag & 1)) { ret = iso_tree_get_node_of_block(image, NULL,
ret = iso_tree_get_node_of_block(image, NULL,
sai->mips_vd_entries[idx]->boot_block / 4, sai->mips_vd_entries[idx]->boot_block / 4,
&node, NULL, 0); &node, NULL, 0);
if (ret > 0) if (ret > 0)
sai->mips_boot_file_paths[idx] = iso_tree_get_node_path(node); sai->mips_boot_file_paths[idx] = iso_tree_get_node_path(node);
}
sai->num_mips_boot_files++; sai->num_mips_boot_files++;
} }
if (sai->num_mips_boot_files > 0) if (sai->num_mips_boot_files > 0)
@ -4779,8 +4689,6 @@ int iso_analyze_mips(IsoImage *image, IsoDataSource *src, int flag)
return ret; return ret;
} }
/* @param flag bit0= Pre-run: Only assess partition table.
*/
static static
int iso_analyze_mipsel(IsoImage *image, IsoDataSource *src, int flag) int iso_analyze_mipsel(IsoImage *image, IsoDataSource *src, int flag)
{ {
@ -4808,22 +4716,19 @@ int iso_analyze_mipsel(IsoImage *image, IsoDataSource *src, int flag)
sai->mipsel_e_entry = iso_read_lsb(usad + 20, 4); sai->mipsel_e_entry = iso_read_lsb(usad + 20, 4);
sai->mipsel_p_filesz = iso_read_lsb(usad + 24, 4) * 512; sai->mipsel_p_filesz = iso_read_lsb(usad + 24, 4) * 512;
sai->mipsel_seg_start = iso_read_lsb(usad + 28, 4); sai->mipsel_seg_start = iso_read_lsb(usad + 28, 4);
if(!(flag & 1)) { ret = iso_tree_get_node_of_block(image, NULL, sai->mipsel_seg_start / 4,
ret = iso_tree_get_node_of_block(image, NULL, &node, NULL, 0);
sai->mipsel_seg_start / 4, &node, if (ret > 0) {
NULL, 0); sai->mipsel_boot_file_path = iso_tree_get_node_path(node);
if (ret > 0) { file = (IsoFile *) node;
sai->mipsel_boot_file_path = iso_tree_get_node_path(node); ret = iso_file_get_old_image_sections(file, &section_count,
file = (IsoFile *) node; &sections, 0);
ret = iso_file_get_old_image_sections(file, &section_count, if (ret > 0 && section_count > 0) {
&sections, 0); if (sections[0].block < (1 << 30) &&
if (ret > 0 && section_count > 0) { sections[0].block * 4 < sai->mipsel_seg_start)
if (sections[0].block < (1 << 30) && sai->mipsel_p_offset = sai->mipsel_seg_start -
sections[0].block * 4 < sai->mipsel_seg_start) sections[0].block * 4;
sai->mipsel_p_offset = sai->mipsel_seg_start - free(sections);
sections[0].block * 4;
free(sections);
}
} }
} }
/* DEC Boot Block for MIPS Little Endian */ /* DEC Boot Block for MIPS Little Endian */
@ -4832,8 +4737,6 @@ int iso_analyze_mipsel(IsoImage *image, IsoDataSource *src, int flag)
return 1; return 1;
} }
/* @param flag bit0= Pre-run: Only assess partition table.
*/
static static
int iso_analyze_sun(IsoImage *image, IsoDataSource *src, int flag) int iso_analyze_sun(IsoImage *image, IsoDataSource *src, int flag)
{ {
@ -4906,15 +4809,13 @@ int iso_analyze_sun(IsoImage *image, IsoDataSource *src, int flag)
sai->sparc_grub2_core_size + 2047) / 2048; sai->sparc_grub2_core_size + 2047) / 2048;
if (last_core_block > 0) if (last_core_block > 0)
last_core_block--; last_core_block--;
if (last_core_block > 17 && last_core_block < sai->image_size && if (last_core_block > 17 && last_core_block < sai->image_size) {
!(flag & 1)) {
ret = iso_tree_get_node_of_block(image, NULL, ret = iso_tree_get_node_of_block(image, NULL,
(uint32_t) last_core_block, &node, (uint32_t) last_core_block, &node,
NULL, 0); NULL, 0);
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;
@ -4927,8 +4828,6 @@ int iso_analyze_sun(IsoImage *image, IsoDataSource *src, int flag)
return 1; return 1;
} }
/* @param flag bit0= Pre-run: Only assess partition table.
*/
static static
int iso_analyze_hppa(IsoImage *image, IsoDataSource *src, int flag) int iso_analyze_hppa(IsoImage *image, IsoDataSource *src, int flag)
{ {
@ -4970,19 +4869,17 @@ int iso_analyze_hppa(IsoImage *image, IsoDataSource *src, int flag)
sai->hppa_ramdisk_len = iso_read_msb(usad + 20, 4); sai->hppa_ramdisk_len = iso_read_msb(usad + 20, 4);
adrs[3] = sai->hppa_bootloader_adr = iso_read_msb(usad + 240, 4); adrs[3] = sai->hppa_bootloader_adr = iso_read_msb(usad + 240, 4);
sai->hppa_bootloader_len = iso_read_msb(usad + 244, 4); sai->hppa_bootloader_len = iso_read_msb(usad + 244, 4);
if(!(flag & 1)) { for (i = 0; i < 4; i++) {
for (i = 0; i < 4; i++) { paths[i] = NULL;
paths[i] = NULL; ret = iso_tree_get_node_of_block(image, NULL, adrs[i] / 2048,
ret = iso_tree_get_node_of_block(image, NULL, adrs[i] / 2048, &node, NULL, 0);
&node, NULL, 0); if (ret > 0)
if (ret > 0) paths[i] = iso_tree_get_node_path(node);
paths[i] = iso_tree_get_node_path(node);
}
sai->hppa_kernel_32 = paths[0];
sai->hppa_kernel_64 = paths[1];
sai->hppa_ramdisk = paths[2];
sai->hppa_bootloader = paths[3];
} }
sai->hppa_kernel_32 = paths[0];
sai->hppa_kernel_64 = paths[1];
sai->hppa_ramdisk = paths[2];
sai->hppa_bootloader = paths[3];
if (sai->hppa_hdrversion == 5) if (sai->hppa_hdrversion == 5)
sai->hppa_ipl_entry = iso_read_msb(usad + 248, 4); sai->hppa_ipl_entry = iso_read_msb(usad + 248, 4);
@ -4993,8 +4890,6 @@ int iso_analyze_hppa(IsoImage *image, IsoDataSource *src, int flag)
return 1; return 1;
} }
/* @param flag bit0= Pre-run: Only assess partition table.
*/
static static
int iso_analyze_alpha_boot(IsoImage *image, IsoDataSource *src, int flag) int iso_analyze_alpha_boot(IsoImage *image, IsoDataSource *src, int flag)
{ {
@ -5019,27 +4914,25 @@ int iso_analyze_alpha_boot(IsoImage *image, IsoDataSource *src, int flag)
sai->alpha_boot_image = NULL; sai->alpha_boot_image = NULL;
sai->alpha_boot_image_size = (uint64_t) iso_read_lsb64(usad + 480); sai->alpha_boot_image_size = (uint64_t) iso_read_lsb64(usad + 480);
sai->alpha_boot_image_adr = (uint64_t) iso_read_lsb64(usad + 488); sai->alpha_boot_image_adr = (uint64_t) iso_read_lsb64(usad + 488);
if (!(flag & 1)) { ret = iso_tree_get_node_of_block(image, NULL,
ret = iso_tree_get_node_of_block(image, NULL,
(uint32_t) (sai->alpha_boot_image_adr / 4), (uint32_t) (sai->alpha_boot_image_adr / 4),
&node, NULL, 0); &node, NULL, 0);
if (ret > 0) { if (ret > 0) {
if (iso_node_get_type(node) != LIBISO_FILE) if (iso_node_get_type(node) != LIBISO_FILE)
return 0; return 0;
file = (IsoFile *) node; file = (IsoFile *) node;
ret = iso_file_get_old_image_sections(file, &section_count, ret = iso_file_get_old_image_sections(file, &section_count,
&sections, 0); &sections, 0);
if (ret > 0 && section_count > 0) { if (ret > 0 && section_count > 0) {
size = sections[0].size / 512 + !!(sections[0].size % 512); size = sections[0].size / 512 + !!(sections[0].size % 512);
free(sections); free(sections);
if (size != sai->alpha_boot_image_size) if (size != sai->alpha_boot_image_size)
return 0; return 0;
} }
sai->alpha_boot_image = iso_tree_get_node_path(node); sai->alpha_boot_image = iso_tree_get_node_path(node);
} else if (strncmp(sad, "Linux/Alpha aboot for ISO filesystem.", 37) } else if (strncmp(sad, "Linux/Alpha aboot for ISO filesystem.", 37) != 0
!= 0 || sad[37] != 0) { || sad[37] != 0) {
return 0; /* Want to see either boot file or genisoimage string */ return 0; /* Want to see either boot file or genisoimage string */
}
} }
sai->system_area_options = (6 << 2); sai->system_area_options = (6 << 2);
return 1; return 1;
@ -5122,8 +5015,6 @@ int iso_impsysa_reduce_next_above(IsoImage *image, uint32_t block,
struct iso_file_section *sections = NULL; struct iso_file_section *sections = NULL;
sai = image->imported_sa_info; sai = image->imported_sa_info;
if (sai == NULL)
return 0;
/* PVD, path table, root directory of active and of first session */ /* PVD, path table, root directory of active and of first session */
for (i = 0; i < sai->num_meta_struct_blocks; i++) for (i = 0; i < sai->num_meta_struct_blocks; i++)
@ -5174,7 +5065,7 @@ int iso_impsysa_reduce_next_above(IsoImage *image, uint32_t block,
iso_impsysa_reduce_na(block, next_above, sai->image_size); iso_impsysa_reduce_na(block, next_above, sai->image_size);
return 1; return ISO_SUCCESS;
} }
/* @param flag bit0= try to estimate the size if no path is found /* @param flag bit0= try to estimate the size if no path is found
@ -5373,12 +5264,8 @@ 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_blockpath(image, target, msg,
iso_impsysa_report_text(target, msg, part->image_path, 0); (uint32_t) (part->start_block / 4), 0);
} else {
iso_impsysa_report_blockpath(image, target, msg,
(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",
@ -5443,17 +5330,11 @@ 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) {
if(sai->sparc_core_node_path != NULL) { path = iso_tree_get_node_path((IsoNode *) sai->sparc_core_node);
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);
} }
} }
} }
@ -5543,12 +5424,8 @@ 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_blockpath(image, target, msg,
iso_impsysa_report_text(target, msg, gpt_entry->image_path, 0);
} else {
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) {
@ -5573,14 +5450,10 @@ 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_blockpath(image, target, msg,
iso_impsysa_report_text(target, msg, apm_entry->image_path, 0);
} else {
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;
@ -5736,13 +5609,9 @@ 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];
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);
}
if (lba_mem[i] != 0xffffffff) { if (lba_mem[i] != 0xffffffff) {
sprintf(msg, "El Torito img path : %3d ", i + 1);
iso_impsysa_report_blockpath(image, target, msg, lba_mem[i], 1);
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);
@ -5934,9 +5803,6 @@ ex:
return ret; return ret;
} }
/* @param flag bit0= Pre-run: Only assess partition tables. Do not refer to
loaded tree or El Torito boot equipment.
*/
static static
int iso_analyze_system_area(IsoImage *image, IsoDataSource *src, int iso_analyze_system_area(IsoImage *image, IsoDataSource *src,
struct iso_read_opts *opts, uint32_t image_size, struct iso_read_opts *opts, uint32_t image_size,
@ -5958,50 +5824,48 @@ int iso_analyze_system_area(IsoImage *image, IsoDataSource *src,
image->imported_sa_info->image_size = image_size; image->imported_sa_info->image_size = image_size;
image->imported_sa_info->pvd_block = opts->block + 16; image->imported_sa_info->pvd_block = opts->block + 16;
ret = iso_analyze_mbr(image, src, flag & 1); ret = iso_analyze_mbr(image, src, 0);
if (ret < 0) if (ret < 0)
goto ex; goto ex;
ret = iso_analyze_gpt(image, src, flag & 1); ret = iso_analyze_gpt(image, src, 0);
if (ret < 0) if (ret < 0)
goto ex; goto ex;
ret = iso_analyze_apm(image, src, flag & 1); ret = iso_analyze_apm(image, src, 0);
if (ret < 0) if (ret < 0)
goto ex; goto ex;
sao = image->imported_sa_info->system_area_options; sao = image->imported_sa_info->system_area_options;
sa_type = (sao >> 2) & 0x3f; sa_type = (sao >> 2) & 0x3f;
sa_sub = (sao >> 10) & 0xf; sa_sub = (sao >> 10) & 0xf;
if (sa_type == 0 && !((sao & 3) || sa_sub == 1 || sa_sub == 2)) { if (sa_type == 0 && !((sao & 3) || sa_sub == 1 || sa_sub == 2)) {
ret = iso_analyze_mips(image, src, flag & 1); ret = iso_analyze_mips(image, src, 0);
if (ret < 0) if (ret < 0)
goto ex; goto ex;
if (ret == 0) { if (ret == 0) {
ret = iso_analyze_mipsel(image, src, flag & 1); ret = iso_analyze_mipsel(image, src, 0);
if (ret < 0) if (ret < 0)
goto ex; goto ex;
} }
if (ret == 0) { if (ret == 0) {
ret = iso_analyze_sun(image, src, flag & 1); ret = iso_analyze_sun(image, src, 0);
if (ret < 0) if (ret < 0)
goto ex; goto ex;
} }
} }
if (sa_type == 0 && !((sao & 3) || sa_sub == 1)) { if (sa_type == 0 && !((sao & 3) || sa_sub == 1)) {
/* HP-PA PALO v5 can look like generic MBR */ /* HP-PA PALO v5 can look like generic MBR */
ret = iso_analyze_hppa(image, src, flag & 1); ret = iso_analyze_hppa(image, src, 0);
if (ret < 0) if (ret < 0)
goto ex; goto ex;
/* DEC Alpha has checksum bytes where MBR has its magic number */ /* DEC Alpha has checksum bytes where MBR has its magic number */
if (ret == 0) { if (ret == 0) {
ret = iso_analyze_alpha_boot(image, src, flag & 1); ret = iso_analyze_alpha_boot(image, src, 0);
if (ret < 0) if (ret < 0)
goto ex; goto ex;
} }
} }
if (!(flag & 1)) { ret = iso_record_meta_struct_blocks(image, src, 0);
ret = iso_record_meta_struct_blocks(image, src, 0); if (ret < 0)
if (ret < 0) goto ex;
goto ex;
}
ret = ISO_SUCCESS; ret = ISO_SUCCESS;
ex:; ex:;
@ -6513,7 +6377,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, *boot_image_node; IsoNode *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;
@ -6527,7 +6391,6 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
int features_allocated = 0; int features_allocated = 0;
static char *tree_loaded_names[3]= {"ISO9660", "Joliet", "ISO9660:1999"}; static char *tree_loaded_names[3]= {"ISO9660", "Joliet", "ISO9660:1999"};
int root_has_aaip = 0, rrip_version_1_10; int root_has_aaip = 0, rrip_version_1_10;
unsigned long img_size;
if (image == NULL || src == NULL || opts == NULL) { if (image == NULL || src == NULL || opts == NULL) {
return ISO_NULL_POINTER; return ISO_NULL_POINTER;
@ -6682,27 +6545,6 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
} }
} }
/* Pre-assessment of System Area because image->imported_sa_info with
assessed partitions is needed in create_boot_img_filesrc().
Nevertheless, some properties can only be determined later, when
other image properties have been assessed. So there will be another
run of iso_analyze_system_area() without flag bit0 when more of the
imported image is known.
*/
if (opts->load_system_area && image->system_area_data != NULL &&
!(opts->read_features & 4)) {
/* Preliminary assessment. Not complete because some aspects of the
filesystem have not been loaded yet.
*/
ret = iso_analyze_system_area(image, src, opts, data->nblocks, 1);
if (ret < 0) {
iso_msg_submit(-1, ISO_SYSAREA_PROBLEMS, 0,
"Problem encountered during inspection of System Area:");
iso_msg_submit(-1, ISO_SYSAREA_PROBLEMS, 0,
iso_error_to_msg(ret));
}
}
/* if old image has el-torito, add a new catalog */ /* if old image has el-torito, add a new catalog */
if (data->eltorito) { if (data->eltorito) {
@ -6722,7 +6564,6 @@ 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];
@ -6826,44 +6667,23 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
/* warn about hidden images */ /* warn about hidden images */
if (!(opts->read_features & 4)) { if (!(opts->read_features & 4)) {
img_size = iso_file_get_size((IsoFile *) node);
if (image->bootcat->bootimages[idx]->platform_id == 0xef) { if (image->bootcat->bootimages[idx]->platform_id == 0xef) {
iso_msg_submit(image->id, ISO_ELTO_EFI_HIDDEN, 0, iso_msg_submit(image->id, ISO_ELTO_EFI_HIDDEN, 0,
"Found hidden El-Torito image for EFI."); "Found hidden El-Torito image for EFI.");
iso_msg_submit(image->id, ISO_GENERAL_NOTE, 0, iso_msg_submit(image->id, ISO_GENERAL_NOTE, 0,
"EFI image start and load size: %lu * 2048 , %lu * 512", "EFI image start and size: %lu * 2048 , %lu * 512",
(unsigned long int) (unsigned long int)
image->bootcat->bootimages[idx]->appended_start, image->bootcat->bootimages[idx]->appended_start,
(unsigned long int) (unsigned long int)
image->bootcat->bootimages[idx]->load_size); image->bootcat->bootimages[idx]->load_size);
iso_msg_submit(image->id, ISO_GENERAL_NOTE, 0,
"Roughly estimated EFI image size: %lu bytes",
img_size);
} else { } else {
iso_msg_submit(image->id, ISO_EL_TORITO_HIDDEN, 0, iso_msg_submit(image->id, ISO_EL_TORITO_HIDDEN, 0,
"Found hidden El-Torito image for Non-EFI platform.", "Found hidden El-Torito image. Its size could not "
img_size); "be figured out, so image modify or boot image "
iso_msg_submit(image->id, ISO_EL_TORITO_HIDDEN, 0, "patching may lead to bad results.");
"Roughly estimated image size: %lu bytes",
img_size);
iso_msg_submit(image->id, ISO_EL_TORITO_HIDDEN, 0,
"Image modification or boot image patching may lead to bad results.");
} }
} }
} }
/* 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;
@ -7105,9 +6925,6 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
if (ret < 0) if (ret < 0)
goto import_revert; goto import_revert;
/* Second run of iso_analyze_system_area() after El Torito equipment and
file tree have been assessed
*/
if (opts->load_system_area && image->system_area_data != NULL && if (opts->load_system_area && image->system_area_data != NULL &&
!(opts->read_features & 4)) { !(opts->read_features & 4)) {
ret = iso_analyze_system_area(image, src, opts, data->nblocks, 0); ret = iso_analyze_system_area(image, src, opts, data->nblocks, 0);

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2007 Vreixo Formoso * Copyright (c) 2007 Vreixo Formoso
* Copyright (c) 2009 - 2024 Thomas Schmitt * Copyright (c) 2009 - 2022 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,7 +17,6 @@
#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>
@ -44,7 +43,6 @@ 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;
@ -73,27 +71,18 @@ 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);
@ -113,7 +102,6 @@ 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 - 2024 Thomas Schmitt * Copyright (c) 2009 - 2022 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,12 +418,6 @@ 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

@ -251,33 +251,14 @@ int create_tree(Ecma119Image *t, IsoNode *iso, Iso1999Node **tree, int pathlen)
} }
break; break;
case LIBISO_SYMLINK: case LIBISO_SYMLINK:
t->iso1999_symlinks++;
if (t->iso1999_symlinks == 1) {
char *ipath = iso_tree_get_node_path(iso);
ret = iso_msg_submit(t->image->id, ISO_FILE_IGNORED, 0,
"Cannot add symbolic link %s to ISO 9660:1999 tree. Skipping.",
ipath);
free(ipath);
} else {
if (t->iso1999_symlinks == 2)
iso_msg_submit(t->image->id, ISO_FILE_IGNORED, 0,
"More symbolic links were omitted from ISO 9660:1999 tree.");
ret = 0;
}
break;
case LIBISO_SPECIAL: case LIBISO_SPECIAL:
t->iso1999_specials++; {
if (t->iso1999_specials == 1) {
char *ipath = iso_tree_get_node_path(iso); char *ipath = iso_tree_get_node_path(iso);
ret = iso_msg_submit(t->image->id, ISO_FILE_IGNORED, 0, ret = iso_msg_submit(t->image->id, ISO_FILE_IGNORED, 0,
"Cannot add special file %s to ISO 9660:1999 tree. Skipping.", "Can't add %s to ISO 9660:1999 tree. This kind of files "
ipath); "can only be added to a Rock Ridget tree. Skipping.",
ipath);
free(ipath); free(ipath);
} else {
if (t->iso1999_specials == 2)
iso_msg_submit(t->image->id, ISO_FILE_IGNORED, 0,
"More special files were omitted from ISO 9660:1999 tree.");
ret = 0;
} }
break; break;
default: default:

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-2024 Thomas Schmitt * Copyright (c) 2009-2023 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
@ -14,8 +14,6 @@
/* Important: If you add a public API function then add its name to file /* Important: If you add a public API function then add its name to file
libisofs/libisofs.ver libisofs/libisofs.ver
in the node LIBISOFS6_Major.Minor.Micro with the numbers of
the next release version.
*/ */
#ifdef __cplusplus #ifdef __cplusplus
@ -96,7 +94,7 @@ extern "C" {
*/ */
#define iso_lib_header_version_major 1 #define iso_lib_header_version_major 1
#define iso_lib_header_version_minor 5 #define iso_lib_header_version_minor 5
#define iso_lib_header_version_micro 7 #define iso_lib_header_version_micro 6
/** /**
* Get version of the libisofs library at runtime. * Get version of the libisofs library at runtime.
@ -251,7 +249,7 @@ enum IsoNodeType {
#define ISO_NODE(n) ((IsoNode*)n) #define ISO_NODE(n) ((IsoNode*)n)
/** /**
* File section in an imported or emerging image. * File section in an old image.
* *
* @since 0.6.8 * @since 0.6.8
*/ */
@ -376,7 +374,7 @@ enum iso_replace_mode {
}; };
/** /**
* Options for image writing. * Options for image written.
* @see iso_write_opts_new() * @see iso_write_opts_new()
* @since 0.6.2 * @since 0.6.2
*/ */
@ -2198,10 +2196,7 @@ int iso_write_opts_set_fifo_size(IsoWriteOpts *opts, size_t fifo_size);
* @param opts * @param opts
* The option set to be manipulated. * The option set to be manipulated.
* @param data * @param data
* Either NULL or 32768 bytes of data. Do not submit less bytes ! * Either NULL or 32 kB of data. Do not submit less bytes !
* NULL means that the possibly imported System Area content of the
* possibly imported ISO image is to be re-used unchanged.
* Submit 32 KiB of 0-bytes to surely get an empty System Area written.
* @param options * @param options
* Can cause manipulations of submitted data before they get written: * Can cause manipulations of submitted data before they get written:
* bit0= Only with System area type 0 = MBR * bit0= Only with System area type 0 = MBR
@ -2297,7 +2292,7 @@ int iso_write_opts_set_fifo_size(IsoWriteOpts *opts, size_t fifo_size);
* written. * written.
* @param flag * @param flag
* bit0 = invalidate any attached system area data. Same as data == NULL * bit0 = invalidate any attached system area data. Same as data == NULL
* (This re-activates possibly loaded image System Area data. * (This re-activates eventually loaded image System Area data.
* To erase those, submit 32 kB of zeros without flag bit0.) * To erase those, submit 32 kB of zeros without flag bit0.)
* bit1 = keep data unaltered * bit1 = keep data unaltered
* bit2 = keep options unaltered * bit2 = keep options unaltered
@ -3826,13 +3821,9 @@ int iso_image_get_pvd_times(IsoImage *image,
* The absolute path of a IsoFile to be used as default boot image or * The absolute path of a IsoFile to be used as default boot image or
* --interval:appended_partition_$number[_start_$start_size_$size]:... * --interval:appended_partition_$number[_start_$start_size_$size]:...
* if type is ELTORITO_NO_EMUL. $number gives the partition number. * if type is ELTORITO_NO_EMUL. $number gives the partition number.
* If no partitition with the given $number was set by functions like * If _start_$start_size_$size is present, then it overrides the 2 KiB
* iso_write_opts_set_partition_img() and if the optional image_path part * start block of the partition and the partition size counted in
* "_start_$start_size_$size" is present, then $start gets read as 2 KiB * blocks of 512 bytes.
* start block of the interval and $size as number of blocks of 512 bytes.
* If this range of block addresses is below the address set by
* iso_write_opts_set_ms_block(), then that range gets marked as boot
* image. I.e. an old appended partition can be marked as boot image.
* @param type * @param type
* The boot media type. This can be one of 3 types: * The boot media type. This can be one of 3 types:
* - ELTORITO_FLOPPY_EMUL. * - ELTORITO_FLOPPY_EMUL.
@ -4468,8 +4459,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 began at the start block", \ " the path of a file in the ISO image which begins at the partition", \
" of partition X when the ISO filesystem was imported.", \ " start block of partition X.", \
" 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.", \
@ -4535,8 +4526,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 began at the start block", \ " the path of a file in the ISO image which begins at the partition", \
" of partition X when the ISO filesystem was imported.", \ " start block of partition X.", \
"" ""
#define ISO_SYSAREA_REPORT_DOC_APM \ #define ISO_SYSAREA_REPORT_DOC_APM \
\ \
@ -4556,8 +4547,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 began at the start block", \ " the path of a file in the ISO image which begins at the partition", \
" of partition X when the ISO filesystem was imported.", \ " start block of partition X.", \
"" ""
#define ISO_SYSAREA_REPORT_DOC_MIPS \ #define ISO_SYSAREA_REPORT_DOC_MIPS \
\ \
@ -4567,9 +4558,8 @@ 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 began", \ " tells the path to the boot image file in the ISO image which belongs", \
" at the block address given by boot entry X when the ISO filesystem", \ " to the block address given by boot entry X.", \
" 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", \
@ -4579,9 +4569,8 @@ 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 image file in the ISO image which began", \ " tells the path to the boot file in the ISO image which belongs to the", \
" at the block address given by SegmentStart when the ISO filesystem", \ " address given by SegmentStart.", \
" 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", \
@ -4605,8 +4594,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 began at the", \ " tells the path to the data file in the ISO image which belongs to the", \
" address given by core when the ISO filesystem was imported.", \ " address given by core.", \
"" ""
#define ISO_SYSAREA_REPORT_DOC_HPPA \ #define ISO_SYSAREA_REPORT_DOC_HPPA \
\ \
@ -4618,9 +4607,7 @@ 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 and byte count of the 32-bit kernel and the path", \ " tells start byte, byte count, and file path of the 32-bit kernel.", \
" 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", \
@ -4636,8 +4623,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 to a file in the ISO image which began at the", \ " tells the path of a file in the ISO image which starts at the loader", \
" loader start address when the ISO filesystem was imported." " start address."
/** /**
* Obtain an array of texts describing the detected properties of the * Obtain an array of texts describing the detected properties of the
@ -4705,13 +4692,12 @@ 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 began at the", \ " tells the path to the data file in the ISO image which belongs to", \
" block address where the boot catalog starts when the ISO filesystem", \ " the block address where the boot catalog starts.", \
" 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 began at the", \ " tells the path to the data file in the ISO image which belongs to", \
" LBA of boot image X when the ISO filesystem was imported.", \ " the block address given by LBA of boot image X.", \
" (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:", \
@ -8573,16 +8559,15 @@ 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 checksum tag and if so, obtain * Check a data block whether it is a libisofs session checksum tag and
* its recorded parameters. These tags get written after volume descriptors, * eventually obtain its recorded parameters. These tags get written after
* directory tree and checksum array and can be detected without loading the * volume descriptors, directory tree and checksum array and can be detected
* image tree. * without loading the 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 checksum tag on the fly. See doc/checksum.txt . * start and look out for a session 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
@ -8602,7 +8587,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 tag types 2, 3, 4. * next_tag is valid only if not 0 and only with return values 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

@ -15,7 +15,6 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h>
#include "rockridge.h" #include "rockridge.h"
#include "node.h" #include "node.h"

View File

@ -22,7 +22,6 @@
#include <string.h> #include <string.h>
#include <limits.h> #include <limits.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h>
#ifndef PATH_MAX #ifndef PATH_MAX

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2008 Vreixo Formoso * Copyright (c) 2008 Vreixo Formoso
* Copyright (c) 2010 - 2024 Thomas Schmitt * Copyright (c) 2010 - 2022 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
@ -1053,7 +1053,6 @@ 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;
@ -1100,7 +1099,6 @@ 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;
@ -1130,7 +1128,6 @@ 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;
@ -1738,13 +1735,11 @@ static int iso_write_gpt(Ecma119Image *t, uint32_t img_blocks, uint8_t *buf)
0x87, 0xc0, 0x68, 0xb6, 0xb7, 0x26, 0x99, 0xc7 0x87, 0xc0, 0x68, 0xb6, 0xb7, 0x26, 0x99, 0xc7
}; };
uint8_t *wpt;
uint32_t p_arr_crc = 0; uint32_t p_arr_crc = 0;
uint64_t start_lba, end_lba, goal, part_end, next_end, backup_end_lba; uint64_t start_lba, end_lba, goal, part_end, next_end, backup_end_lba;
uint64_t eff_gpt_flags; uint64_t eff_gpt_flags;
int ret, i, gap_counter = 0, up_to, slot, j, to_insert; int ret, i, gap_counter = 0, up_to;
struct iso_gpt_partition_request *req; struct iso_gpt_partition_request *req;
char msg[81];
uint8_t gpt_name[72]; uint8_t gpt_name[72];
static uint8_t zero_uuid[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; static uint8_t zero_uuid[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
static uint8_t *type_guid; static uint8_t *type_guid;
@ -1830,8 +1825,6 @@ static int iso_write_gpt(Ecma119Image *t, uint32_t img_blocks, uint8_t *buf)
return ISO_BOOT_TOO_MANY_GPT; return ISO_BOOT_TOO_MANY_GPT;
/* Write the GPT entries to buf */ /* Write the GPT entries to buf */
wpt= buf + 512 * t->gpt_part_start;
slot= 1;
for (i = 0; i < t->gpt_req_count; i++) { for (i = 0; i < t->gpt_req_count; i++) {
req = t->gpt_req[i]; req = t->gpt_req[i];
start_lba = req->start_block; start_lba = req->start_block;
@ -1842,38 +1835,11 @@ static int iso_write_gpt(Ecma119Image *t, uint32_t img_blocks, uint8_t *buf)
if (end_lba > backup_end_lba) if (end_lba > backup_end_lba)
end_lba = backup_end_lba; end_lba = backup_end_lba;
end_lba = end_lba - 1; end_lba = end_lba - 1;
if (req->desired_slot > 0) { iso_write_gpt_entry(t, buf + 512 * t->gpt_part_start + 128 * i,
to_insert= req->desired_slot - slot; req->type_guid, req->partition_guid,
if (to_insert > 0 &&
slot - 1 + to_insert + t->gpt_req_count - i <=
(int) t->gpt_max_entries) {
/* There is need and room to insert empty partition entries */
for (j = 0; j < to_insert; j++) {
memset(wpt, 0, 128);
wpt+= 128;
slot++;
}
if (!t->wthread_is_running) {
sprintf(msg,
"Inserted %d empty GPT slots before appended partition %d",
to_insert, req->desired_slot);
iso_msgs_submit(0, msg, 0, "DEBUG", 0);
}
} else if (slot != req->desired_slot) {
if (!t->wthread_is_running) {
sprintf(msg,
"Appended GPT partition becomes number %d instead of desired %d",
i + 1, req->desired_slot);
iso_msgs_submit(0, msg, 0, "NOTE", 0);
}
}
}
iso_write_gpt_entry(t, wpt, req->type_guid, req->partition_guid,
start_lba, end_lba, req->flags, req->name); start_lba, end_lba, req->flags, req->name);
wpt+= 128;
slot++;
} }
for (i= slot - 1; i < (int) t->gpt_max_entries; i++) for (; i < (int) t->gpt_max_entries; i++)
memset(buf + 512 * t->gpt_part_start + 128 * i, 0, 128); memset(buf + 512 * t->gpt_part_start + 128 * i, 0, 128);
p_arr_crc = iso_crc32_gpt((unsigned char *) buf + 512 * t->gpt_part_start, p_arr_crc = iso_crc32_gpt((unsigned char *) buf + 512 * t->gpt_part_start,
@ -2545,13 +2511,6 @@ 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;
@ -2571,13 +2530,6 @@ 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;
@ -2596,13 +2548,6 @@ 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;
@ -2774,7 +2719,6 @@ int assess_appended_gpt(Ecma119Image *t, int flag)
}; };
static uint8_t zero_uuid[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; static uint8_t zero_uuid[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int i, ret, do_apm = 0, do_gpt = 0, index, already_in_gpt = 0; int i, ret, do_apm = 0, do_gpt = 0, index, already_in_gpt = 0;
int first_partition, last_partition;
uint8_t gpt_name[72], *type_uuid; uint8_t gpt_name[72], *type_uuid;
char apm_type[33]; char apm_type[33];
@ -2794,8 +2738,7 @@ int assess_appended_gpt(Ecma119Image *t, int flag)
return 2; return 2;
/* Represent appended partitions */ /* Represent appended partitions */
iso_tell_max_part_range(t->opts, &first_partition, &last_partition, 0); for (i = 0; i <= 3; i++) {
for (i = first_partition - 1; i < last_partition; i++) {
if (t->opts->appended_partitions[i] == NULL) if (t->opts->appended_partitions[i] == NULL)
continue; continue;
if (do_apm) { if (do_apm) {
@ -2836,9 +2779,6 @@ int assess_appended_gpt(Ecma119Image *t, int flag)
(uint64_t) 0, gpt_name); (uint64_t) 0, gpt_name);
if (ret < 0) if (ret < 0)
return ret; return ret;
t->gpt_req[t->gpt_req_count - 1]->desired_slot = i + 1;
} else if(do_gpt) {
t->gpt_req[index]->desired_slot = i + 1;
} }
} }
return ISO_SUCCESS; return ISO_SUCCESS;

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2008 Vreixo Formoso * Copyright (c) 2008 Vreixo Formoso
* Copyright (c) 2012 - 2024 Thomas Schmitt * Copyright (c) 2012 - 2019 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
@ -104,12 +104,6 @@ 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[].
@ -168,13 +162,6 @@ 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[].
@ -264,21 +251,6 @@ struct iso_gpt_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;
/* Desired partition number in emerging GPT: first = 1, no desire = 0
GPT partitions get sorted by start LBA. Gaps of uncovered blocks get
filled. If the resulting sequence positions the partition at a lower
slot than desired, then empty slots get inserted to match the desire.
If the sequence positions the partition at a higher slot, then a mere
note is issued and the partition gets into the higher 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[].

View File

@ -1294,8 +1294,6 @@ ex:;
} }
/* Note: No reference is taken to the found node. /* Note: No reference is taken to the found node.
Warning: Do not submit next_above uninitialized.
Submit NULL if next_above is not of interest.
@param flag bit0= recursion @param flag bit0= recursion
*/ */
int iso_tree_get_node_of_block(IsoImage *image, IsoDir *dir, uint32_t block, int iso_tree_get_node_of_block(IsoImage *image, IsoDir *dir, uint32_t block,