Corrected strange behavior with non-ISO images on overwriteable media

This commit is contained in:
Thomas Schmitt 2008-05-13 13:52:33 +00:00
parent 6bc2d3e0a3
commit 5f5b0c7016
7 changed files with 38 additions and 18 deletions

View File

@ -485,6 +485,8 @@ void isoburn_disc_erase(struct burn_drive *drive, int fast)
{
int ret;
struct isoburn *o;
enum burn_disc_status s;
char zero_buffer[Libisoburn_target_head_sizE];
ret= isoburn_find_emulator(&o, drive, 0);
if(ret>0) {
@ -494,9 +496,16 @@ void isoburn_disc_erase(struct burn_drive *drive, int fast)
return;
}
if(o->emulation_mode>0) {
s= isoburn_disc_get_status(drive);
if(s==BURN_DISC_FULL) { /* unknown data format in first 64 kB */
memset(zero_buffer, 0, Libisoburn_target_head_sizE);
ret= burn_random_access_write(drive, (off_t) 0, zero_buffer,
(off_t) Libisoburn_target_head_sizE, 1);
} else {
ret= isoburn_invalidate_iso(o, 0);
}
if(ret<=0)
burn_drive_cancel(drive);
burn_drive_cancel(drive); /* mark run as failure */
return;
}
}
@ -510,12 +519,16 @@ off_t isoburn_disc_available_space(struct burn_drive *d,
int ret;
struct isoburn *o;
struct burn_write_opts *eff_opts= NULL, *local_opts= NULL;
enum burn_disc_status s;
off_t avail;
eff_opts= opts;
ret= isoburn_find_emulator(&o, d, 0);
if(ret>0 && o!=NULL)
if(o->emulation_mode!=0) {
s= isoburn_disc_get_status(d);
if(s==BURN_DISC_FULL) /* unknown data format in first 64 kB */
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);

View File

@ -121,7 +121,7 @@ int isoburn_new(struct isoburn **objpt, int flag)
o->fabricated_disc_status= BURN_DISC_UNREADY;
o->toc= NULL;
o->wrote_well= -1;
for(i=0;i<65536;i++)
for(i=0;i<Libisoburn_target_head_sizE;i++)
o->target_iso_head[i]= 0;
o->image= NULL;
o->read_pacifier= NULL;

View File

@ -33,6 +33,11 @@ int isoburn_toc_entry_new(struct isoburn_toc_entry **objpt,
int isoburn_toc_entry_destroy(struct isoburn_toc_entry **o, int flag);
/* Size of target_iso_head which is to be written during
isoburn_activate_session()
*/
#define Libisoburn_target_head_sizE (32*2048)
struct isoburn {
@ -89,7 +94,7 @@ struct isoburn {
/* Buffered ISO head from media (should that become part of
ecma119_read_opts ?) */
uint8_t target_iso_head[65536];
uint8_t target_iso_head[Libisoburn_target_head_sizE];
/* Libisofs image context */
IsoImage *image;
@ -368,12 +373,7 @@ struct isoburn_imgen_opts {
#define Libisoburn_toc_scan_max_gaP 8192
/* Size of target_iso_head which is to be written during
isoburn_activate_session()
*/
#define Libisoburn_target_head_sizE (32*2048)
/* >>> Experiment to create a chain of image headers which form a TOC:
/* Creating a chain of image headers which form a TOC:
The header of the first session is written after the LBA 0 header.
So it persists and can give the end of its session. By help of

View File

@ -283,7 +283,7 @@ int isoburn_activate_session(struct burn_drive *drive)
o->zero_nwa > 0)))
return 1;
ret = burn_random_access_write(drive, 0, (char*)o->target_iso_head,
ret = burn_random_access_write(drive, (off_t) 0, (char*)o->target_iso_head,
Libisoburn_target_head_sizE, 1);
return ret;
@ -315,7 +315,7 @@ int isoburn_start_emulation(struct isoburn *o, int flag)
/* we can assume 0 as start block for image */
/* TODO what about ms? where we validate valid iso image in ms disc? */
ret = burn_read_data(drive, (off_t) 0, (char*)o->target_iso_head,
sizeof(o->target_iso_head), &data_count, 2);
(off_t) Libisoburn_target_head_sizE, &data_count, 2);
/* an error means an empty disc */
if (ret <= 0) {
@ -325,7 +325,7 @@ int isoburn_start_emulation(struct isoburn *o, int flag)
/* check first 64K. If 0's, the disc is treated as a blank disc, and thus
overwritten without extra check. */
i = sizeof(o->target_iso_head);
i = Libisoburn_target_head_sizE;
while (i && !o->target_iso_head[i-1])
--i;

View File

@ -184,7 +184,8 @@ Closed is the state of DVD-ROM media and of multi-session media which were
written with option -close on. If the drive is incapable of writing it will
probably show any media as closed CD-ROM resp. DVD-ROM.
.br
Overwriteable media assume this state only in such read-only drives.
Overwriteable media assume this state in such read-only drives or if they
contain unrecognizable data in the first 32 data blocks.
.br
\fBRead-only\fR drives may or may not show session histories of multi-session
media. Often only the first and the last session are visible. Sometimes

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.05.13.115901"
#define Xorriso_timestamP "2008.05.13.135251"

View File

@ -928,7 +928,7 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
"-indev differs from -outdev and -outdev media is not blank");
else
sprintf(xorriso->info_text,
"-indev differs from -outdev and -outdev media holds valid ISO image");
"-indev differs from -outdev and -outdev media holds non-zero data");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
{ret= 0; goto ex;}
}
@ -2260,7 +2260,7 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
int num_sessions= 0, num_tracks= 0, lba= 0, nwa= -1, pmin, psec, pframe, ret;
int track_count= 0, session_no, track_no, profile_no= -1, track_size;
int last_track_start= 0, last_track_size= -1, num_data= 0, is_data= 0;
int is_inout_drive= 0, drive_role;
int is_inout_drive= 0, drive_role, status, num_formats;
int num_payload= 0, num_wasted= 0, num_nondata= 0;
char profile_name[80],*respt,*devadr;
struct burn_toc_entry toc_entry;
@ -2268,7 +2268,8 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
struct burn_drive *drive;
enum burn_disc_status s;
char mem_text[80];
off_t start_byte= 0, num_free= 0;
off_t start_byte= 0, num_free= 0, size;
unsigned dummy;
#ifdef Xorriso_use_isoburn_toC
struct isoburn_toc_disc *disc= NULL;
@ -2385,6 +2386,11 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
sprintf(respt, "ISO session : %3d , %9d , %9ds , %s\n",
1, 0, image_blocks, volume_id);
} else {
nwa= 0;
ret= burn_disc_get_formats(drive, &status, &size, &dummy,
&num_formats);
if(ret>0 && status==BURN_FORMAT_IS_FORMATTED)
nwa= size/2048;
sprintf(respt, "Other session: %3d , %9d , %9ds , \n",
1, 0, nwa);
}