From f860e24e58aca2cb0eabbc4e29c93129e0165b9a Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Fri, 22 Apr 2011 08:18:41 +0000 Subject: [PATCH] Avoiding repeated PVD read attempts if first reading of PVD yielded error --- libisoburn/burn_wrap.c | 5 +++++ libisoburn/isoburn.c | 1 + libisoburn/isoburn.h | 4 ++++ libisoburn/isofs_wrap.c | 6 +++++- xorriso/xorriso_timestamp.h | 2 +- 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/libisoburn/burn_wrap.c b/libisoburn/burn_wrap.c index 6e3143f9..27357eb1 100644 --- a/libisoburn/burn_wrap.c +++ b/libisoburn/burn_wrap.c @@ -1191,6 +1191,7 @@ int isoburn_read_iso_head(struct burn_drive *d, int lba, int ret, info_mode, capacity, role; off_t data_count, to_read; enum burn_disc_status s; + struct isoburn *o; info_mode= flag&255; *image_blocks= 0; @@ -1214,6 +1215,10 @@ int isoburn_read_iso_head(struct burn_drive *d, int lba, } to_read= (off_t) capacity * ((off_t) 2048); if(ret > 0 && to_read >= (off_t) (36 * 1024)) { + ret= isoburn_find_emulator(&o, d, 0); + if(ret > 0) + if(o->media_read_error) + return(-1 * !!(flag & (1 << 15))); if(to_read >= (off_t) (64 * 1024)) to_read= 64 * 1024; ret = burn_read_data(d, ((off_t) lba) * (off_t) 2048, (char *) buffer, diff --git a/libisoburn/isoburn.c b/libisoburn/isoburn.c index 273b354b..c1c9940c 100644 --- a/libisoburn/isoburn.c +++ b/libisoburn/isoburn.c @@ -135,6 +135,7 @@ int isoburn_new(struct isoburn **objpt, int flag) o->truncate= 0; o->iso_source= NULL; o->fabricated_disc_status= BURN_DISC_UNREADY; + o->media_read_error= 0; o->toc= NULL; o->wrote_well= -1; o->loaded_partition_offset= 0; diff --git a/libisoburn/isoburn.h b/libisoburn/isoburn.h index be0e548e..eca7da45 100644 --- a/libisoburn/isoburn.h +++ b/libisoburn/isoburn.h @@ -113,6 +113,10 @@ struct isoburn { */ enum burn_disc_status fabricated_disc_status; + /* To be set if read errors occured during media evaluation. + */ + int media_read_error; + /* Eventual emulated table of content read from the chain of ISO headers on overwriteable media. */ diff --git a/libisoburn/isofs_wrap.c b/libisoburn/isofs_wrap.c index 61b6fe28..ccb2707f 100644 --- a/libisoburn/isofs_wrap.c +++ b/libisoburn/isofs_wrap.c @@ -482,10 +482,14 @@ int isoburn_start_emulation(struct isoburn *o, int flag) 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; + ret = burn_read_data(drive, (off_t) 0, (char*)o->target_iso_head, - to_read, &data_count, 2 | 8); + to_read, &data_count, 4 | 8); + /* <<< was 2 | 8); */ + if (ret <= 0) { /* an error means a disc with no ISO image */ + o->media_read_error= 1; if (ret == -2) { path[0]= 0; burn_drive_d_get_adr(drive, path); diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index cd1cb2cf..f6b57a24 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2011.04.14.081721" +#define Xorriso_timestamP "2011.04.22.081847"