"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xorriso/iso_img.c" between
libisoburn-1.5.0.tar.gz and libisoburn-1.5.2.tar.gz

About: libisoburn is a frontend for the libraries libburn and libisofs which enables creation and expansion of ISO-9660 filesystems on all media and file types supported by libburn. It implements the API and command interpreter of program xorriso, and installs this program as small dynamically linked binary. xorriso is suitable for incremental data backup and for production of bootable ISO 9660 images. A statically linked version is available as GNU xorriso.

iso_img.c  (libisoburn-1.5.0):iso_img.c  (libisoburn-1.5.2)
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
Copyright 2007-2016 Thomas Schmitt, <scdbackup@gmx.net> Copyright 2007-2019 Thomas Schmitt, <scdbackup@gmx.net>
Provided under GPL version 2 or later. Provided under GPL version 2 or later.
This file contains functions which operate on ISO images and their This file contains functions which operate on ISO images and their
global properties. global properties.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "../config.h" #include "../config.h"
#endif #endif
skipping to change at line 614 skipping to change at line 614
return(0); return(0);
} }
/* /*
bit0= do only report non-default settings bit0= do only report non-default settings
bit1= do only report to fp bit1= do only report to fp
*/ */
int Xorriso_append_part_status(struct XorrisO *xorriso, IsoImage *image, int Xorriso_append_part_status(struct XorrisO *xorriso, IsoImage *image,
char *filter, FILE *fp, int flag) char *filter, FILE *fp, int flag)
{ {
int i, is_default; int i, l, is_default;
is_default= (xorriso->appended_as_gpt == 0); is_default= (xorriso->appended_as_gpt == 0);
sprintf(xorriso->result_line, "-boot_image any appended_part_as=%s\n", sprintf(xorriso->result_line, "-boot_image any appended_part_as=%s\n",
xorriso->appended_as_gpt ? "gpt" : "mbr"); xorriso->appended_as_gpt ? "gpt" : "mbr");
if(!(is_default && (flag & 1))) if(!(is_default && (flag & 1)))
Xorriso_status_result(xorriso, filter, fp, flag & 2); Xorriso_status_result(xorriso, filter, fp, flag & 2);
for(i= 0; i < Xorriso_max_appended_partitionS; i++) { for(i= 0; i < Xorriso_max_appended_partitionS; i++) {
if(xorriso->appended_partitions[i] == NULL) if(xorriso->appended_partitions[i] == NULL)
continue; continue;
sprintf(xorriso->result_line, "-append_partition %d 0x%2.2x ", sprintf(xorriso->result_line, "-append_partition %d ", i + 1);
i + 1, (unsigned int) xorriso->appended_part_types[i]); l= strlen(xorriso->result_line);
if(xorriso->appended_part_gpt_flags[i] & 1) {
Xorriso__format_guid(xorriso->appended_part_type_guids[i],
xorriso->result_line + l, 0);
strcpy(xorriso->result_line + l + 32, " ");
} else {
sprintf(xorriso->result_line + l, "0x%2.2x ",
(unsigned int) xorriso->appended_part_types[i]);
}
Text_shellsafe(xorriso->appended_partitions[i], xorriso->result_line, 1); Text_shellsafe(xorriso->appended_partitions[i], xorriso->result_line, 1);
strcat(xorriso->result_line, "\n"); strcat(xorriso->result_line, "\n");
Xorriso_status_result(xorriso, filter, fp, flag & 2); Xorriso_status_result(xorriso, filter, fp, flag & 2);
} }
return(1); return(1);
} }
/* /*
bit0= do only report non-default settings bit0= do only report non-default settings
bit1= do only report to fp bit1= do only report to fp
skipping to change at line 1620 skipping to change at line 1628
int efi_boot_part= 0, full_sparc_part= 0, have_sparc_part= 0, fe_dummy= 1; int efi_boot_part= 0, full_sparc_part= 0, have_sparc_part= 0, fe_dummy= 1;
int appended_as_gpt= 0, have_prep= 0, did_sysarea= 0, cared_for_apm= 0; int appended_as_gpt= 0, have_prep= 0, did_sysarea= 0, cared_for_apm= 0;
int cared_for_sparc= 0, have_hfsplus= 0; int cared_for_sparc= 0, have_hfsplus= 0;
int have_sysarea= 0, ptable_killer, imported_iso, have_alpha_ldr_path= 0; int have_sysarea= 0, ptable_killer, imported_iso, have_alpha_ldr_path= 0;
int have_protective_msdos= 0, part_like_isohybrid= 0; int have_protective_msdos= 0, part_like_isohybrid= 0;
#ifdef Not_any_more_because_padding_is_now_after_partitions #ifdef Not_any_more_because_padding_is_now_after_partitions
int appended_partition= 0; int appended_partition= 0;
#endif #endif
int iso_mbr_part_type= -1; int iso_mbr_part_type= -1, iso_gpt_part_idx= -1;
unsigned int prev_pltf= 0; unsigned int prev_pltf= 0;
unsigned long int sa_options= 0, partno, id_tag, perms, start_cyl, num_blocks; unsigned long int sa_options= 0, partno, id_tag, perms, start_cyl, num_blocks;
unsigned long int part_status, part_type, start_block, partition_offset= 0; unsigned long int part_status, part_type, start_block, partition_offset= 0;
uint32_t high_block= 0; uint32_t high_block= 0;
char name[24], *textpt, *contentpt, *buf= NULL; char name[24], *textpt, *contentpt, *buf= NULL, part_type_text[37];
char **lines= NULL; char **lines= NULL;
double num[8]; double num[8];
char *cat_path= ""; char *cat_path= "";
struct elto_img_par *et_imgs= NULL; struct elto_img_par *et_imgs= NULL;
int elto_count= 0; int elto_count= 0;
uint32_t img_blocks= 0, mbr_parts_end= 0, iso_part_blocks; uint32_t img_blocks= 0, mbr_parts_end= 0, iso_part_blocks;
struct FindjoB *job= NULL; struct FindjoB *job= NULL;
struct stat dir_stbuf; struct stat dir_stbuf;
IsoImage *image; IsoImage *image;
char *volid, *crt, *mdt, *ext, *eft, uuid[17], *uuid_time; char *volid, *crt, *mdt, *ext, *eft, uuid[17], *uuid_time;
skipping to change at line 1653 skipping to change at line 1661
uint64_t start_block; uint64_t start_block;
uint64_t block_count; uint64_t block_count;
int appended; int appended;
int has_path; int has_path;
}; };
struct mbr_par *mbrpts= NULL; struct mbr_par *mbrpts= NULL;
int mbr_count= 0; int mbr_count= 0;
struct gpt_par { struct gpt_par {
int ptype; /* 0= unknown, 1= gpt-basdat, 2=gpt-hfsplus, 3=EFI */ int ptype; /* 0= unknown, 1= gpt-basdat, 2=gpt-hfsplus, 3=EFI */
uint8_t type_guid[16];
int is_gap; int is_gap;
int has_path; int has_path;
char *path; char *path;
uint64_t start_block; uint64_t start_block;
uint64_t block_count; uint64_t block_count;
}; };
struct gpt_par *gpts= NULL; struct gpt_par *gpts= NULL;
int gpt_count= 0; int gpt_count= 0;
struct apm_par { struct apm_par {
skipping to change at line 1908 skipping to change at line 1917
} else if(strcmp(name, "GPT type GUID :") == 0) { } else if(strcmp(name, "GPT type GUID :") == 0) {
idx= num[0] - 1; idx= num[0] - 1;
if(strcmp(textpt, "a2a0d0ebe5b9334487c068b6b72699c7") == 0) if(strcmp(textpt, "a2a0d0ebe5b9334487c068b6b72699c7") == 0)
gpts[idx].ptype= 1; /* Basic data */ gpts[idx].ptype= 1; /* Basic data */
else if(strcmp(textpt, "005346480000aa11aa1100306543ecac") == 0) else if(strcmp(textpt, "005346480000aa11aa1100306543ecac") == 0)
gpts[idx].ptype= 2; /* HFS+ */ gpts[idx].ptype= 2; /* HFS+ */
else if(strcmp(textpt, "28732ac11ff8d211ba4b00a0c93ec93b") == 0) else if(strcmp(textpt, "28732ac11ff8d211ba4b00a0c93ec93b") == 0)
gpts[idx].ptype= 3; /* EFI System Partition */ gpts[idx].ptype= 3; /* EFI System Partition */
else else
gpts[idx].ptype= 0; gpts[idx].ptype= 0;
Xorriso_parse_guid(xorriso, textpt, gpts[idx].type_guid, 1);
} else if(strcmp(name, "GPT start and size :") == 0) { } else if(strcmp(name, "GPT start and size :") == 0) {
idx= num[0] - 1; idx= num[0] - 1;
if(num[2] > 0) if(num[2] > 0)
appended_as_gpt= 1; appended_as_gpt= 1;
gpts[idx].start_block= num[1]; start_block= gpts[idx].start_block= num[1];
gpts[idx].block_count= num[2]; num_blocks= gpts[idx].block_count= num[2];
if(start_block == partition_offset * 4 &&
(start_block + num_blocks) >= high_block * 4 &&
iso_gpt_part_idx < 0)
iso_gpt_part_idx= idx;
} else if(strcmp(name, "GPT partition path :") == 0) { } else if(strcmp(name, "GPT partition path :") == 0) {
idx= num[0] - 1; idx= num[0] - 1;
gpts[idx].has_path= 1; gpts[idx].has_path= 1;
gpts[idx].path= textpt; gpts[idx].path= textpt;
} else if(strcmp(name, "GPT partition name :") == 0) { } else if(strcmp(name, "GPT partition name :") == 0) {
idx= num[0] - 1; idx= num[0] - 1;
if(strstr(contentpt, " 470061007000") != NULL) /* "Gap"... */ if(strstr(contentpt, " 470061007000") != NULL) /* "Gap"... */
gpts[idx].is_gap= 1; gpts[idx].is_gap= 1;
skipping to change at line 2176 skipping to change at line 2190
"GPT partition %d has same start block as MBR partition %d but different block count (%.f <> %.f)", "GPT partition %d has same start block as MBR partition %d but different block count (%.f <> %.f)",
idx + 1, mbr_idx + 1, num[2], idx + 1, mbr_idx + 1, num[2],
(double) mbrpts[mbr_idx].block_count); (double) mbrpts[mbr_idx].block_count);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING",
0); 0);
} }
break; break;
} }
} }
if(mbr_idx >= mbr_count) { if(mbr_idx >= mbr_count) {
if(appended_as_gpt == 1) if(appended_as_gpt == 1) {
appended_as_gpt= 2; appended_as_gpt= 2;
sprintf(buf, "-append_partition %d 0x%lx ", idx + 1, part_type); Xorriso__format_guid(gpts[idx].type_guid, part_type_text, 0);
} else {
sprintf(part_type_text, "0x%lx", part_type);
}
sprintf(buf, "-append_partition %d %s ", idx + 1, part_type_text);
Xorriso_add_intvl_adr(xorriso, buf, (uint64_t) num[1], Xorriso_add_intvl_adr(xorriso, buf, (uint64_t) num[1],
(uint64_t) (num[1] + num[2] - 1.0), "d", (uint64_t) (num[1] + num[2] - 1.0), "d",
imported_iso); imported_iso);
Xorriso_record_cmd_linE Xorriso_record_cmd_linE
buf[0]= 0; buf[0]= 0;
#ifdef Not_any_more_because_padding_is_now_after_partitions #ifdef Not_any_more_because_padding_is_now_after_partitions
appended_partition= 1; appended_partition= 1;
#endif #endif
skipping to change at line 2450 skipping to change at line 2468
did_sysarea= 1; did_sysarea= 1;
} }
if(iso_mbr_part_type >= 0) { if(iso_mbr_part_type >= 0) {
if(mkisofs) if(mkisofs)
sprintf(buf, "-iso_mbr_part_type 0x%2.2x", sprintf(buf, "-iso_mbr_part_type 0x%2.2x",
(unsigned int) iso_mbr_part_type); (unsigned int) iso_mbr_part_type);
else else
sprintf(buf, "-boot_image any iso_mbr_part_type=0x%2.2x", sprintf(buf, "-boot_image any iso_mbr_part_type=0x%2.2x",
(unsigned int) iso_mbr_part_type); (unsigned int) iso_mbr_part_type);
Xorriso_record_cmd_linE Xorriso_record_cmd_linE
} else if(iso_gpt_part_idx >= 0) {
if(mkisofs)
sprintf(buf, "-iso_mbr_part_type ");
else
sprintf(buf, "-boot_image any iso_mbr_part_type=");
Xorriso__format_guid(gpts[iso_gpt_part_idx].type_guid, buf + strlen(buf),
0);
Xorriso_record_cmd_linE
} }
/* Issue commands related to El Torito */ /* Issue commands related to El Torito */
if(elto_count <= 0) if(elto_count <= 0)
goto after_el_torito; goto after_el_torito;
if(efi_boot_part) { if(efi_boot_part == 1) {
if(mkisofs) if(mkisofs)
sprintf(buf, "-efi-boot-part --efi-boot-image"); sprintf(buf, "-efi-boot-part --efi-boot-image");
else else
sprintf(buf, "-boot_image any efi_boot_part=--efi-boot-image"); sprintf(buf, "-boot_image any efi_boot_part=--efi-boot-image");
Xorriso_record_cmd_linE Xorriso_record_cmd_linE
} }
if(cat_path[0]) { if(cat_path[0]) {
if(mkisofs) if(mkisofs)
sprintf(buf, "-c "); sprintf(buf, "-c ");
else else
skipping to change at line 2531 skipping to change at line 2559
buf[0]= 0; buf[0]= 0;
} }
} }
sprintf(app_pseudo_paths[idx], sprintf(app_pseudo_paths[idx],
"--interval:appended_partition_%d_start_%lus_size_%lud:all::", "--interval:appended_partition_%d_start_%lus_size_%lud:all::",
i + 1, i + 1,
(unsigned long) et_imgs[idx].lba, (unsigned long) et_imgs[idx].lba,
(unsigned long) mbrpts[i].block_count); (unsigned long) mbrpts[i].block_count);
et_imgs[idx].path= app_pseudo_paths[idx]; et_imgs[idx].path= app_pseudo_paths[idx];
} }
if (et_imgs[idx].path[0] == 0) { if (et_imgs[idx].path[0] == 0 && efi_boot_part != 2) {
for(i= 0; i < gpt_count; i++) { for(i= 0; i < gpt_count; i++) {
if(have_protective_msdos && ( if(have_protective_msdos && (
gpts[i].start_block == ((uint64_t) et_imgs[idx].lba) * 4 && gpts[i].start_block == ((uint64_t) et_imgs[idx].lba) * 4 &&
(gpts[i].block_count == (uint64_t) et_imgs[idx].ldsiz || (gpts[i].block_count == (uint64_t) et_imgs[idx].ldsiz ||
et_imgs[idx].ldsiz == 0 || et_imgs[idx].ldsiz == 1))) et_imgs[idx].ldsiz == 0 || et_imgs[idx].ldsiz == 1)))
break; break;
} }
if (i < gpt_count) { if (i < gpt_count) {
sprintf(app_pseudo_paths[idx], sprintf(app_pseudo_paths[idx],
"--interval:appended_partition_%d_start_%lus_size_%lud:all::", "--interval:appended_partition_%d_start_%lus_size_%lud:all::",
 End of changes. 13 change blocks. 
12 lines changed or deleted 40 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)