Adjustments with DVD-RAM formatting

This commit is contained in:
Thomas Schmitt 2008-04-22 16:13:05 +00:00
parent 1cfb29f032
commit d6fde26824
7 changed files with 149 additions and 58 deletions

View File

@ -2,7 +2,7 @@
.\" First parameter, NAME, should be all caps .\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1) .\" other parameters are allowed: see man(7), man(1)
.TH CDRSKIN 1 "April 17, 2008" .TH CDRSKIN 1 "April 22, 2008"
.\" Please adjust this date whenever revising the manpage. .\" Please adjust this date whenever revising the manpage.
.\" .\"
.\" Some roff macros, for reference: .\" Some roff macros, for reference:
@ -383,6 +383,32 @@ This option treats already formatted media even if not option -force is given.
For DVD+RW this is the only supported explicit formatting type. It provides For DVD+RW this is the only supported explicit formatting type. It provides
complete "de-icing" so no reader slips on unwritten data areas. complete "de-icing" so no reader slips on unwritten data areas.
.TP .TP
format_defectmgt
Format DVD-RAM to reserve a generous amount of spare blocks for defect
management.
.br
The following format_defectmgt_* allow to submit user wishes which
nevertheless have to match one of the available formats. These formats are
offered by the drive after examining the media.
.TP
format_defectmgt_max
Format DVD-RAM to reserve a maximum number of spare blocks.
.TP
format_defectmgt_min
Format DVD-RAM to reserve a minimum number of spare blocks. It might be
necessary to format format_defectmgt_none first in order to get
offered the most minmal spare blocks sizes for format_defectmgt_min.
.TP
format_defectmgt_none
Format DVD-RAM to the largest available payload in the hope to disable
defect management at all. This seems not to have a speed increasing effect,
though.
.TP
format_defectmgt_payload_<size>
The text after "format_defectmgt_payload_" gives a number of bytes, eventually
with suffixes "s", "k", "m". The largest number of spare blocks will be chosen
which allows at least the given payload size.
.TP
deformat_sequential deformat_sequential
Like blank=all but with the additional ability to blank overwriteable DVD-RW. Like blank=all but with the additional ability to blank overwriteable DVD-RW.
This will destroy their formatting and make them sequentially recordable. This will destroy their formatting and make them sequentially recordable.

View File

@ -6995,19 +6995,21 @@ set_blank:;
skin->preskin->demands_cdrskin_caps= 1; skin->preskin->demands_cdrskin_caps= 1;
} else if(strncmp(cpt,"format_defectmgt",16)==0) { } else if(strncmp(cpt,"format_defectmgt",16)==0) {
skin->do_blank= 1; skin->do_blank= 1;
skin->blank_format_type= 4; skin->blank_format_type= 4|(3<<9); /* default payload size */
skin->blank_format_size= 0; skin->blank_format_size= 0;
skin->preskin->demands_cdrskin_caps= 1; skin->preskin->demands_cdrskin_caps= 1;
if(cpt[16]=='_') { if(cpt[16]=='_') {
cpt+= 17; cpt+= 17;
if(strcmp(cpt,"none")==0) if(strcmp(cpt,"none")==0)
skin->blank_format_type|= (1<<13); skin->blank_format_type= 4|(1<<13);
else if(strcmp(cpt,"max")==0) else if(strcmp(cpt,"max")==0)
; skin->blank_format_type= 4; /* smallest payload size above 0 */
else if(strcmp(cpt,"min")==0) else if(strcmp(cpt,"min")==0)
skin->blank_format_type|= (1<<10); skin->blank_format_type= 4|(2<<9); /*largest payload size with mgt*/
else if(isdigit(*cpt)) else if(strncmp(cpt,"payload_",8)==0) {
skin->blank_format_size= Scanf_io_size(cpt,0); skin->blank_format_size= Scanf_io_size(cpt+8,0);
skin->blank_format_type= 4;
}
} }
} else if(strcmp(cpt,"deformat_sequential")==0) { } else if(strcmp(cpt,"deformat_sequential")==0) {
skin->do_blank= 1; skin->do_blank= 1;

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2008.04.18.194602" #define Cdrskin_timestamP "2008.04.22.161139"

View File

@ -1260,7 +1260,7 @@ int burn_drive_grab_dummy(struct burn_drive_info *drive_infos[], char *fname)
d->current_is_supported_profile = 1; d->current_is_supported_profile = 1;
d->block_types[BURN_WRITE_TAO] = BURN_BLOCK_MODE1; d->block_types[BURN_WRITE_TAO] = BURN_BLOCK_MODE1;
d->block_types[BURN_WRITE_SAO] = BURN_BLOCK_SAO; d->block_types[BURN_WRITE_SAO] = BURN_BLOCK_SAO;
d->media_capacity_remaining = size; burn_drive_set_media_capacity_remaining(d, size);
/* >>> ? open file for a test ? (>>> beware of "-" = stdin) */; /* >>> ? open file for a test ? (>>> beware of "-" = stdin) */;
@ -1872,8 +1872,8 @@ off_t burn_disc_available_space(struct burn_drive *d,
return 0; return 0;
if (d->drive_role != 1) { if (d->drive_role != 1) {
if (d->media_capacity_remaining <= 0) if (d->media_capacity_remaining <= 0)
d->media_capacity_remaining = burn_drive_set_media_capacity_remaining(d,
((off_t) (512 * 1024 * 1024 - 1) * (off_t) 2048); (off_t) (512 * 1024 * 1024 - 1) * (off_t) 2048);
} else { } else {
if (o != NULL) if (o != NULL)
d->send_write_parameters(d, o); d->send_write_parameters(d, o);
@ -2105,7 +2105,7 @@ int burn_disc_get_multi_caps(struct burn_drive *d, enum burn_write_types wt,
o->start_adr = 1; o->start_adr = 1;
size = d->media_capacity_remaining; size = d->media_capacity_remaining;
burn_os_stdio_capacity(d->devname, &size); burn_os_stdio_capacity(d->devname, &size);
d->media_capacity_remaining = size; burn_drive_set_media_capacity_remaining(d, size);
o->start_range_high = size; o->start_range_high = size;
o->start_alignment = 2048; /* imposting a drive, not a file */ o->start_alignment = 2048; /* imposting a drive, not a file */
o->might_do_sao = 4; o->might_do_sao = 4;
@ -2456,3 +2456,11 @@ int burn_drive_find_by_thread_pid(struct burn_drive **d, pid_t pid)
} }
/* ts A80422 : centralizing this setting for debugging purposes
*/
int burn_drive_set_media_capacity_remaining(struct burn_drive *d, off_t value)
{
d->media_capacity_remaining = value;
return 1;
}

View File

@ -1178,12 +1178,17 @@ void burn_disc_erase(struct burn_drive *drive, int fast);
@param drive The drive with the disc to format. @param drive The drive with the disc to format.
@param size The size in bytes to be used with the format command. It should @param size The size in bytes to be used with the format command. It should
be divisible by 32*1024. The effect of this parameter may be divisible by 32*1024. The effect of this parameter may
depend on the media profile. depend on the media profile and on parameter flag.
@param flag Bitfield for control purposes: @param flag Bitfield for control purposes:
bit0= after formatting, write the given number of zero-bytes bit0= after formatting, write the given number of zero-bytes
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+2: size mode
bit2= without bit7: format to maximum available size 0 = use parameter size as far as it makes sense
1 = insist in size 0 even if there is a better default known
(has no effect on DVD-RAM or BD-RE)
2 = without bit7: format to maximum available size
with bit7 : take size from indexed format descriptor
3 = without bit7: format to default size
with bit7 : take size from indexed format descriptor with bit7 : take size from indexed format descriptor
bit3= -reserved- bit3= -reserved-
bit4= enforce re-format of (partly) formatted media bit4= enforce re-format of (partly) formatted media

View File

@ -367,7 +367,8 @@ int mmc_get_nwa(struct burn_drive *d, int trackno, int *lba, int *nwa)
return 0; return 0;
} }
if (num > 0) { if (num > 0) {
d->media_capacity_remaining = ((off_t) num) * ((off_t) 2048); burn_drive_set_media_capacity_remaining(d,
((off_t) num) * ((off_t) 2048));
d->media_lba_limit = *nwa + num; d->media_lba_limit = *nwa + num;
} else } else
d->media_lba_limit = 0; d->media_lba_limit = 0;
@ -1049,9 +1050,9 @@ int mmc_fake_toc(struct burn_drive *d)
if (session_number > d->disc->sessions) { if (session_number > d->disc->sessions) {
if (i == d->last_track_no - 1) { if (i == d->last_track_no - 1) {
/* ts A70212 : Last track field Free Blocks */ /* ts A70212 : Last track field Free Blocks */
d->media_capacity_remaining = burn_drive_set_media_capacity_remaining(d,
((off_t) mmc_four_char_to_int(tdata + 16)) * ((off_t) mmc_four_char_to_int(tdata + 16)) *
((off_t) 2048); ((off_t) 2048));
d->media_lba_limit = 0; d->media_lba_limit = 0;
} }
continue; continue;
@ -2355,6 +2356,12 @@ static int mmc_read_format_capacities_al(struct burn_drive *d,
*/ */
d->format_curr_max_size *= (off_t) 2048; d->format_curr_max_size *= (off_t) 2048;
if((d->current_profile == 0x12 || d->current_profile == 0x43)
&& d->media_capacity_remaining == 0) {
burn_drive_set_media_capacity_remaining(d,
d->format_curr_max_size);
d->media_lba_limit = d->format_curr_max_size / 2048;
}
if (top_wanted == 0x00 || top_wanted == 0x10) if (top_wanted == 0x00 || top_wanted == 0x10)
sign = -1; /* the caller clearly desires full format */ sign = -1; /* the caller clearly desires full format */
@ -2387,11 +2394,6 @@ static int mmc_read_format_capacities_al(struct burn_drive *d,
/* Criterion is proximity to quick intermediate state */ /* Criterion is proximity to quick intermediate state */
if (type == 0x00) { /* full format (with lead out) */ if (type == 0x00) { /* full format (with lead out) */
score = 1 * sign; score = 1 * sign;
if(d->current_profile == 0x12 &&
d->media_capacity_remaining == 0) {
d->media_capacity_remaining = size;
d->media_lba_limit = num_blocks;
}
} else if (type == 0x10) { /* DVD-RW full format */ } else if (type == 0x10) { /* DVD-RW full format */
score = 10 * sign; score = 10 * sign;
} else if(type == 0x13) { /* DVD-RW quick grow last session */ } else if(type == 0x13) { /* DVD-RW quick grow last session */
@ -2399,12 +2401,13 @@ static int mmc_read_format_capacities_al(struct burn_drive *d,
} else if(type == 0x15) { /* DVD-RW Quick */ } else if(type == 0x15) { /* DVD-RW Quick */
score = 50 * sign; score = 50 * sign;
if(d->current_profile == 0x13) { if(d->current_profile == 0x13) {
d->media_capacity_remaining = size; burn_drive_set_media_capacity_remaining(d,
size);
d->media_lba_limit = num_blocks; d->media_lba_limit = num_blocks;
} }
} else if(type == 0x26) { /* DVD+RW */ } else if(type == 0x26) { /* DVD+RW */
score = 1 * sign; score = 1 * sign;
d->media_capacity_remaining = size; burn_drive_set_media_capacity_remaining(d, size);
d->media_lba_limit = num_blocks; d->media_lba_limit = num_blocks;
} else { } else {
continue; continue;
@ -2560,8 +2563,12 @@ int mmc_read_buffer_capacity(struct burn_drive *d)
and mmc5r03c.pdf, 6.5 FORMAT UNIT */ and mmc5r03c.pdf, 6.5 FORMAT UNIT */
/* /*
@param size The size (in bytes) to be sent with the FORMAT comand @param size The size (in bytes) to be sent with the FORMAT comand
@param flag bit1= insist in size 0 even if there is a better default known @param flag bit1+2: size mode
bit2= format to maximum available size 0 = use parameter size as far as it makes sense
1 = insist in size 0 even if there is a better default known
2 = without bit7: format to maximum available size
with bit7 : take size from indexed format descriptor
3 = format to default 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 bit4= enforce re-format of (partly) formatted media
bit5= try to disable eventual defect management bit5= try to disable eventual defect management
@ -2573,13 +2580,14 @@ 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;
int index, format_sub_type = 0; int index, format_sub_type = 0, format_00_index, size_mode;
off_t num_of_blocks = 0, diff, format_size; off_t num_of_blocks = 0, diff, format_size, i_size, format_00_max_size;
char msg[160],descr[80]; char msg[160],descr[80];
int full_format_type = 0x00; /* Full Format (or 0x10 for DVD-RW ?) */ int full_format_type = 0x00; /* Full Format (or 0x10 for DVD-RW ?) */
if (mmc_function_spy(d, "mmc_format_unit") <= 0) if (mmc_function_spy(d, "mmc_format_unit") <= 0)
return 0; return 0;
size_mode = (flag >> 1) & 3;
scsi_init_command(&c, MMC_FORMAT_UNIT, sizeof(MMC_FORMAT_UNIT)); scsi_init_command(&c, MMC_FORMAT_UNIT, sizeof(MMC_FORMAT_UNIT));
/* /*
@ -2650,6 +2658,8 @@ selected_not_suitable:;
/* mmc5r03c.pdf , 6.5.4.2.14, DVD+RW Basic Format */ /* mmc5r03c.pdf , 6.5.4.2.14, DVD+RW Basic Format */
format_type = 0x26; format_type = 0x26;
/* >>> ??? is this "| 8" a bug ? */
if ((size <= 0 && !(flag & 2)) || (flag & (4 | 8))) { if ((size <= 0 && !(flag & 2)) || (flag & (4 | 8))) {
/* maximum capacity */ /* maximum capacity */
memset(c.page->data + 4, 0xff, 4); memset(c.page->data + 4, 0xff, 4);
@ -2753,32 +2763,64 @@ no_suitable_formatting_type:;
} else if (d->current_profile == 0x12) { } else if (d->current_profile == 0x12) {
/* ts A80417 : DVD-RAM */ /* ts A80417 : DVD-RAM */
index = -1; /* 6.5.4.2.1 Format Type = 00h (Full Format)
format_size = -1; 6.5.4.2.2 Format Type = 01h (Spare Area Expansion)
*/
index = format_00_index = -1;
format_size = format_00_max_size = -1;
for (i = 0; i < d->num_format_descr; i++) { for (i = 0; i < d->num_format_descr; i++) {
format_type = d->format_descriptors[i].type; format_type = d->format_descriptors[i].type;
if (format_type!=0x00 && format_type!=0x01) i_size = d->format_descriptors[i].size;
if (format_type != 0x00 && format_type != 0x01)
continue; continue;
if(flag & (4 | 32)) { /* Max size or no defect mgt */ if (flag & 32) { /* No defect mgt */
/* Search for largest 0x00 or 0x01 /* Search for largest 0x00 format descriptor */
format descriptor */; if (format_type != 0x00)
if (d->format_descriptors[i].size>format_size){ continue;
format_size = if (i_size < format_size)
d->format_descriptors[i].size; continue;
format_size = i_size;
index = i;
continue;
} else if (flag & 4) { /*Max or default size with mgt*/
/* Search for second largest 0x00
format descriptor. For max size allow
format type 0x01.
*/
if (format_type == 0x00) {
if (i_size < format_size)
continue;
if (i_size < format_00_max_size) {
format_size = i_size;
index = i;
continue;
}
format_size = format_00_max_size;
index = format_00_index;
format_00_max_size = i_size;
format_00_index = i;
continue;
}
if (size_mode==3)
continue;
if (i_size > format_size) {
format_size = i_size;
index = i; index = i;
} }
} else { continue;
}
/* Search for smallest 0x0 or 0x01 /* Search for smallest 0x0 or 0x01
descriptor >= size */; descriptor >= size */;
if (d->format_descriptors[i].size >= size && if (d->format_descriptors[i].size >= size &&
(format_size < 0 || (format_size < 0 || i_size < format_size)
d->format_descriptors[i].size<format_size)
) { ) {
format_size = format_size = i_size;
d->format_descriptors[i].size;
index = i; index = i;
} }
} }
if(index < 0 && (flag & 4) && !(flag & 32)) {
format_size = format_00_max_size;
index = format_00_index;
} }
if(index < 0) if(index < 0)
goto no_suitable_formatting_type; goto no_suitable_formatting_type;
@ -2797,7 +2839,6 @@ no_suitable_formatting_type:;
DCRT: Disable Certification and maintain number of blocks DCRT: Disable Certification and maintain number of blocks
c.page->data[1] |= 0x20; c.page->data[1] |= 0x20;
*/ */
/* <<< ts A80418 : experiment: MMC-5 6.5.4.2.1.2 /* <<< ts A80418 : experiment: MMC-5 6.5.4.2.1.2
Override maintaining of number of blocks with DCRT Override maintaining of number of blocks with DCRT
c.opcode[1] |= 0x08; c.opcode[1] |= 0x08;
@ -2843,7 +2884,7 @@ unsuitable_media:;
libdax_msgs_submit(libdax_messenger, d->global_index, 0x00000002, libdax_msgs_submit(libdax_messenger, d->global_index, 0x00000002,
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO, LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO,
msg, 0, 0); msg, 0, 0);
sprintf(msg, "Format list "); sprintf(msg, "Format list: ");
for (i = 0; i < 12; i++) for (i = 0; i < 12; i++)
sprintf(msg + strlen(msg), "%2.2X ", c.page->data[i]); sprintf(msg + strlen(msg), "%2.2X ", c.page->data[i]);
strcat(msg, "\n"); strcat(msg, "\n");
@ -2851,17 +2892,21 @@ unsuitable_media:;
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO, LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO,
msg, 0, 0); msg, 0, 0);
/*
/* <<< # define Libburn_do_not_format_dvd_raM 1
if(d->current_profile == 0x12 || d->current_profile == 0x43) { */
if(d->current_profile == 0x43
#ifdef Libburn_do_not_format_dvd_raM
|| d->current_profile == 0x12
#endif
) {
libdax_msgs_submit(libdax_messenger, d->global_index, libdax_msgs_submit(libdax_messenger, d->global_index,
0x00000002, 0x00000002,
LIBDAX_MSGS_SEV_NOTE, LIBDAX_MSGS_PRIO_ZERO, LIBDAX_MSGS_SEV_WARNING, LIBDAX_MSGS_PRIO_ZERO,
"Formatting of DVD-RAM or BD-RE not implemented yet", "Formatting of BD-RE not implemented yet - This is a dummy",
0, 0); 0, 0);
return 1; return 1;
} }
*/
d->issue_command(d, &c); d->issue_command(d, &c);
if (c.error && !tolerate_failure) { if (c.error && !tolerate_failure) {

View File

@ -353,4 +353,9 @@ struct burn_drive
/* end of generic 'drive' data structures */ /* end of generic 'drive' data structures */
/* ts A80422 : centralizing this setting for debugging purposes
*/
int burn_drive_set_media_capacity_remaining(struct burn_drive *d, off_t value);
#endif /* __TRANSPORT */ #endif /* __TRANSPORT */