Made Xorriso_sanitize_image_size() ready for long block adresses

This commit is contained in:
Thomas Schmitt 2024-03-21 20:42:23 +01:00
parent 2d3302db51
commit fb780b59cb
3 changed files with 11 additions and 12 deletions

View File

@ -198,19 +198,18 @@ int Xorriso_make_write_options(
bit1= do not use isoburn wrappers, do not assume libisofs bit1= do not use isoburn wrappers, do not assume libisofs
bit2= no_emul_toc : do not pad random access media to full 64 KB bit2= no_emul_toc : do not pad random access media to full 64 KB
*/ */
int Xorriso_sanitize_image_size(struct XorrisO *xorriso, off_t Xorriso_sanitize_image_size(struct XorrisO *xorriso,
struct burn_drive *drive, struct burn_disc *disc, struct burn_drive *drive, struct burn_disc *disc,
struct burn_write_opts *burn_options, int flag) struct burn_write_opts *burn_options, int flag)
{ {
int ret, img_sectors, num_sessions= 0, num_tracks= 0, padding= 0, profile; int num_sessions= 0, num_tracks= 0, padding= 0, profile;
off_t media_space; off_t media_space, ret, img_sectors, lba, nwa, multi_emul_blocks= 0;
int lba, nwa, multi_emul_blocks= 0;
char profile_name[80]; char profile_name[80];
struct burn_session **sessions; struct burn_session **sessions;
struct burn_track **tracks; struct burn_track **tracks;
enum burn_disc_status s; enum burn_disc_status s;
img_sectors= burn_disc_get_sectors(disc); img_sectors= burn_disc_get_sectors_v2(disc);
sessions= burn_disc_get_sessions(disc, &num_sessions); sessions= burn_disc_get_sessions(disc, &num_sessions);
if(sessions==NULL || num_sessions < 1) { if(sessions==NULL || num_sessions < 1) {
@ -250,7 +249,7 @@ no_track:;
s= isoburn_disc_get_status(drive); s= isoburn_disc_get_status(drive);
if(s == BURN_DISC_BLANK) { if(s == BURN_DISC_BLANK) {
/* Count blocks before nwa as part of the image */; /* Count blocks before nwa as part of the image */;
ret= isoburn_disc_track_lba_nwa(drive, burn_options, 0, &lba, &nwa); ret= isoburn_disc_track_lba_nwa_v2(drive, burn_options, 0, &lba, &nwa);
if(ret <= 0) if(ret <= 0)
nwa= 0; nwa= 0;
multi_emul_blocks= nwa; multi_emul_blocks= nwa;
@ -272,7 +271,7 @@ no_track:;
if(xorriso->alignment > 0) { if(xorriso->alignment > 0) {
if(img_sectors > 0) { if(img_sectors > 0) {
ret= isoburn_disc_track_lba_nwa(drive, burn_options, 0, &lba, &nwa); ret= isoburn_disc_track_lba_nwa_v2(drive, burn_options, 0, &lba, &nwa);
if(ret <= 0) if(ret <= 0)
nwa= 0; nwa= 0;
lba= (nwa + img_sectors + padding) % xorriso->alignment; lba= (nwa + img_sectors + padding) % xorriso->alignment;
@ -293,8 +292,8 @@ no_track:;
if(media_space < img_sectors + padding) { if(media_space < img_sectors + padding) {
Xorriso_process_msg_queues(xorriso,0); Xorriso_process_msg_queues(xorriso,0);
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"Image size %ds exceeds free space on media %.fs", "Image size %.fs exceeds free space on media %.fs",
img_sectors + padding, (double) media_space); (double) (img_sectors + padding), (double) media_space);
if(flag & 1) { if(flag & 1) {
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
} else { } else {

View File

@ -1,7 +1,7 @@
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
Copyright 2007-2022 Thomas Schmitt, <scdbackup@gmx.net> Copyright 2007-2024 Thomas Schmitt, <scdbackup@gmx.net>
Provided under GPL version 2 or later. Provided under GPL version 2 or later.
@ -31,7 +31,7 @@ int Xorriso_make_write_options(
struct XorrisO *xorriso, struct burn_drive *drive, struct XorrisO *xorriso, struct burn_drive *drive,
struct burn_write_opts **burn_options, int flag); struct burn_write_opts **burn_options, int flag);
int Xorriso_sanitize_image_size(struct XorrisO *xorriso, off_t Xorriso_sanitize_image_size(struct XorrisO *xorriso,
struct burn_drive *drive, struct burn_disc *disc, struct burn_drive *drive, struct burn_disc *disc,
struct burn_write_opts *burn_options, int flag); struct burn_write_opts *burn_options, int flag);

View File

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