Augmented structs isoburn, isoburn_toc_entry, isoburn_imgen_opts for long block addresses
This commit is contained in:
parent
280c78a2a6
commit
c1e563341d
@ -6,7 +6,7 @@
|
||||
*/
|
||||
/* libburn wrappers for libisoburn
|
||||
|
||||
Copyright 2007 - 2017 Thomas Schmitt, <scdbackup@gmx.net>
|
||||
Copyright 2007 - 2024 Thomas Schmitt, <scdbackup@gmx.net>
|
||||
Provided under GPL version 2 or later.
|
||||
*/
|
||||
|
||||
@ -786,7 +786,7 @@ off_t isoburn_disc_available_space(struct burn_drive *d,
|
||||
return((off_t) 0);
|
||||
local_opts= burn_write_opts_new(d);
|
||||
eff_opts= local_opts;
|
||||
burn_write_opts_set_start_byte(eff_opts, ((off_t) o->nwa) * (off_t) 2048);
|
||||
burn_write_opts_set_start_byte(eff_opts, o->nwa * (off_t) 2048);
|
||||
}
|
||||
avail= burn_disc_available_space(d, eff_opts);
|
||||
if(local_opts!=NULL)
|
||||
@ -1251,7 +1251,7 @@ int isoburn_report_iso_error(int iso_error_code, char msg_text[], int os_errno,
|
||||
@return 1 seems to be a valid ISO image , 0 format not recognized, <0 error
|
||||
*/
|
||||
int isoburn_read_iso_head_parse(unsigned char *data,
|
||||
int *image_blocks, char *info, int flag)
|
||||
off_t *image_blocks, char *info, int flag)
|
||||
{
|
||||
int i, info_mode;
|
||||
|
||||
@ -1300,8 +1300,8 @@ int isoburn_read_iso_head_parse(unsigned char *data,
|
||||
@return 1 seems to be a valid ISO image , 2 found in first half buffer,
|
||||
0 format not recognized, <0 error
|
||||
*/
|
||||
int isoburn_read_iso_head(struct burn_drive *d, int lba,
|
||||
int *image_blocks, char *info, int flag)
|
||||
int isoburn_read_iso_head_v2(struct burn_drive *d, off_t lba,
|
||||
off_t *image_blocks, char *info, int flag)
|
||||
{
|
||||
unsigned char *buffer= NULL;
|
||||
int ret, info_mode, capacity, role;
|
||||
@ -1368,6 +1368,25 @@ ex:;
|
||||
}
|
||||
|
||||
|
||||
int isoburn_read_iso_head(struct burn_drive *d, int lba,
|
||||
int *image_blocks, char *info, int flag)
|
||||
{
|
||||
int ret;
|
||||
off_t long_lba, long_image_blocks;
|
||||
|
||||
long_lba= lba;
|
||||
ret= isoburn_read_iso_head_v2(d, long_lba, &long_image_blocks, info, flag);
|
||||
if(ret <= 0)
|
||||
return(ret);
|
||||
if(long_image_blocks > 0x7fffffff) {
|
||||
*image_blocks= 0x7fffffff;
|
||||
return(0);
|
||||
}
|
||||
*image_blocks= long_image_blocks;
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
int isoburn_make_toc_entry(struct isoburn *o, int *session_count, int lba,
|
||||
int track_blocks, char *volid, int flag)
|
||||
{
|
||||
@ -1901,19 +1920,40 @@ void isoburn_toc_disc_free(struct isoburn_toc_disc *d)
|
||||
}
|
||||
|
||||
|
||||
int isoburn_get_track_lba(struct isoburn_toc_track *track, int *lba, int flag)
|
||||
int isoburn_get_track_lba_v2(struct isoburn_toc_track *track, off_t *lba,
|
||||
int flag)
|
||||
{
|
||||
struct burn_toc_entry entry;
|
||||
|
||||
isoburn_toc_track_get_entry(track, &entry);
|
||||
if (entry.extensions_valid & 1)
|
||||
if (entry.extensions_valid & 8) {
|
||||
*lba= entry.long_start_lba;
|
||||
} else if (entry.extensions_valid & 1) {
|
||||
*lba= entry.start_lba;
|
||||
else
|
||||
} else {
|
||||
*lba= burn_msf_to_lba(entry.pmin, entry.psec, entry.pframe);
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
int isoburn_get_track_lba(struct isoburn_toc_track *track, int *lba, int flag)
|
||||
{
|
||||
off_t long_lba;
|
||||
int ret;
|
||||
|
||||
ret= isoburn_get_track_lba_v2(track, &long_lba, flag);
|
||||
if(ret <= 0)
|
||||
return(ret);
|
||||
if(long_lba > 0x7fffffff) {
|
||||
*lba= 0x7fffffff;
|
||||
return(0);
|
||||
}
|
||||
*lba= long_lba;
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
int isoburn_drive_set_msgs_submit(struct burn_drive *d,
|
||||
int (*msgs_submit)(void *handle, int error_code,
|
||||
char msg_text[], int os_errno,
|
||||
@ -1953,6 +1993,7 @@ int isoburn_set_msc1(struct burn_drive *d, int adr_mode, char *adr_value,
|
||||
regex_t re;
|
||||
regmatch_t match[1];
|
||||
enum burn_disc_status s;
|
||||
off_t long_size;
|
||||
|
||||
ret= isoburn_find_emulator(&o, d, 0);
|
||||
if(ret<0)
|
||||
@ -1987,7 +2028,7 @@ not_found:;
|
||||
&num_tracks);
|
||||
if(tracks==NULL || num_tracks<=0)
|
||||
goto not_found;
|
||||
isoburn_get_track_lba(tracks[0], &(o->fabricated_msc1), 0);
|
||||
isoburn_get_track_lba_v2(tracks[0], &(o->fabricated_msc1), 0);
|
||||
|
||||
} else if(adr_mode==1) {
|
||||
/* Use adr_num as session index (first session is 1, not 0) */
|
||||
@ -1996,7 +2037,7 @@ not_found:;
|
||||
tracks= isoburn_toc_session_get_tracks(sessions[adr_num-1], &num_tracks);
|
||||
if(tracks==NULL || num_tracks<=0)
|
||||
goto not_found;
|
||||
isoburn_get_track_lba(tracks[0], &(o->fabricated_msc1), 0);
|
||||
isoburn_get_track_lba_v2(tracks[0], &(o->fabricated_msc1), 0);
|
||||
|
||||
} else if(adr_mode==2) {
|
||||
/* use adr_num as track index */
|
||||
@ -2008,7 +2049,7 @@ not_found:;
|
||||
for(j= 0; j<num_tracks; j++) {
|
||||
total_tracks++;
|
||||
if(total_tracks==adr_num) {
|
||||
isoburn_get_track_lba(tracks[j], &(o->fabricated_msc1), 0);
|
||||
isoburn_get_track_lba_v2(tracks[j], &(o->fabricated_msc1), 0);
|
||||
ret= 1; goto ex;
|
||||
}
|
||||
}
|
||||
@ -2027,7 +2068,9 @@ not_found:;
|
||||
}
|
||||
if((flag & 1) && o->fabricated_msc1 >= 16) {
|
||||
/* adr_num is possibly 16 blocks too high */
|
||||
ret= isoburn_read_iso_head(d, o->fabricated_msc1, &size,volid, 1|(1<<14));
|
||||
ret= isoburn_read_iso_head_v2(d, o->fabricated_msc1, &long_size, volid,
|
||||
1 | (1 << 14));
|
||||
size= long_size;
|
||||
if(ret==2)
|
||||
o->fabricated_msc1-= 16;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
Class struct of libisoburn.
|
||||
|
||||
Copyright 2007 - 2009 Vreixo Formoso Lopes <metalpain2002@yahoo.es>
|
||||
Copyright 2007 - 2023 Thomas Schmitt <scdbackup@gmx.net>
|
||||
Copyright 2007 - 2024 Thomas Schmitt <scdbackup@gmx.net>
|
||||
|
||||
Provided under GPL version 2 or later.
|
||||
*/
|
||||
@ -27,8 +27,8 @@
|
||||
struct isoburn_toc_entry {
|
||||
int session;
|
||||
int track_no; /* point */
|
||||
int start_lba;
|
||||
int track_blocks;
|
||||
off_t start_lba;
|
||||
off_t track_blocks;
|
||||
char *volid; /* For caching a volume id from emulated toc on overwritables */
|
||||
|
||||
struct isoburn_toc_entry *next;
|
||||
@ -82,26 +82,26 @@ struct isoburn {
|
||||
|
||||
/* If >= 0, this address is used as reply for isoburn_disc_get_msc1()
|
||||
*/
|
||||
int fabricated_msc1;
|
||||
off_t fabricated_msc1;
|
||||
|
||||
/* If >= 0, this address is used in isoburn_disc_track_lba_nwa()
|
||||
as reply parameter nwa.
|
||||
(The other nwa parameters below apply only to the effective write address
|
||||
on random access media. msc2 is handed to libisofs but not to libburn.)
|
||||
*/
|
||||
int fabricated_msc2;
|
||||
off_t fabricated_msc2;
|
||||
|
||||
|
||||
/* The nwa to be used for a first session on the present kind of overwritable
|
||||
media (usually Libisoburn_overwriteable_starT, but might be forced to 0)
|
||||
*/
|
||||
int zero_nwa;
|
||||
off_t zero_nwa;
|
||||
|
||||
/* Start address as given by image examination (bytes, not blocks) */
|
||||
off_t min_start_byte;
|
||||
|
||||
/* Aligned start address to be used for processing (counted in blocks) */
|
||||
int nwa;
|
||||
off_t nwa;
|
||||
|
||||
|
||||
/* Truncate to .nwa an eventual regular file serving as output drive */
|
||||
@ -142,7 +142,7 @@ struct isoburn {
|
||||
IsoImage *image;
|
||||
|
||||
/* The start LBA of the image */
|
||||
int image_start_lba;
|
||||
off_t image_start_lba;
|
||||
|
||||
/* The block data source from which the existing image is read.
|
||||
*/
|
||||
@ -629,14 +629,14 @@ struct isoburn_imgen_opts {
|
||||
If <0 : Invalid
|
||||
If >=0: Valid block number. Block size is always 2 KiB.
|
||||
*/
|
||||
int effective_lba;
|
||||
off_t effective_lba;
|
||||
|
||||
/** Output value: Block address of data section start as predicted by
|
||||
libisofs.
|
||||
If < 16: Invalid
|
||||
If >=16: Valid block number. Block size is always 2 KiB.
|
||||
*/
|
||||
int data_start_lba;
|
||||
off_t data_start_lba;
|
||||
|
||||
/**
|
||||
* If not empty: Parameters "name" and "timestamp" for a scdbackup stream
|
||||
|
@ -7,7 +7,7 @@
|
||||
libisofs related functions of libisoburn.
|
||||
|
||||
Copyright 2007 - 2009 Vreixo Formoso Lopes <metalpain2002@yahoo.es>
|
||||
Copyright 2007 - 2020 Thomas Schmitt <scdbackup@gmx.net>
|
||||
Copyright 2007 - 2024 Thomas Schmitt <scdbackup@gmx.net>
|
||||
Provided under GPL version 2 or later.
|
||||
*/
|
||||
|
||||
@ -796,7 +796,8 @@ ex:;
|
||||
*/
|
||||
int isoburn_start_emulation(struct isoburn *o, int flag)
|
||||
{
|
||||
int ret, i, capacity = -1, role, dummy;
|
||||
int ret, i, role;
|
||||
off_t capacity = -1, dummy;
|
||||
off_t data_count, to_read;
|
||||
struct burn_drive *drive;
|
||||
struct ecma119_pri_vol_desc *pvm;
|
||||
@ -824,13 +825,13 @@ int isoburn_start_emulation(struct isoburn *o, int flag)
|
||||
The data there point to the most recent session.
|
||||
*/
|
||||
role = burn_drive_get_drive_role(drive);
|
||||
ret = burn_get_read_capacity(drive, &capacity, 0);
|
||||
ret = burn_get_read_capacity_v2(drive, &capacity, 0);
|
||||
if (ret <= 0)
|
||||
capacity = -1;
|
||||
if (role == 5) { /* random access write-only medium */
|
||||
s = burn_disc_get_status(drive);
|
||||
o->fabricated_disc_status= s;
|
||||
burn_disc_track_lba_nwa(drive, NULL, 0, &dummy, &(o->nwa));
|
||||
burn_disc_track_lba_nwa_v2(drive, NULL, 0, &dummy, &(o->nwa));
|
||||
if(o->nwa < o->zero_nwa)
|
||||
o->zero_nwa= 0;
|
||||
{ret= 1; goto ex;}
|
||||
@ -839,8 +840,8 @@ int isoburn_start_emulation(struct isoburn *o, int flag)
|
||||
size. Try to read anyway. */
|
||||
to_read = o->target_iso_head_size;
|
||||
memset(o->target_iso_head, 0, to_read);
|
||||
if(capacity > 0 && (off_t) capacity * (off_t) 2048 < to_read)
|
||||
to_read = (off_t) capacity * (off_t) 2048;
|
||||
if(capacity > 0 && capacity * (off_t) 2048 < to_read)
|
||||
to_read = capacity * (off_t) 2048;
|
||||
ret = burn_read_data(drive, (off_t) 0, (char*)o->target_iso_head,
|
||||
to_read, &data_count, 32 | 8);
|
||||
if (ret <= 0) {
|
||||
|
@ -1 +1 @@
|
||||
#define Xorriso_timestamP "2024.03.09.170230"
|
||||
#define Xorriso_timestamP "2024.03.09.180620"
|
||||
|
Loading…
Reference in New Issue
Block a user