From 51e181e4324f95922f45b990700181cd068cfb29 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 27 Apr 2008 14:02:32 +0000 Subject: [PATCH] New blank type as_needed --- libburn/trunk/cdrskin/cdrskin.1 | 30 ++++++++--- libburn/trunk/cdrskin/cdrskin.c | 61 +++++++++++++++-------- libburn/trunk/cdrskin/cdrskin_timestamp.h | 2 +- 3 files changed, 64 insertions(+), 29 deletions(-) diff --git a/libburn/trunk/cdrskin/cdrskin.1 b/libburn/trunk/cdrskin/cdrskin.1 index 6be19696..de63a24f 100644 --- a/libburn/trunk/cdrskin/cdrskin.1 +++ b/libburn/trunk/cdrskin/cdrskin.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 CDRSKIN 1 "April 26, 2008" +.TH CDRSKIN 1 "April 27, 2008" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -168,7 +168,7 @@ Multiple cycles of blanking and overwriting with random numbers might be. Currently DVD-RW, DVD-R and DVD+R[/DL] can be used for the Sequential recording model. .br -DVD-RW must be in state "Sequential Recording". +This applies to DVD-RW only if they are in state "Sequential Recording". The media must be either blank or appendable. Newly purchased DVD-RW and DVD-R media are in this state. Used DVD-RW get into blank sequential state by option @@ -218,10 +218,6 @@ Best reader compatibility is achieved without it Currently types DVD+RW, DVD-RW, DVD-RAM and BD-RE can be overwritten via cdrskin. BD-RE is supported only with option --allow_untested_media. .br -DVD+RW and DVD-RAM media need no special initial formatting. They offer a -single continuous data area for blockwise random access. BD-RE need -explicit formatting before use. See blank=format_defectmgt . -.br Option -audio is not allowed. Only one track is allowed. Option -multi cannot mark a recognizeable end of overwriteable media. Therefore -multi is banned unless ISO-9660 images shall be expandable by help @@ -233,6 +229,12 @@ media get treated as blank regardless wether they hold data or not. .br Currently there is no difference between -sao and -tao. If ever, then -tao will be the mode which preserves the current behavior. +.PP +DVD+RW and DVD-RAM media need no special initial formatting. They offer a +single continuous data area for blockwise random access. BD-RE need +explicit formatting before use. See +.B blank=as_needed +or blank=format_defectmgt . .br DVD-RW are sold in state "Sequential Recording". To become suitable for the Overwriteable DVD recording model they need to get formatted to state @@ -355,8 +357,16 @@ This is combinable with burning in the same run of cdrskin. The type given with blank= selects the particular behavior: .RS .TP -help -Print this list of blanking types. +as_needed +Try to make the media ready for writing from scratch. If it needs formatting, +then format it. If it is not blank, then try to apply blank=fast. +It is a reason to abort if the media cannot assume thoroughly writeable state, +e.g. if it is non-blank write-once. +.br +This leaves unformatted DVD-RW in unformatted blank state. To format DVD-RW use +blank=format_overwriteable. +.TP +The following blank types are specific to particular media familes. Use them if special features are desired. .TP all Blank an entire CD-RW or an unformatted DVD-RW. @@ -386,6 +396,7 @@ and if cdrskin supports formatting for the media type, and if formatting will not happen automatically during write. This currently applies to unformatted DVD-RW, DVD-RAM and BD-RE. Eventually the appropriate default formatting is chosen. +If other media or states are encountered then nothing happens. .br Note: BD-RE currently is only supported with option --allow_untested_media . .br @@ -466,6 +477,9 @@ The numbers after text "Format idx" are the ones to be used with format_by_index_. Format descriptor lists are volatile. Do neither eject nor write the media between the run of --list_formats and the run of blank=format_by_index_ or else you may get a different format than desired. +.TP +help +Print this list of blanking types. .RE .TP .BI \-checkdrive diff --git a/libburn/trunk/cdrskin/cdrskin.c b/libburn/trunk/cdrskin/cdrskin.c index 1ceaec5e..b66014f6 100644 --- a/libburn/trunk/cdrskin/cdrskin.c +++ b/libburn/trunk/cdrskin/cdrskin.c @@ -2391,6 +2391,8 @@ return: fprintf(stderr,"\tdisk\t\tblank the entire disk\n"); fprintf(stderr,"\tfast\t\tminimally blank the entire disk\n"); fprintf(stderr,"\tminimal\t\tminimally blank the entire disk\n"); + fprintf(stderr, + "\tas_needed\tblank or format media to make it ready for (re-)use\n"); fprintf(stderr, "\tdeformat_sequential\t\tfully blank, even formatted DVD-RW\n"); fprintf(stderr, @@ -3170,6 +3172,10 @@ struct CdrskiN { gets mapped to default variants of specialized formats if the media state requires formatting before writing + 7=if_needed + gets mapped to 6 for DVD-RAM and BD-RE, + to 0 with all other non-blanks + bit8-15: bit0-7 of burn_disc_format(flag) depending on job type */ @@ -4302,11 +4308,13 @@ int Cdrskin_invalidate_iso_head(struct CdrskiN *skin, int flag) @param flag Bitfield for control purposes: bit0= permission to check for overwriteable ISO image bit1= do not report media profile + bit2= do not report but only check for pseudo appendable + @return 1=ok, 2=ok, is pseudo appendable, <=0 error */ int Cdrskin_report_disc_status(struct CdrskiN *skin, enum burn_disc_status s, int flag) { - int ret, iso_size; + int ret, iso_size, pseudo_appendable= 0; if(flag&1) { if(skin->media_is_overwriteable && skin->grow_overwriteable_iso>0) { @@ -4314,10 +4322,14 @@ int Cdrskin_report_disc_status(struct CdrskiN *skin, enum burn_disc_status s, ret= 1; else ret= Cdrskin_overwriteable_iso_size(skin,&iso_size,0); - if(ret>0) + if(ret>0) { s= BURN_DISC_APPENDABLE; + pseudo_appendable= 1; + } } } + if(flag&4) + return(1+pseudo_appendable); printf("cdrskin: status %d ",s); if(s==BURN_DISC_FULL) { @@ -4345,7 +4357,7 @@ int Cdrskin_report_disc_status(struct CdrskiN *skin, enum burn_disc_status s, printf("-unknown status code-\n"); if(flag&2) - return(1); + return(1+pseudo_appendable); #ifdef Cdrskin_libburn_has_get_profilE if((s==BURN_DISC_FULL || s==BURN_DISC_APPENDABLE || s==BURN_DISC_BLANK || @@ -4367,7 +4379,7 @@ int Cdrskin_report_disc_status(struct CdrskiN *skin, enum burn_disc_status s, } #endif - return(1); + return(1+pseudo_appendable); } @@ -5077,9 +5089,10 @@ int Cdrskin_blank(struct CdrskiN *skin, int flag) char *verb= "blank", *presperf="blanking", *fmt_text= "..."; char profile_name[80]; static char fmtp[][40]= { - "format_default", "format_overwrite", "deformat_sequential", - "format_defectmgt", "format_by_index", "format_if_needed"}; - static int fmtp_max= 6; + "...", "format_overwrite", "deformat_sequential", + "(-format)", "format_defectmgt", "format_by_index", + "format_if_needed", "as_needed"}; + static int fmtp_max= 7; start_time= Sfile_microtime(0); /* will be refreshed later */ ret= Cdrskin_grab_drive(skin,0); @@ -5093,14 +5106,11 @@ int Cdrskin_blank(struct CdrskiN *skin, int flag) burn_disc_get_profile(skin->grabbed_drive,&profile_number,profile_name); #endif - if(skin->verbosity>=Cdrskin_verbose_progresS) - Cdrskin_report_disc_status(skin,s,1); + ret= Cdrskin_report_disc_status(skin,s, + 1|(4*!(skin->verbosity>=Cdrskin_verbose_progresS))); + if(ret==2) + s= BURN_DISC_APPENDABLE; do_format= skin->blank_format_type & 0xff; - if(do_format == 1 || do_format == 3 || do_format == 4 || do_format == 5 || - do_format ==6) { - verb= "format"; - presperf= "formatting"; - } #ifdef Cdrskin_libburn_has_pretend_fulL if(s==BURN_DISC_UNSUITABLE) { @@ -5121,11 +5131,11 @@ int Cdrskin_blank(struct CdrskiN *skin, int flag) do_format= 4; else do_format= 1; - } else if(do_format==6) { /* format_if_needed */ + } else if(do_format==6 || do_format==7) { /* format_if_needed , if_needed */ /* Find out whether format is needed at all. Eventuelly set up a suitable formatting run */ - if(profile_number == 0x14) { /* sequential DVD-RW */ + if(profile_number == 0x14 && do_format==6) { /* sequential DVD-RW */ do_format= 1; skin->blank_format_type= 1|(1<<8); skin->blank_format_size= 128*1024*1024; @@ -5139,16 +5149,24 @@ int Cdrskin_blank(struct CdrskiN *skin, int flag) skin->blank_format_size= 0; } #endif - + } else if(do_format==7) { /* try to blank what is not blank yet */ + if(s!=BURN_DISC_BLANK) { + do_format= 0; + skin->blank_fast= 1; + } } - if(do_format==6) { + if(do_format==6 || do_format==7) { if(skin->verbosity>=Cdrskin_verbose_cmD) ClN(fprintf(stderr, - "cdrskin: NOTE : blank=format_if_needed : did not apply formatting\n")); + "cdrskin: NOTE : blank=%s : no need for action detected\n", fmt_text)); {ret= 2; goto ex;} } } + if(do_format == 1 || do_format == 3 || do_format == 4) { + verb= "format"; + presperf= "formatting"; + } if(do_format==2) { /* Forceful blanking to Sequential Recording for DVD-R[W] and CD-RW */ @@ -7196,7 +7214,10 @@ set_blank:; skin->blank_format_type= 2; skin->blank_fast= 1; skin->preskin->demands_cdrskin_caps= 1; - } else if(strcmp(cpt,"help")==0) { + } else if(strcmp(cpt,"as_needed")==0) { + skin->do_blank= 1; + skin->blank_format_type= 7; + } else if(strcmp(cpt,"help")==0) { /* is handled in Cdrpreskin_setup() */; continue; } else { diff --git a/libburn/trunk/cdrskin/cdrskin_timestamp.h b/libburn/trunk/cdrskin/cdrskin_timestamp.h index acb88935..3d1234e1 100644 --- a/libburn/trunk/cdrskin/cdrskin_timestamp.h +++ b/libburn/trunk/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2008.04.27.084704" +#define Cdrskin_timestamP "2008.04.27.140144"