Avoided release-grab cycles between tasks of a cdrskin run

This commit is contained in:
Thomas Schmitt 2011-10-11 16:39:57 +00:00
parent b5f4bd36d6
commit ea5e2f7598
2 changed files with 23 additions and 27 deletions

View File

@ -3740,6 +3740,8 @@ ex:;
bit2= do not issue error message on failure bit2= do not issue error message on failure
bit3= demand and evtl. report media, return 0 if none to see bit3= demand and evtl. report media, return 0 if none to see
bit4= grab drive with unsuitable media even if fallback program bit4= grab drive with unsuitable media even if fallback program
bit5= do not re-assess the drive if it is already grabbed
but rather perform a release-and-grab cycle
@return <=0 error, 1 success @return <=0 error, 1 success
*/ */
int Cdrskin_grab_drive(struct CdrskiN *skin, int flag) int Cdrskin_grab_drive(struct CdrskiN *skin, int flag)
@ -3749,21 +3751,29 @@ int Cdrskin_grab_drive(struct CdrskiN *skin, int flag)
char profile_name[80]; char profile_name[80];
enum burn_disc_status s; enum burn_disc_status s;
i= 0;/* as long as its use is conditional, so gcc -Wall does not complain */ if(skin->drive_is_grabbed && (flag & 32))
if(skin->drive_is_grabbed)
Cdrskin_release_drive(skin,0); Cdrskin_release_drive(skin,0);
if(flag&1) { if(!skin->drive_is_grabbed) {
skin->driveno= 0; if(flag&1) {
drive= NULL; skin->driveno= 0;
skin->grabbed_drive= drive; drive= NULL;
} else { skin->grabbed_drive= drive;
drive= skin->drives[skin->driveno].drive; } else {
skin->grabbed_drive= drive; drive= skin->drives[skin->driveno].drive;
skin->grabbed_drive= drive;
}
} }
if(skin->drive_is_grabbed) {
if(flag&1) { drive= skin->grabbed_drive;
ret= burn_drive_re_assess(skin->grabbed_drive, 0);
if(ret <=0 ) {
if(!(flag&4))
fprintf(stderr,"cdrskin: FATAL : unable to re-assess drive '%s'\n",
skin->preskin->device_adr);
goto ex;
}
} else if(flag&1) {
ret= burn_drive_scan_and_grab(&(skin->drives),skin->preskin->device_adr, ret= burn_drive_scan_and_grab(&(skin->drives),skin->preskin->device_adr,
!(flag&2)); !(flag&2));
if(ret<=0) { if(ret<=0) {
@ -5126,12 +5136,6 @@ ex:;
free(book_type); free(book_type);
if(product_id != NULL) if(product_id != NULL)
free(product_id); free(product_id);
Cdrskin_release_drive(skin,0);
/* A61227 :
A kindof race condition with -atip on filled CD-RW and following grabs
under SuSE 9.3. Waiting seems to help. I suspect the media demon. */
usleep(200000);
return(ret); return(ret);
} }
@ -5203,7 +5207,6 @@ int Cdrskin_list_formats(struct CdrskiN *skin, int flag)
} }
ret= 1; ret= 1;
ex:; ex:;
Cdrskin_release_drive(skin,0);
return(ret); return(ret);
} }
@ -5467,7 +5470,6 @@ pseudo_blank_ov:;
(s!=BURN_DISC_APPENDABLE || skin->no_blank_appendable) && (s!=BURN_DISC_APPENDABLE || skin->no_blank_appendable) &&
(profile_number!=0x13 || !skin->prodvd_cli_compatible) && (profile_number!=0x13 || !skin->prodvd_cli_compatible) &&
(s!=BURN_DISC_BLANK || !skin->force_is_set)) { (s!=BURN_DISC_BLANK || !skin->force_is_set)) {
Cdrskin_release_drive(skin,0);
if(s==BURN_DISC_BLANK) { if(s==BURN_DISC_BLANK) {
fprintf(stderr, fprintf(stderr,
"cdrskin: NOTE : blank=... : media was already blank (and still is)\n"); "cdrskin: NOTE : blank=... : media was already blank (and still is)\n");
@ -5569,8 +5571,6 @@ blanking_done:;
ret= !!(wrote_well); ret= !!(wrote_well);
ex:; ex:;
skin->drive_is_busy= 0; skin->drive_is_busy= 0;
if(skin->drive_is_grabbed)
Cdrskin_release_drive(skin,0);
if(Cdrskin__is_aborting(0)) if(Cdrskin__is_aborting(0))
Cdrskin_abort(skin, 0); /* Never comes back */ Cdrskin_abort(skin, 0); /* Never comes back */
return(ret); return(ret);
@ -6165,8 +6165,6 @@ int Cdrskin_direct_write(struct CdrskiN *skin, int flag)
ex:; ex:;
if(caps!=NULL) if(caps!=NULL)
burn_disc_free_multi_caps(&caps); burn_disc_free_multi_caps(&caps);
if(skin->drive_is_grabbed)
Cdrskin_release_drive(skin,0);
if(buf!=NULL) if(buf!=NULL)
free(buf); free(buf);
if(ret>0) if(ret>0)
@ -6723,7 +6721,6 @@ ex:;
skin->drive_is_busy= 0; skin->drive_is_busy= 0;
if(skin->verbosity>=Cdrskin_verbose_debuG) if(skin->verbosity>=Cdrskin_verbose_debuG)
ClN(printf("cdrskin_debug: do_eject= %d\n",skin->do_eject)); ClN(printf("cdrskin_debug: do_eject= %d\n",skin->do_eject));
Cdrskin_release_drive(skin,0);
for(i= 0;i<skin->track_counter;i++) for(i= 0;i<skin->track_counter;i++)
Cdrtrack_cleanup(skin->tracklist[i],0); Cdrtrack_cleanup(skin->tracklist[i],0);
burn_session_free(session); burn_session_free(session);
@ -6838,7 +6835,6 @@ put_out:;
} }
ret= 1; ret= 1;
ex:; ex:;
Cdrskin_release_drive(skin,0);
return(ret); return(ret);
} }

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2011.10.11.141313" #define Cdrskin_timestamP "2011.10.11.163842"