From 163509011ccd99052d50261c34a782d3ee968e3b Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 31 Jan 2007 12:59:51 +0000 Subject: [PATCH] Blank sequential DVD-RW, deformat overwriteable DVD-RW --- libburn/trunk/cdrskin/cdrskin.1 | 79 +++++++++++++--- libburn/trunk/cdrskin/cdrskin.c | 109 ++++++++-------------- libburn/trunk/cdrskin/cdrskin_timestamp.h | 2 +- libburn/trunk/libburn/async.c | 8 +- 4 files changed, 111 insertions(+), 87 deletions(-) diff --git a/libburn/trunk/cdrskin/cdrskin.1 b/libburn/trunk/cdrskin/cdrskin.1 index e7fc66a2..44cfce2b 100644 --- a/libburn/trunk/cdrskin/cdrskin.1 +++ b/libburn/trunk/cdrskin/cdrskin.1 @@ -96,7 +96,19 @@ the archivers afio and star. Not suitable seems GNU tar. .br CD-R can be initially written only once and eventually extended until they get closed (or are spoiled because they are overly full). After that they are -read-only. +read-only. Closing is done automatically unless option +.B -multi +is given which keeps the media appendable. +.br +There are two write modes, +.B -tao +and +.B -sao . +.br +-tao allows to use track source of unpredictable length (like stdin) and allows +to write further sessions to appendable media. -sao produces audio sessions +with seamless tracks but needs predicted track sizes and cannot append sessions +to media. .br CD-RW media can be blanked to make them re-usable for another round of overwriting. Usually @@ -106,9 +118,9 @@ Blanking damages the previous content but does not make it completely unreadable. It is no effective privacy precaution. Multiple cycles of blanking and overwriting with random numbers might be. .PP -.B Recordable DVD Media: +.B Overwriteable DVD Media: .br -Currently only types DVD+RW, DVD-RW and DVD-RAM can be burned via cdrskin. +Currently only types DVD+RW, DVD-RW and DVD-RAM can be overwritten via cdrskin. .br DVD+RW and DVD-RAM media get treated as blank media regardless wether they hold data or not. They need no special initial formatting. @@ -118,12 +130,44 @@ Speed is counted in DVD units (i.e. 1x = 1,385,000 bytes/second). Currently there is no difference between -sao and -tao. If ever, then -tao will be the mode which preserves the current behavior. .br -DVD-RW need to be formatted to state "Restricted Overwrite". Then they behave -much like DVD+RW. This formatting can be done by option +DVD-RW are sold in state "Sequential Recording". To become suitable for the +Overwriteable DVD recoding model they need to get formatted to state +"Restricted Overwrite". Then they behave much like DVD+RW. This formatting +can be done by option .B blank=format_overwrite -It is necessary for unused media, for media written or blanked by cdrecord, -for media which have been written unformatted by growisofs or blanked by -dvd+rw-format -blank. If in doubt, just give it a try. +.br +Several programs like dvd+rw-format, cdrecord, wodim, or cdrskin option +blank=deformat_sequential can bring a DVD-RW out of overwriteable state so +that it has to be formatted again. If in doubt, just give it a try. +.PP +.B Sequentially Recordable DVD Media: +.br +--------------- +.br +Note: The support for sequentially recordable media is still emerging. +.br +DVD-R have not been tested yet. If no Incremental Streaming feature (21h) +is offered, then the media is regarded as unsuitable without further +explanation. (One can torture DVD-RW to make them offer only DAO (2Fh)). +Only single-track sessions have been tested yet. Multi-session works but +-toc and -msinfo are not implemented yet. +.br +--------------- +.br +Currently only DVD-RW (and most probably DVD-R) can be used for the Sequential +recording model. DVD-RW must be in state "Sequential Recording". The media must +be either blank or appendable. Newly purchased DVD-RW media are in this state. +Used DVD-RW get into blank sequential state by option +.B blank=deformat_sequential . +.br +Incremental Streaming is the default write mode if it is offered by the media. +It resembles much TAO writing with CD, as it allows track sources of +unpredicted length and to keep media appendable by option +.B -multi . +Only restriction towards CD-RW is the lack of support for -audio tracks. +.br +(The other write mode, DAO, is not implemented yet. It will allow no -multi and +only a single track.) .PP .B Drive preparation and addressing: .br @@ -194,14 +238,15 @@ help Print this list of blanking types. .TP all -Blank an entire CD. +Blank an entire CD-RW or an unformatted DVD-RW. .TP fast -Minimally blank an entire CD. +Minimally blank an entire CD-RW or an unformatted DVD-RW. .TP format_overwrite Format a DVD-RW to "Restricted Overwrite". The user should bring some patience. -(Note: format_overwrite* are not original cdrecord options.) +.br +(Note: blank=format_overwrite* are not original cdrecord options.) .TP format_overwrite_quickest Like format_overwrite without creating a 128 MB trailblazer session. @@ -215,8 +260,16 @@ rather than just 128 MB. Most traditional formatting is attempted. No data get written. Much patience is required. .br +This option treats already formatted media even if not option -force is given. +.br For DVD+RW this is the only supported explicit formatting type. It provides complete "de-icing" so no reader slips on unwritten data areas. +.TP +deformat_sequential +Like blank=all but with the additional ability to blank overwriteable DVD-RW. +This will destroy their formatting and make them sequentially recordable. +.br +(Note: blank=deformat_sequential is not an original cdrecord option.) .RE .TP .BI \-checkdrive @@ -591,13 +644,13 @@ cdrskin dev=ATA:1,0,0 -atip .br cdrskin dev=/dev/hdc -toc .SS -.B Make used CD-RW writable again: +.B Make used CD-RW or used unformatted DVD-RW writable again: .br cdrskin -v dev=/dev/sg1 blank=all -eject .br cdrskin -v dev=/dev/dvd blank=fast -eject .SS -.B Format DVD-RW before first use with cdrskin: +.B Format DVD-RW to avoid need for blanking before re-use: .br cdrskin -v dev=/dev/sr0 blank=format_overwrite .SS diff --git a/libburn/trunk/cdrskin/cdrskin.c b/libburn/trunk/cdrskin/cdrskin.c index af365781..a188ce9a 100644 --- a/libburn/trunk/cdrskin/cdrskin.c +++ b/libburn/trunk/cdrskin/cdrskin.c @@ -7,7 +7,7 @@ A cdrecord compatible command line interface for libburn. This project is neither directed against original cdrecord nor does it exploit any source code of said program. It rather tries to be an alternative method -to burn CD which is not based on the same code as cdrecord. +to burn CD or DVD, which is not based on the same code as cdrecord. See also : http://scdbackup.sourceforge.net/cdrskin_eng.html Interested users of cdrecord are encouraged to contribute further option @@ -33,48 +33,10 @@ The implementation of an option would probably consist of See option blank= for an example. ------------------------------------------------------------------------------ -About compliance with *strong urge* of API towards burn_drive_scan_and_grab() -For a more comprehensive example of the advised way to behave with libburn -see test/libburner.c . +For a more comprehensive example of the advised way to write an application +of libburn see test/libburner.c . -cdrskin was the initiator of the whitelist functionality within libburn. -Now it has problems to obviously comply with the new API best practice -presciptions literally. Therefore this explanation: - -On start it restricts the library to a single drive if it already knows the -persistent address by option dev= . This is done with a combination of -burn_drive_add_whitelist() and burn_drive_scan(). Not compliant to the -literal strong urge but in fact exactly fulfilling the reason for that -urge in the API: any scanned drive might be opened exclusively after -burn_drive_scan(). It is kernel dependent wether this behavior is on, off -or switchable. The sysdamin will want it on - but only for one drive. - -So with dev=... cdrskin complies to the spirit of the strong urge. -Without dev=... it has to leave out the whitelist in order to enable bus -scanning and implicit drive address 0. A tradition of 9 months shall not -be broken. So burns without dev= will stay possible - but harmless only -on single drive systems. - -Burns without dev= resp. with dev=number are harmless on multi-drive systems. - -This is because Cdrskin_grab_drive() either drops the unwanted drives or -it enforces a restart of the library with the desired drive's persistent -address. This restart then really uses the strongly urged function -burn_drive_scan_and_grab(). -Thus, cdrskin complies with the new spirit of API by closing down libburn -or by dropping unused drives as soon as the persistent drive address is -known and the drive is to be used with a long running operation. To my -knowlege all long running operations in cdrskin need a grabbed drive. - -This spaghetti approach seems necessary to keep small the impact of new API -urge on cdrskin's stability. cdrskin suffers from having donated the body -parts which have been transplanted to libburn in order to create - burn_drive_scan_and_grab() . The desired sysadmin friendlyness was already -achieved by most cdrskin runs. The remaining problem situations should now -be defused by releasing any short time grabbed flocks of drives during the -restart of libburn. - ------------------------------------------------------------------------------ This program is currently copyright Thomas Schmitt only. The copyrights of several components of libburnia.pykix.org are willfully @@ -2388,7 +2350,7 @@ struct CdrskiN { bit8 = write zeros after formatting bit9 = insist in size 0 bit10= format to maximum available size - 2=format_sequential (unimplemented yet) + 2=deformat_sequential (blank_fast might matter) */ double blank_format_size; /* to be used with burn_disc_format() */ @@ -3900,10 +3862,10 @@ int Cdrskin_blank(struct CdrskiN *skin, int flag) int ret,loop_counter= 0,hint_force= 0,do_format= 0, profile_number= -1; int wrote_well= 1; double start_time; - char *verb= "blank", *presperf="blanking", *fmt_text= "format_..."; + char *verb= "blank", *presperf="blanking", *fmt_text= "..."; char profile_name[80]; static char fmtp[][40]= { - "format_default", "format_overwrite", "format_sequential"}; + "format_default", "format_overwrite", "deformat_sequential"}; static int fmtp_max= 2; start_time= Sfile_microtime(0); /* will be refreshed later */ @@ -3921,7 +3883,7 @@ int Cdrskin_blank(struct CdrskiN *skin, int flag) if(skin->verbosity>=Cdrskin_verbose_progresS) Cdrskin_report_disc_status(skin,s,0); do_format= skin->blank_format_type & 0xff; - if(do_format) { + if(do_format == 1) { verb= "format"; presperf= "formatting"; } @@ -3938,29 +3900,28 @@ int Cdrskin_blank(struct CdrskiN *skin, int flag) } #endif /* Cdrskin_libburn_has_pretend_fulL */ - if(do_format) { + if(do_format) if(do_format>=0 && do_format<=fmtp_max) fmt_text= fmtp[do_format]; - if(do_format!=1) { - /* >>> other formats to come. At least _sequential */; + if(do_format==2) { + /* Forceful blanking to Sequential Recording for DVD-R[W] and CD-RW */ + if(!(profile_number == 0x14 || profile_number == 0x13 || + profile_number == 0x11 || profile_number == 0x0a)) + goto unsupported_format_type; + if(s==BURN_DISC_UNSUITABLE) fprintf(stderr, - "cdrskin: SORRY : only blank=%s is implemented yet\n",fmtp[1]); - return(0); - } else if(profile_number == 0x14) { /* DVD-RW sequential */ - if(do_format!=1) - goto unsupported_format_type; - } else if(profile_number == 0x13) { /* DVD-RW restricted overwrite */ - if(do_format==1 && skin->force_is_set) { + "cdrskin: NOTE : blank=%s accepted not yet suitable media\n", + fmt_text); + + } else if (do_format==1) { + /* Formatting to become overwriteable for DVD-RW and DVD+RW */ + + if(profile_number == 0x14) { /* DVD-RW sequential */ /* ok */; - } else if(do_format!=1) { -unsupported_format_type:; - fprintf(stderr, - "cdrskin: SORRY : blank=%s : unsupported format and/or media type\n", - fmt_text); - return(0); - } else { + } else if(profile_number == 0x13) { /* DVD-RW restricted overwrite */ + if(!(skin->force_is_set || ((skin->blank_format_type>>8)&4))) { fprintf(stderr, "cdrskin: NOTE : blank=format_... : media is already formatted\n"); fprintf(stderr, @@ -3968,15 +3929,11 @@ unsupported_format_type:; return(2); } } else if(profile_number == 0x1a) { /* DVD+RW */ - if(do_format!=1) - goto unsupported_format_type; if(!((skin->blank_format_type>>8)&4)) { fprintf(stderr, "cdrskin: NOTE : blank=format_... : DVD+RW do not need this\n"); fprintf(stderr, "cdrskin: HINT : For de-icing use option blank=format_overwrite_full"); - fprintf(stderr, - "cdrskin: HINT : If you really want to re-format, add option -force\n"); return(2); } } else { @@ -3989,7 +3946,8 @@ unsupported_format_type:; "cdrskin: NOTE : blank=%s accepted not yet suitable media\n", fmt_text); - } else { /* do_format */ + } else if(do_format==0) { + /* Classical blanking of erasable media */ if(s!=BURN_DISC_FULL && (s!=BURN_DISC_APPENDABLE || skin->no_blank_appendable)) { @@ -4015,7 +3973,13 @@ unsupported_format_type:; return(0); } - } /* ! do_format */ + } else { +unsupported_format_type:; + fprintf(stderr, + "cdrskin: SORRY : blank=%s is unsupported with media type %s\n", + fmt_text, profile_name); + return(0); + } if(skin->dummy_mode) { fprintf(stderr, @@ -4027,11 +3991,11 @@ unsupported_format_type:; Cdrskin_adjust_speed(skin,0); #ifndef Cdrskin_extra_leaN - Cdrskin_wait_before_action(skin,1+(!!do_format)); + Cdrskin_wait_before_action(skin,1+(do_format==1)); #endif /* ! Cdrskin_extra_leaN */ skin->drive_is_busy= 1; - if(do_format==0) { + if(do_format==0 || do_format==2) { burn_disc_erase(drive,skin->blank_fast); #ifdef Cdrskin_libburn_has_burn_disc_formaT @@ -4074,7 +4038,7 @@ blanking_done:; fprintf(stderr, "\rcdrskin: %s done \n", presperf); - printf("%s time: %.3fs\n",(do_format?"Formatting":"Blanking"), + printf("%s time: %.3fs\n",(do_format==1?"Formatting":"Blanking"), Sfile_microtime(0)-start_time); } fflush(stdout); @@ -5159,9 +5123,10 @@ set_blank:; skin->do_blank= 1; skin->blank_format_type= 1; skin->blank_format_size= 0; - } else if(strcmp(cpt,"format_sequential")==0) {/* >>> not yet supported */ + } else if(strcmp(cpt,"deformat_sequential")==0) { skin->do_blank= 1; skin->blank_format_type= 2; + skin->blank_fast= 0; } else if(strcmp(cpt,"help")==0) { /* is handled in Cdrpreskin_setup() */; continue; diff --git a/libburn/trunk/cdrskin/cdrskin_timestamp.h b/libburn/trunk/cdrskin/cdrskin_timestamp.h index 85fc80e6..51aaaf92 100644 --- a/libburn/trunk/cdrskin/cdrskin_timestamp.h +++ b/libburn/trunk/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2007.01.30.220220" +#define Cdrskin_timestamP "2007.01.31.130100" diff --git a/libburn/trunk/libburn/async.c b/libburn/trunk/libburn/async.c index 3668c38a..42382114 100644 --- a/libburn/trunk/libburn/async.c +++ b/libburn/trunk/libburn/async.c @@ -235,9 +235,11 @@ void burn_disc_erase(struct burn_drive *drive, int fast) /* ts A70103 moved up from burn_disc_erase_sync() */ /* ts A60825 : allow on parole to blank appendable CDs */ + /* ts A70131 : allow blanking of overwriteable DVD-RW (profile 0x13) */ if ( ! (drive->status == BURN_DISC_FULL || (drive->status == BURN_DISC_APPENDABLE && - ! libburn_back_hack_42) ) ) { + ! libburn_back_hack_42) || + drive->current_profile == 0x13 ) ) { libdax_msgs_submit(libdax_messenger, drive->global_index, 0x00020130, LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH, @@ -246,6 +248,10 @@ void burn_disc_erase(struct burn_drive *drive, int fast) return; } + /* ts A70131 : i get awful results with fast blanking DVD-RW */ + if (drive->current_profile == 0x13 || drive->current_profile == 0x14) + fast = 0; + o.drive = drive; o.fast = fast; add_worker(drive, (WorkerFunc) erase_worker_func, &o);