Made Xorriso__file_start_lba() ready for long block adresses

This commit is contained in:
Thomas Schmitt 2024-03-21 19:28:34 +01:00
parent 698bee2621
commit 2d3302db51
9 changed files with 32 additions and 23 deletions

View File

@ -125,6 +125,7 @@ int Xorriso_create_empty_iso(struct XorrisO *xorriso, int flag)
int Xorriso_record_boot_info(struct XorrisO *xorriso, int flag)
{
int ret;
off_t start_lba;
struct burn_drive_info *dinfo;
struct burn_drive *drive;
IsoImage *image;
@ -146,9 +147,13 @@ int Xorriso_record_boot_info(struct XorrisO *xorriso, int flag)
iso_image_unref(image); /* release obtained reference */
if(ret != 1)
return(0);
if(bootimg_node != NULL)
Xorriso__file_start_lba((IsoNode *) bootimg_node,
&(xorriso->loaded_boot_bin_lba), 0);
if(bootimg_node != NULL) {
Xorriso__file_start_lba((IsoNode *) bootimg_node, &start_lba, 0);
if(start_lba <= (off_t) 0x7fffffff)
xorriso->loaded_boot_bin_lba= start_lba;
else
xorriso->loaded_boot_bin_lba= 0;
}
if(bootcat_node != NULL)
Xorriso_path_from_lba(xorriso, (IsoNode *) bootcat_node, (off_t) 0,
xorriso->loaded_boot_cat_path, 0);

View File

@ -3055,8 +3055,9 @@ return:
3 = immediate decision : does match
*/
{
int value=0, ret, start_lba, bless_idx, size_mode, lba_count, i, mask;
int value=0, ret, bless_idx, size_mode, lba_count, i, mask;
off_t range_lba, end_lba, *file_end_lbas= NULL, *file_start_lbas= NULL;
off_t start_lba;
void *arg1, *arg2;
char ft, *decision, md5[16], bless_code[17];
regmatch_t name_match;

View File

@ -1,7 +1,7 @@
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
Copyright 2007-2010 Thomas Schmitt, <scdbackup@gmx.net>
Copyright 2007-2024 Thomas Schmitt, <scdbackup@gmx.net>
Provided under GPL version 2 or later.
@ -65,8 +65,6 @@ int Xorriso_findi_sorted(struct XorrisO *xorriso, struct FindjoB *job,
int Xorriso_all_node_array(struct XorrisO *xorriso, int addon_nodes, int flag);
int Xorriso__file_start_lba(IsoNode *node, int *lba, int flag);
int Xorriso__mark_update_xinfo(void *data, int flag);
int Xorriso__mark_update_cloner(void *old_data, void **new_data, int flag);

View File

@ -1309,7 +1309,8 @@ ex:
int Xorriso_stream_type(struct XorrisO *xorriso, IsoNode *node,
IsoStream *stream, char type_text[], int flag)
{
int ret, lba, stream_type, block_size_log2;
int ret, stream_type, block_size_log2;
off_t lba;
uint8_t zisofs_algo[2], algo_num;
char text[5];
@ -2281,8 +2282,7 @@ ex:;
}
int Xorriso__file_start_lba(IsoNode *node,
int *lba, int flag)
int Xorriso__file_start_lba(IsoNode *node, off_t *lba, int flag)
{
int lba_count= 0, i, ret;
off_t size, *section_sizes= NULL, *start_lbas= NULL, *end_lbas= NULL;
@ -2774,7 +2774,8 @@ int Xorriso_getfname(struct XorrisO *xorriso, char *path, int flag)
int Xorriso_is_plain_image_file(struct XorrisO *xorriso, void *in_node,
char *path, int flag)
{
int ret, lba;
int ret;
off_t lba;
IsoStream *stream;
IsoNode *node;

View File

@ -77,8 +77,7 @@ int Xorriso__start_end_lbas(IsoNode *node, int *lba_count,
off_t **start_lbas, off_t **end_lbas,
off_t **section_sizes, off_t *size, int flag);
int Xorriso__file_start_lba(IsoNode *node,
int *lba, int flag);
int Xorriso__file_start_lba(IsoNode *node, off_t *lba, int flag);
int Xorriso_file_eval_damage(struct XorrisO *xorriso, IsoNode *node,
off_t *damage_start, off_t *damage_end,

View File

@ -200,7 +200,7 @@ int Xorriso_restore_is_identical(struct XorrisO *xorriso, void *in_node,
IsoImage *volume;
IsoNode *node;
struct stat stbuf;
int dummy;
off_t dummy;
memset(type_text, 0, 5);
if(!Xorriso_change_is_pending(xorriso, 0))

View File

@ -1,7 +1,7 @@
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
Copyright 2007-2016 Thomas Schmitt, <scdbackup@gmx.net>
Copyright 2007-2024 Thomas Schmitt, <scdbackup@gmx.net>
Provided under GPL version 2 or later.
@ -308,7 +308,7 @@ int Xorriso_search_di_range(struct XorrisO *xorriso, IsoNode *node,
int Xorriso__node_lba_cmp(const void *node1, const void *node2)
{
int ret;
int lba1= 0, lba2= 0;
off_t lba1= 0, lba2= 0;
ret= Xorriso__file_start_lba(*((IsoNode **) node1), &lba1, 0);
if(ret!=1)
@ -316,7 +316,11 @@ int Xorriso__node_lba_cmp(const void *node1, const void *node2)
ret= Xorriso__file_start_lba(*((IsoNode **) node2), &lba2, 0);
if(ret!=1)
lba2= 0;
return(lba1-lba2);
if(lba1 > lba2)
return(1);
if(lba1 < lba2)
return(-1);
return(0);
}

View File

@ -402,8 +402,9 @@ int Xorriso_set_system_area(struct XorrisO *xorriso,
struct isoburn_imgen_opts *sopts,
int flag)
{
int ret, options, system_area_options, iso_lba= -1, start_lba, image_blocks;
int ret, options, system_area_options, start_lba, image_blocks;
int sa_loaded, read_count, i, read_sum= 0;
off_t iso_lba= -1;
char volid[33];
FILE *fp= NULL;
char *buf= NULL, *bufpt= NULL, *intvl;
@ -478,13 +479,13 @@ int Xorriso_set_system_area(struct XorrisO *xorriso,
if(ret > 0)
iso_lba= start_lba + image_blocks;
}
if(((off_t) iso_lba) * (off_t) 4 > hd_lba) {
if(iso_lba * (off_t) 4 > hd_lba) {
system_area_options= 0;
} else if((xorriso->patch_system_area & 1) &&
((off_t) iso_lba) * (off_t) 4 != hd_lba) {
iso_lba * (off_t) 4 != hd_lba) {
system_area_options= 0;
} else if((xorriso->patch_system_area & 2) &&
((off_t) iso_lba) * (off_t) 4 + (off_t) (63 * 256) < hd_lba) {
iso_lba * (off_t) 4 + (off_t) (63 * 256) < hd_lba) {
system_area_options= 0;
} else if(xorriso->patch_system_area & 2) { /* isohybrid patching */
/* Check whether bytes 432-345 point to ElTorito LBA */
@ -495,7 +496,7 @@ int Xorriso_set_system_area(struct XorrisO *xorriso,
system_area_options= 0;
} else if(bootimg_node != NULL) {
Xorriso__file_start_lba((IsoNode *) bootimg_node, &(iso_lba), 0);
if(((off_t) iso_lba) * (off_t) 4 != hd_lba)
if(iso_lba * (off_t) 4 != hd_lba)
system_area_options= 0;
}
}

View File

@ -1 +1 @@
#define Xorriso_timestamP "2024.03.21.165234"
#define Xorriso_timestamP "2024.03.21.182815"