Option -force enables re-formatting
This commit is contained in:
parent
60a65f036a
commit
f0df191a5e
@ -3971,12 +3971,11 @@ int Cdrskin_blank(struct CdrskiN *skin, int flag)
|
|||||||
"cdrskin: SORRY : only blank=%s is implemented yet\n",fmtp[1]);
|
"cdrskin: SORRY : only blank=%s is implemented yet\n",fmtp[1]);
|
||||||
return(0);
|
return(0);
|
||||||
} else if(profile_number == 0x14) { /* DVD-RW sequential */
|
} 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;
|
goto unsupported_with_dvd_minus_rw;
|
||||||
} else if(profile_number == 0x13) { /* DVD-RW restricted overwrite */
|
} else if(profile_number == 0x13) { /* DVD-RW restricted overwrite */
|
||||||
if(do_format==2) { /* >>> when re-formatting is implemented:
|
if(do_format==1 && skin->force_is_set) {
|
||||||
|| (do_format==1 && skin->force_is_set) */
|
/* ok */;
|
||||||
;
|
|
||||||
} else if(do_format!=1) {
|
} else if(do_format!=1) {
|
||||||
unsupported_with_dvd_minus_rw:;
|
unsupported_with_dvd_minus_rw:;
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
@ -3986,10 +3985,8 @@ unsupported_with_dvd_minus_rw:;
|
|||||||
} else {
|
} else {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"cdrskin: SORRY : blank=format_overwrite : media is already formatted\n");
|
"cdrskin: SORRY : blank=format_overwrite : media is already formatted\n");
|
||||||
/* >>> when re-formatting is implemented
|
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"cdrskin: HINT : If you really want to re-format, try option -force\n");
|
"cdrskin: HINT : If you really want to re-format, try option -force\n");
|
||||||
*/
|
|
||||||
return(2);
|
return(2);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -4001,7 +3998,9 @@ unsupported_with_dvd_minus_rw:;
|
|||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"cdrskin: NOTE : blank=%s accepted not yet suitable media\n",
|
"cdrskin: NOTE : blank=%s accepted not yet suitable media\n",
|
||||||
fmt_text);
|
fmt_text);
|
||||||
} else {
|
|
||||||
|
} else { /* do_format */
|
||||||
|
|
||||||
if(s!=BURN_DISC_FULL &&
|
if(s!=BURN_DISC_FULL &&
|
||||||
(s!=BURN_DISC_APPENDABLE || skin->no_blank_appendable)) {
|
(s!=BURN_DISC_APPENDABLE || skin->no_blank_appendable)) {
|
||||||
Cdrskin_release_drive(skin,0);
|
Cdrskin_release_drive(skin,0);
|
||||||
@ -4025,7 +4024,9 @@ unsupported_with_dvd_minus_rw:;
|
|||||||
fprintf(stderr,"cdrskin: FATAL : blank=... : media is not erasable\n");
|
fprintf(stderr,"cdrskin: FATAL : blank=... : media is not erasable\n");
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
} /* ! do_format */
|
||||||
|
|
||||||
if(skin->dummy_mode) {
|
if(skin->dummy_mode) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"cdrskin: would have begun to %s disc if not in -dummy mode\n",
|
"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
|
#ifdef Cdrskin_libburn_has_burn_disc_formaT
|
||||||
} else if(do_format==1) {
|
} else if(do_format==1) {
|
||||||
burn_disc_format(drive,(off_t) skin->blank_format_size,
|
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
|
#endif
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -5151,13 +5152,20 @@ set_blank:;
|
|||||||
skin->blank_format_size= 128*1024*1024;
|
skin->blank_format_size= 128*1024*1024;
|
||||||
} else if(strcmp(cpt,"format_overwrite_full")==0) {
|
} else if(strcmp(cpt,"format_overwrite_full")==0) {
|
||||||
skin->do_blank= 1;
|
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_type= 1|(1<<8)|(1<<10);
|
||||||
skin->blank_format_size= 32*1024; /* write just a minimal packet */
|
skin->blank_format_size= 32*1024; /* write just a minimal packet */
|
||||||
|
#endif
|
||||||
|
|
||||||
} else if(strcmp(cpt,"format_overwrite_quickest")==0) {
|
} else if(strcmp(cpt,"format_overwrite_quickest")==0) {
|
||||||
skin->do_blank= 1;
|
skin->do_blank= 1;
|
||||||
skin->blank_format_type= 1;
|
skin->blank_format_type= 1;
|
||||||
skin->blank_format_size= 0;
|
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->do_blank= 1;
|
||||||
skin->blank_format_type= 2;
|
skin->blank_format_type= 2;
|
||||||
} else if(strcmp(cpt,"help")==0) {
|
} else if(strcmp(cpt,"help")==0) {
|
||||||
|
@ -1 +1 @@
|
|||||||
#define Cdrskin_timestamP "2007.01.09.211152"
|
#define Cdrskin_timestamP "2007.01.10.152350"
|
||||||
|
@ -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)
|
void burn_disc_format(struct burn_drive *drive, off_t size, int flag)
|
||||||
{
|
{
|
||||||
struct format_opts o;
|
struct format_opts o;
|
||||||
|
int ok = 0;
|
||||||
char msg[160];
|
char msg[160];
|
||||||
|
|
||||||
if ((SCAN_GOING()) || find_worker(drive)) {
|
if ((SCAN_GOING()) || find_worker(drive)) {
|
||||||
@ -277,7 +278,14 @@ void burn_disc_format(struct burn_drive *drive, off_t size, int flag)
|
|||||||
return;
|
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",
|
sprintf(msg,"Will not format media type %4.4Xh",
|
||||||
drive->current_profile);
|
drive->current_profile);
|
||||||
libdax_msgs_submit(libdax_messenger, drive->global_index,
|
libdax_msgs_submit(libdax_messenger, drive->global_index,
|
||||||
|
@ -475,7 +475,7 @@ void burn_disc_erase_sync(struct burn_drive *d, int fast)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
@param flag: bit0 = fill formatted size with zeros
|
@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)
|
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->cancel = 0;
|
||||||
d->busy = BURN_DRIVE_FORMATTING;
|
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)
|
if (ret <= 0)
|
||||||
d->cancel = 1;
|
d->cancel = 1;
|
||||||
/* reset the progress */
|
/* reset the progress */
|
||||||
|
@ -855,6 +855,8 @@ void burn_disc_erase(struct burn_drive *drive, int fast);
|
|||||||
to the media and eventually perform preliminary closing.
|
to the media and eventually perform preliminary closing.
|
||||||
bit1= insist in size 0 even if there is a better default known
|
bit1= insist in size 0 even if there is a better default known
|
||||||
bit2= format to maximum available size
|
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);
|
void burn_disc_format(struct burn_drive *drive, off_t size, int flag);
|
||||||
|
|
||||||
|
@ -1177,11 +1177,14 @@ int mmc_read_format_capacities(struct burn_drive *d, int top_wanted)
|
|||||||
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO,
|
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO,
|
||||||
msg, 0, 0);
|
msg, 0, 0);
|
||||||
|
|
||||||
if (type == 0x10) { /* full format */
|
/* Scoring strives for quick intermediate state */
|
||||||
|
if (type == 0x00) { /* full format (with lead out) */
|
||||||
score = 1;
|
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;
|
score = 100;
|
||||||
} else if(type == 0x15) {
|
} else if(type == 0x15) { /* DVD-RW Quick */
|
||||||
score = 50;
|
score = 50;
|
||||||
} else {
|
} else {
|
||||||
continue;
|
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
|
@param flag bit1= insist in size 0 even if there is a better default known
|
||||||
bit2= format to maximum available size
|
bit2= format to maximum available size
|
||||||
bit3= expand format up to at least 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)
|
int mmc_format_unit(struct burn_drive *d, off_t size, int flag)
|
||||||
{
|
{
|
||||||
struct buffer buf;
|
struct buffer buf;
|
||||||
struct command c;
|
struct command c;
|
||||||
int ret, tolerate_failure = 0, return_immediately = 0, i, format_type;
|
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;
|
off_t num_of_blocks = 0, diff;
|
||||||
char msg[160],descr[80];
|
char msg[160],descr[80];
|
||||||
|
|
||||||
@ -1293,8 +1304,8 @@ int mmc_format_unit(struct burn_drive *d, off_t size, int flag)
|
|||||||
memset(c.page->data, 0, c.page->bytes);
|
memset(c.page->data, 0, c.page->bytes);
|
||||||
|
|
||||||
descr[0] = 0;
|
descr[0] = 0;
|
||||||
c.page->data[1] = 0x02; /* Immed */
|
c.page->data[1] = 0x02; /* Immed */
|
||||||
c.page->data[3] = 8; /* Format descriptor length */
|
c.page->data[3] = 8; /* Format descriptor length */
|
||||||
num_of_blocks = size / 2048;
|
num_of_blocks = size / 2048;
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
c.page->data[4 + i] = (num_of_blocks >> (24 - 8 * i)) & 0xff;
|
c.page->data[4 + i] = (num_of_blocks >> (24 - 8 * i)) & 0xff;
|
||||||
@ -1308,18 +1319,21 @@ int mmc_format_unit(struct burn_drive *d, off_t size, int flag)
|
|||||||
/* maximum capacity */
|
/* maximum capacity */
|
||||||
memset(c.page->data + 4, 0xff, 4);
|
memset(c.page->data + 4, 0xff, 4);
|
||||||
|
|
||||||
if (d->bg_format_status == 1) /* is partly formatted */
|
if(d->bg_format_status == 2) { /* format in progress */
|
||||||
c.page->data[11] = 1; /* Restart bit */
|
|
||||||
else if(d->bg_format_status == 2) { /* format in progress */
|
|
||||||
strcpy(msg,"FORMAT UNIT ignored. Already in progress");
|
strcpy(msg,"FORMAT UNIT ignored. Already in progress");
|
||||||
libdax_msgs_submit(libdax_messenger, d->global_index,
|
libdax_msgs_submit(libdax_messenger, d->global_index,
|
||||||
0x00020120,
|
0x00020120,
|
||||||
LIBDAX_MSGS_SEV_NOTE, LIBDAX_MSGS_PRIO_HIGH,
|
LIBDAX_MSGS_SEV_NOTE, LIBDAX_MSGS_PRIO_HIGH,
|
||||||
msg, 0,0);
|
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);
|
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 */
|
/* >>> use case: quick grow formatting during write */
|
||||||
|
|
||||||
ret = mmc_read_format_capacities(d, 0x13);
|
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 */
|
c.page->data[11] = 16; /* block size * 2k */
|
||||||
sprintf(descr, "DVD-RW, quick grow");
|
sprintf(descr, "DVD-RW, quick grow");
|
||||||
|
|
||||||
} else if (d->current_profile == 0x14) {/*DVD-RW sequential recording*/
|
} else if (d->current_profile == 0x14 ||
|
||||||
/* >>> use case : transition from Sequential to Overwrite */
|
(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 */
|
/* To Restricted Overwrite */
|
||||||
/* 6.5.4.2.10 , 15h DVD-RW Quick */
|
/* 6.5.4.2.10 , 15h DVD-RW Quick */
|
||||||
/* c.page->data[4-7]==0 : 0 blocks */
|
/* c.page->data[4-7]==0 : 0 blocks */
|
||||||
/* or 6.5.4.2.5 Format Type = 10h (Full Format) */
|
/* or 6.5.4.2.1 Format Type = 00h (Full Format) */
|
||||||
mmc_read_format_capacities(d, (flag & 4) ? 0x10 : 0x15);
|
/* 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 ||
|
if (d->best_format_type == 0x15 ||
|
||||||
d->best_format_type == 0x10) {
|
d->best_format_type == full_format_type) {
|
||||||
if ((flag & 4) || d->best_format_type == 0x10) {
|
if ((flag & 4)
|
||||||
|
|| d->best_format_type == full_format_type) {
|
||||||
num_of_blocks = d->best_format_size / 2048;
|
num_of_blocks = d->best_format_size / 2048;
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
c.page->data[4 + i] =
|
c.page->data[4 + i] =
|
||||||
|
Loading…
Reference in New Issue
Block a user