Option -force enables re-formatting

This commit is contained in:
Thomas Schmitt 2007-01-10 15:26:30 +00:00
parent 7bf228954c
commit 27262bde51
6 changed files with 67 additions and 29 deletions

View File

@ -3971,12 +3971,11 @@ int Cdrskin_blank(struct CdrskiN *skin, int flag)
"cdrskin: SORRY : only blank=%s is implemented yet\n",fmtp[1]);
return(0);
} else if(profile_number == 0x14) { /* DVD-RW sequential */
if(do_format!=2 && do_format!=1)
if(do_format!=1)
goto unsupported_with_dvd_minus_rw;
} else if(profile_number == 0x13) { /* DVD-RW restricted overwrite */
if(do_format==2) { /* >>> when re-formatting is implemented:
|| (do_format==1 && skin->force_is_set) */
;
if(do_format==1 && skin->force_is_set) {
/* ok */;
} else if(do_format!=1) {
unsupported_with_dvd_minus_rw:;
fprintf(stderr,
@ -3986,10 +3985,8 @@ unsupported_with_dvd_minus_rw:;
} else {
fprintf(stderr,
"cdrskin: SORRY : blank=format_overwrite : media is already formatted\n");
/* >>> when re-formatting is implemented
fprintf(stderr,
"cdrskin: HINT : If you really want to re-format, try option -force\n");
*/
return(2);
}
} else {
@ -4001,7 +3998,9 @@ unsupported_with_dvd_minus_rw:;
fprintf(stderr,
"cdrskin: NOTE : blank=%s accepted not yet suitable media\n",
fmt_text);
} else {
} else { /* do_format */
if(s!=BURN_DISC_FULL &&
(s!=BURN_DISC_APPENDABLE || skin->no_blank_appendable)) {
Cdrskin_release_drive(skin,0);
@ -4025,7 +4024,9 @@ unsupported_with_dvd_minus_rw:;
fprintf(stderr,"cdrskin: FATAL : blank=... : media is not erasable\n");
return(0);
}
}
} /* ! do_format */
if(skin->dummy_mode) {
fprintf(stderr,
"cdrskin: would have begun to %s disc if not in -dummy mode\n",
@ -4046,7 +4047,7 @@ unsupported_with_dvd_minus_rw:;
#ifdef Cdrskin_libburn_has_burn_disc_formaT
} else if(do_format==1) {
burn_disc_format(drive,(off_t) skin->blank_format_size,
(skin->blank_format_type>>8)&0xff);
((skin->blank_format_type>>8)&0xff) | ((!!skin->force_is_set)<<4));
#endif
} else {
@ -5151,13 +5152,20 @@ set_blank:;
skin->blank_format_size= 128*1024*1024;
} else if(strcmp(cpt,"format_overwrite_full")==0) {
skin->do_blank= 1;
#ifdef Not_yeT
skin->blank_format_type= 1|(1<<10);
skin->blank_format_size= 0;
#else
skin->blank_format_type= 1|(1<<8)|(1<<10);
skin->blank_format_size= 32*1024; /* write just a minimal packet */
#endif
} else if(strcmp(cpt,"format_overwrite_quickest")==0) {
skin->do_blank= 1;
skin->blank_format_type= 1;
skin->blank_format_size= 0;
} else if(strcmp(cpt,"format_sequential")==0) {
} else if(strcmp(cpt,"format_sequential")==0) {/* >>> not yet supported */
skin->do_blank= 1;
skin->blank_format_type= 2;
} else if(strcmp(cpt,"help")==0) {

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2007.01.09.211152"
#define Cdrskin_timestamP "2007.01.10.152350"

View File

@ -266,6 +266,7 @@ static void *format_worker_func(struct w_list *w)
void burn_disc_format(struct burn_drive *drive, off_t size, int flag)
{
struct format_opts o;
int ok = 0;
char msg[160];
if ((SCAN_GOING()) || find_worker(drive)) {
@ -277,7 +278,14 @@ void burn_disc_format(struct burn_drive *drive, off_t size, int flag)
return;
}
if (drive->current_profile != 0x14) { /* no DVD-RW */
if (drive->current_profile == 0x14)
ok = 1; /* DVD-RW sequential */
if (drive->current_profile == 0x13 && (flag & 16))
ok = 1; /* DVD-RW Restricted Overwrite with force bit */
/* >>> DVD+RW with and without force bit ? */
if (!ok) {
sprintf(msg,"Will not format media type %4.4Xh",
drive->current_profile);
libdax_msgs_submit(libdax_messenger, drive->global_index,

View File

@ -475,7 +475,7 @@ void burn_disc_erase_sync(struct burn_drive *d, int fast)
/*
@param flag: bit0 = fill formatted size with zeros
bit1, bit2 are for d->format_unit()
bit1, bit2 , bit4 are for d->format_unit()
*/
void burn_disc_format_sync(struct burn_drive *d, off_t size, int flag)
{
@ -495,7 +495,7 @@ void burn_disc_format_sync(struct burn_drive *d, off_t size, int flag)
d->cancel = 0;
d->busy = BURN_DRIVE_FORMATTING;
ret = d->format_unit(d, size, flag & 6);
ret = d->format_unit(d, size, flag & 0x16); /* forward bits 1,2,4 */
if (ret <= 0)
d->cancel = 1;
/* reset the progress */

View File

@ -855,6 +855,8 @@ void burn_disc_erase(struct burn_drive *drive, int fast);
to the media and eventually perform preliminary closing.
bit1= insist in size 0 even if there is a better default known
bit2= format to maximum available size
bit3= -reserved-
bit4= enforce re-format of (partly) formatted media
*/
void burn_disc_format(struct burn_drive *drive, off_t size, int flag);

View File

@ -1177,11 +1177,14 @@ int mmc_read_format_capacities(struct burn_drive *d, int top_wanted)
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO,
msg, 0, 0);
if (type == 0x10) { /* full format */
/* Scoring strives for quick intermediate state */
if (type == 0x00) { /* full format (with lead out) */
score = 1;
} else if(type == 0x13) {
} else if (type == 0x10) { /* DVD-RW full format */
score = 10;
} else if(type == 0x13) { /* DVD-RW quick grow last session */
score = 100;
} else if(type == 0x15) {
} else if(type == 0x15) { /* DVD-RW Quick */
score = 50;
} else {
continue;
@ -1273,12 +1276,20 @@ int mmc_read_buffer_capacity(struct burn_drive *d)
@param flag bit1= insist in size 0 even if there is a better default known
bit2= format to maximum available size
bit3= expand format up to at least size
bit4= enforce re-format of (partly) formatted media
*/
int mmc_format_unit(struct burn_drive *d, off_t size, int flag)
{
struct buffer buf;
struct command c;
int ret, tolerate_failure = 0, return_immediately = 0, i, format_type;
#ifdef Not_yeT
int full_format_type = 0x00; /* Full Format (or 0x10 for DVD-RW ?) */
#else
int full_format_type = 0x10;
#endif
off_t num_of_blocks = 0, diff;
char msg[160],descr[80];
@ -1308,18 +1319,21 @@ int mmc_format_unit(struct burn_drive *d, off_t size, int flag)
/* maximum capacity */
memset(c.page->data + 4, 0xff, 4);
if (d->bg_format_status == 1) /* is partly formatted */
c.page->data[11] = 1; /* Restart bit */
else if(d->bg_format_status == 2) { /* format in progress */
if(d->bg_format_status == 2) { /* format in progress */
strcpy(msg,"FORMAT UNIT ignored. Already in progress");
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00020120,
LIBDAX_MSGS_SEV_NOTE, LIBDAX_MSGS_PRIO_HIGH,
msg, 0,0);
return 2;
}
if (!(flag & 16)) /* if not re-format is desired */
if (d->bg_format_status == 1) /* is partly formatted */
c.page->data[11] = 1; /* Restart bit */
sprintf(descr, "DVD+RW, BGFS %d", d->bg_format_status);
} else if (d->current_profile == 0x13) {/*DVD-RW restricted overwrite*/
} else if (d->current_profile == 0x13 && !(flag & 16)) {
/*DVD-RW restricted overwrite*/
/* >>> use case: quick grow formatting during write */
ret = mmc_read_format_capacities(d, 0x13);
@ -1357,17 +1371,23 @@ int mmc_format_unit(struct burn_drive *d, off_t size, int flag)
c.page->data[11] = 16; /* block size * 2k */
sprintf(descr, "DVD-RW, quick grow");
} else if (d->current_profile == 0x14) {/*DVD-RW sequential recording*/
/* >>> use case : transition from Sequential to Overwrite */
} else if (d->current_profile == 0x14 ||
(d->current_profile == 0x13 && (flag & 16))) {
/* DVD-RW sequential recording (or Overwrite for re-format) */
/* >>> use case : transition from Sequential to Overwrite
re-formatting of Overwrite media */
/* To Restricted Overwrite */
/* 6.5.4.2.10 , 15h DVD-RW Quick */
/* c.page->data[4-7]==0 : 0 blocks */
/* or 6.5.4.2.5 Format Type = 10h (Full Format) */
mmc_read_format_capacities(d, (flag & 4) ? 0x10 : 0x15);
/* or 6.5.4.2.1 Format Type = 00h (Full Format) */
/* or 6.5.4.2.5 Format Type = 10h (DVD-RW Full Format) */
mmc_read_format_capacities(d,
(flag & 4) ? full_format_type : 0x15);
if (d->best_format_type == 0x15 ||
d->best_format_type == 0x10) {
if ((flag & 4) || d->best_format_type == 0x10) {
d->best_format_type == full_format_type) {
if ((flag & 4)
|| d->best_format_type == full_format_type) {
num_of_blocks = d->best_format_size / 2048;
for (i = 0; i < 4; i++)
c.page->data[4 + i] =