From 943d196710cfab0e6ed5056ad651f3d8f55013b4 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 5 Oct 2008 07:55:20 +0000 Subject: [PATCH] -rom_toc_scan nonrom_off disables toc emulation on overwriteables --- libisoburn/trunk/libisoburn/burn_wrap.c | 47 ++++++++++++++------ libisoburn/trunk/libisoburn/libisoburn.h | 1 + libisoburn/trunk/xorriso/xorriso.1 | 11 +++-- libisoburn/trunk/xorriso/xorriso.c | 18 ++++++-- libisoburn/trunk/xorriso/xorriso_private.h | 2 + libisoburn/trunk/xorriso/xorriso_timestamp.h | 2 +- libisoburn/trunk/xorriso/xorrisoburn.c | 2 +- 7 files changed, 61 insertions(+), 22 deletions(-) diff --git a/libisoburn/trunk/libisoburn/burn_wrap.c b/libisoburn/trunk/libisoburn/burn_wrap.c index f7804f8f..b583be00 100644 --- a/libisoburn/trunk/libisoburn/burn_wrap.c +++ b/libisoburn/trunk/libisoburn/burn_wrap.c @@ -58,7 +58,7 @@ extern void *libisoburn_default_msgs_submit_handle; extern int libisoburn_default_msgs_submit_flag; -int isoburn_emulate_toc(struct burn_drive *d, int flag); +static int isoburn_emulate_toc(struct burn_drive *d, int flag); int isoburn_initialize(char msg[1024], int flag) @@ -263,6 +263,7 @@ int isoburn_is_intermediate_dvd_rw(struct burn_drive *d, int flag) @param flag bit0= pretent blank on overwriteable media bit3= if the drive reports a -ROM profile then try to read table of content by scanning for ISO image headers. + bit4= do not emulate TOC on overwriteable media */ static int isoburn_welcome_media(struct isoburn **o, struct burn_drive *d, int flag) @@ -312,11 +313,13 @@ static int isoburn_welcome_media(struct isoburn **o, struct burn_drive *d, (*o)->emulation_mode= -1; goto ex; } - /* try to read emulated toc */ - ret= isoburn_emulate_toc(d, 0); - if(ret<0) { - (*o)->emulation_mode= -1; - goto ex; + if(!(flag & 16)) { + /* try to read emulated toc */ + ret= isoburn_emulate_toc(d, 0); + if(ret<0) { + (*o)->emulation_mode= -1; + goto ex; + } } } @@ -326,9 +329,13 @@ static int isoburn_welcome_media(struct isoburn **o, struct burn_drive *d, if(readonly) { /* This might be overwriteable media in a -ROM drive */ - ret= isoburn_emulate_toc(d, 1); - if(ret<0) - goto ex; + if((flag & 16)) { + ret= 0; + } else { + ret= isoburn_emulate_toc(d, 1); + if(ret<0) + goto ex; + } if(ret==0 && profile !=0x08 && (flag&8)) { /* This might also be multi-session media which do not get shown with a decent TOC. @@ -373,24 +380,38 @@ ex: table of content by scanning for ISO image headers. (depending on media type and drive state this might help or it might make the resulting toc even worse) + bit4= do not emulate TOC on overwriteable media */ int isoburn_drive_aquire(struct burn_drive_info *drive_infos[], char *adr, int flag) { - int ret, conv_ret, drive_grabbed= 0; - char libburn_drive_adr[BURN_DRIVE_ADR_LEN]; + int ret, drive_grabbed= 0; struct isoburn *o= NULL; +#ifndef NIX + +/* <<< should be obsolete by new drive addressing of libburn-0.5.2 */ +/* >>> but helps with kernel 2.4 to use /dev/sr */ + + int conv_ret; + char libburn_drive_adr[BURN_DRIVE_ADR_LEN]; + conv_ret= burn_drive_convert_fs_adr(adr, libburn_drive_adr); if(conv_ret<=0) strcpy(libburn_drive_adr, adr); - ret= burn_drive_scan_and_grab(drive_infos, libburn_drive_adr, flag&1); + +#else + + ret= burn_drive_scan_and_grab(drive_infos, adr, flag & 1); + +#endif /* ! NIX */ + if(ret<=0) goto ex; drive_grabbed= 1; ret= isoburn_welcome_media(&o, (*drive_infos)[0].drive, - (flag&8) | !!(flag&2)); + (flag & 24) | !!(flag&2)); if(ret<=0) goto ex; diff --git a/libisoburn/trunk/libisoburn/libisoburn.h b/libisoburn/trunk/libisoburn/libisoburn.h index 04d1e922..7e3b8165 100644 --- a/libisoburn/trunk/libisoburn/libisoburn.h +++ b/libisoburn/trunk/libisoburn/libisoburn.h @@ -364,6 +364,7 @@ int isoburn_drive_scan_and_grab(struct burn_drive_info *drive_infos[], table of content by scanning for ISO image headers. (depending on media type and drive this might help or it might make the resulting toc even worse) + bit4= do not emulate table of content on overwriteable media @return 1 = success , 0 = drive not found , <0 = other error */ int isoburn_drive_aquire(struct burn_drive_info *drive_infos[], diff --git a/libisoburn/trunk/xorriso/xorriso.1 b/libisoburn/trunk/xorriso/xorriso.1 index 8611efa4..513f7ca4 100644 --- a/libisoburn/trunk/xorriso/xorriso.1 +++ b/libisoburn/trunk/xorriso/xorriso.1 @@ -2,7 +2,7 @@ .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) -.TH XORRISO 1 "Oct 02, 2008" +.TH XORRISO 1 "Oct 06, 2008" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -532,7 +532,7 @@ until the next -dev or -indev. After the image has been loaded once, the setting is valid for -rollback until next -dev or -indev, where it will be reset to "auto". .TP -\fB\-rom_toc_scan\fR "on"|"off" +\fB\-rom_toc_scan\fR "on"|"off"|"nonrom_on"|"nonrom_off" Read-only drives do not tell the actual media type but show any media as ROM (e.g. as DVD-ROM). The session history of MMC multi-session media might be truncated to first and last session or even be completely false. @@ -543,8 +543,13 @@ especially the address of the last session, there is a scan for ISO 9660 filesystem headers which might help but also might yield worse results than the drive's table of content. At its end it can cause read attempts to invalid addresses and thus ugly drive behavior. +Setting "on" enables that scan for alleged read-only media. .br -To be in effect, -rom_toc_scan has to be enabled by "on" before the -*dev +On the other hand the emulation of session history on overwriteable media +can hamper reading of partly damaged media. Setting "nonrom_off" disables +the elsewise trustworthy table-of-content scan for those media. +.br +To be in effect, -rom_toc_scan settings have to be made before the -*dev command which aquires drive and media. .TP \fB\-ban_stdio_write\fR diff --git a/libisoburn/trunk/xorriso/xorriso.c b/libisoburn/trunk/xorriso/xorriso.c index 90d9c87a..c518bd0e 100644 --- a/libisoburn/trunk/xorriso/xorriso.c +++ b/libisoburn/trunk/xorriso/xorriso.c @@ -5286,6 +5286,11 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag) xorriso->toc_emulation_flag&1 ? "on" : "off"); if(!(is_default && no_defaults)) Xorriso_status_result(xorriso,filter,fp,flag&2); + is_default= !(xorriso->toc_emulation_flag&2); + sprintf(line,"-rom_toc_scan %s\n", + xorriso->toc_emulation_flag&2 ? "nonrom_off" : "nonrom_on"); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); adr_mode= xorriso->image_start_mode & 0xffff; if(adr_mode>=0 && adr_mode<=max_load_mode) { @@ -11649,8 +11654,9 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag) " -load \"session\"|\"track\"|\"lba\"|\"sbsector\"|\"volid\"|\"auto\" id", " Load a particular (outdated) ISO image from a -dev or", " -indev which hosts more than one session.", -" -rom_toc_scan \"on\"|\"off\"", -" Enable scanning for ISO sessions on read-only drives/media.", +" -rom_toc_scan \"on\"|\"off\"|\"nonrom_on\"|\"nonrom_off\"", +" Enable scanning for ISO sessions on read-only drives/media", +" resp. on overwriteable media.", " -ban_stdio_write", " Allow for writing only the usage of optical drives.", " -blank \"fast\"|\"all\"|\"deformat\"|\"deformat_quickest\"", @@ -13501,9 +13507,13 @@ int Xorriso_option_rollback(struct XorrisO *xorriso, int flag) int Xorriso_option_rom_toc_scan(struct XorrisO *xorriso, char *mode, int flag) { if(strcmp(mode, "off")==0) - xorriso->toc_emulation_flag= 0; + xorriso->toc_emulation_flag&= ~1; else if(strcmp(mode, "on")==0) - xorriso->toc_emulation_flag= 1; + xorriso->toc_emulation_flag|= 1; + else if(strcmp(mode, "nonrom_off")==0) + xorriso->toc_emulation_flag|= 2; + else if(strcmp(mode, "nonrom_on")==0) + xorriso->toc_emulation_flag&= ~2; else { sprintf(xorriso->info_text, "-rom_toc_scan: unknown mode '%s'", mode); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); diff --git a/libisoburn/trunk/xorriso/xorriso_private.h b/libisoburn/trunk/xorriso/xorriso_private.h index 299a2ba8..42dfebeb 100644 --- a/libisoburn/trunk/xorriso/xorriso_private.h +++ b/libisoburn/trunk/xorriso/xorriso_private.h @@ -134,6 +134,8 @@ struct XorrisO { /* the global context of xorriso */ int toc_emulation_flag; /* bit0= bit3 for isoburn_drive_aquire() scan -ROM profiles for ISO sessions + bit1= bit4 for isoburn_drive_aquire() + do not emulate TOC on overwriteable media */ int image_start_mode; /* From what address to load the ISO image diff --git a/libisoburn/trunk/xorriso/xorriso_timestamp.h b/libisoburn/trunk/xorriso/xorriso_timestamp.h index 8c3c5860..8a66778d 100644 --- a/libisoburn/trunk/xorriso/xorriso_timestamp.h +++ b/libisoburn/trunk/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2008.10.02.110828" +#define Xorriso_timestamP "2008.10.05.075432" diff --git a/libisoburn/trunk/xorriso/xorrisoburn.c b/libisoburn/trunk/xorriso/xorrisoburn.c index 08b59867..92c295b4 100644 --- a/libisoburn/trunk/xorriso/xorrisoburn.c +++ b/libisoburn/trunk/xorriso/xorrisoburn.c @@ -485,7 +485,7 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag) if(dinfo==NULL) { isoburn_set_msgs_submit(Xorriso_msgs_submit_void, (void *) xorriso, (3<<2) | 128 , 0); - aquire_flag= 1 | ((flag&(8|4))>>1) | ((xorriso->toc_emulation_flag&1)<<3); + aquire_flag= 1 | ((flag&(8|4))>>1) | ((xorriso->toc_emulation_flag & 3)<<3); ret= isoburn_drive_aquire(&dinfo, libburn_adr, aquire_flag); Xorriso_process_msg_queues(xorriso,0); if(ret<=0) {