Made program behavior with --grow_overwriteable_iso more consistent

This commit is contained in:
Thomas Schmitt 2007-08-28 14:31:42 +00:00
parent c7c94b04ff
commit c40a909956
3 changed files with 137 additions and 103 deletions

View File

@ -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 "August 26, 2007"
.TH CDRSKIN 1 "August 27, 2007"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@ -200,14 +200,16 @@ Best reader compatibility is achieved without it
.br
Currently 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.
DVD+RW and DVD-RAM media need no special initial formatting. They offer a
single continuous data area for blockwise random access.
.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
of option --grow_overwriteable_iso.
Without this option or without an ISO-9660 filesystem image present
on media, -toc does not return information about the media content.
on media, -toc does not return information about the media content and
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.
@ -296,11 +298,11 @@ Print this list of blanking types.
.TP
all
Blank an entire CD-RW or an unformatted DVD-RW.
(See also --prodvd_cli_compatible)
(See also --prodvd_cli_compatible, --grow_overwriteable_iso)
.TP
fast
Minimally blank an entire CD-RW or blank an unformatted DVD-RW.
(See also --prodvd_cli_compatible)
(See also --prodvd_cli_compatible, --grow_overwriteable_iso)
.TP
format_overwrite
Format a DVD-RW to "Restricted Overwrite". The user should bring some patience.
@ -470,12 +472,6 @@ The following sessions can only be written in -tao mode. -multi is prohibited
with DVD-R[W] DAO write mode. Option --prodvd_cli_compatible eventually makes
-multi tolerable but cannot make it work.
.br
With overwriteable DVD media, -multi cannot mark the end of the session.
So when adding a new session this end has to be determined from the payload.
Currently only ISO-9660 filesystems can be used that way. See option
.B \--grow_overwriteable_iso
for lifting the ban on -multi.
.br
In order to have all filesystem content accessible, the eventual ISO-9660
filesystem of a follow-up
session needs to be prepared in a special way by the filesystem formatter
@ -486,6 +482,12 @@ To retrieve an archive file which was written as follow-up session,
you may use option -toc to learn about the "lba" of the desired track number.
This lba is the address of the 2048 byte block where the archive begins.
.br
With overwriteable DVD media, -multi cannot mark the end of the session.
So when adding a new session this end has to be determined from the payload.
Currently only ISO-9660 filesystems can be used that way. See option
.B \--grow_overwriteable_iso
for lifting the ban on -multi.
.br
Note: -multi might make DVD media unreadable in some DVD-ROM drives.
.TP
.BI \-nopad
@ -707,25 +709,31 @@ but adapted to the usage model of
.B cdrskin -msinfo ; mkisofs -C -M | cdrskin [-multi] -
.br
--grow_overwriteable_iso does not hamper the use of true multi-session media.
It demands nevertheless that the track source is a ISO-9660 filesystem image.
With overwriteable media and no option blank=fast|all present it expands an
eventual ISO-9660 filesystem. It is assumed that this image's inner size
description points to the end of the valuable data on media.
I.e. it is possible to use the same cdrskin options with both kinds of media
and to achieve similar results if ISO-9660 filesystem images are to be written.
This option implies option -isosize and therefore demands that the track
source is a ISO-9660 filesystem image.
.br
Options -msinfo and -toc will then work for overwriteables. -toc will always
show a single session with its size increasing with every added mkisofs image.
With overwriteable media and no option blank=fast|all present it expands an
eventual ISO-9660 filesystem on media. It is assumed that this image's inner
size description points to the end of the valuable data.
Overwriteable media with a recognizeable ISO-9660 size will be regarded as
appendable rather than as blank. I.e. options -msinfo and -toc will work.
-toc will always show a single session with its size increasing with
every added mkisofs image.
.br
If not overriden by option write_start_address=, the track with the new image
will be placed behind the end of the old one. One may use option
assert_write_lba= to make sure that media state and mkisofs job do match.
.br
--grow_overwriteable_iso causes option blank=fast|all to invalidate an
eventual ISO-9660 image by altering the first few bytes of block 16 on
overwriteable media.
.br
If not overriden by option write_start_address=, the track with the new image
will be placed at the end of the old one. One may use option assert_write_lba=
to make sure that media state and mkisofs job do match.
Option -multi is tolerated in order not to hamper true multi-session media.
.br
Note: The equivalent of growisofs -Z is
.br
(mkisofs | cdrskin --grow_overwriteable_iso blank=fast [-multi])
.B mkisofs | cdrskin --grow_overwriteable_iso blank=fast [-multi]
.br
growisofs -dvd-compat is roughly equivalent to cdrskin without option -multi.
.TP

View File

@ -3713,10 +3713,98 @@ adr_translation:;
}
/** Report media status s to the user */
/** Read and buffer the start of an existing ISO-9660 image from
overwriteable target media.
*/
int Cdrskin_overwriteable_iso_size(struct CdrskiN *skin, int *size, int flag)
{
#ifdef Cdrskin_libburn_has_random_access_rW
int ret;
off_t data_count= 0;
double size_in_bytes;
char *buf;
buf= skin->overwriteable_iso_head;
if(!skin->media_is_overwriteable)
{ret= 0; goto ex;}
/* Read first 64 kB */
ret= burn_read_data(skin->grabbed_drive,(off_t) 0,buf,32*2048,&data_count,0);
if(ret<=0)
{ret= 0; goto ex;}
ret= Scan_for_iso_size((unsigned char *) (buf+16*2048), &size_in_bytes,0);
if(ret<=0) {
if(skin->verbosity>=Cdrskin_verbose_debuG)
ClN(fprintf(stderr,"cdrskin_debug: No detectable ISO-9660 size on media\n"));
{ret= 0; goto ex;}
}
if(skin->verbosity>=Cdrskin_verbose_debuG)
ClN(fprintf(stderr,"cdrskin_debug: detected ISO-9660 size : %.f (%fs)\n",
size_in_bytes, size_in_bytes/2048.0));
if(size_in_bytes/2048.0>2147483647-1-16) {
fprintf(stderr,
"cdrskin: FATAL : ISO-9660 filesystem in terabyte size detected\n");
{ret= 0; goto ex;}
}
*size= size_in_bytes/2048.0;
if(size_in_bytes-((double) *size)*2048.0>0.0)
(*size)++;
if((*size)%16)
*size+= 16-((*size)%16);
if(skin->grow_overwriteable_iso==1)
skin->grow_overwriteable_iso= 2;
ret= 1;
ex:;
return(ret);
#else /* Cdrskin_libburn_has_random_access_rW */
return(-1);
#endif
}
int Cdrskin_invalidate_iso_head(struct CdrskiN *skin, int flag)
{
int ret;
int size;
fprintf(stderr,
"cdrskin: blank=... : invalidating ISO-9660 head on overwriteable media\n");
ret= Cdrskin_overwriteable_iso_size(skin,&size,0);
if(ret<=0) {
fprintf(stderr,
"cdrskin: NOTE : Not an ISO-9660 file system. Left unaltered.\n");
return(2);
}
skin->overwriteable_iso_head[16*2048]=
skin->overwriteable_iso_head[16*2048+3]=
skin->overwriteable_iso_head[16*2048+4]= 'x';
ret= burn_random_access_write(skin->grabbed_drive,(off_t) 16*2048,
skin->overwriteable_iso_head+16*2048,
(off_t) 16*2048,1);
return(ret);
}
/** Report media status s to the user
@param flag Bitfield for control purposes:
bit0= permission to check for overwriteable ISO image
*/
int Cdrskin_report_disc_status(struct CdrskiN *skin, enum burn_disc_status s,
int flag)
{
int ret, iso_size;
if(flag&1) {
if(skin->media_is_overwriteable && skin->grow_overwriteable_iso>0) {
if(skin->grow_overwriteable_iso==2)
ret= 1;
else
ret= Cdrskin_overwriteable_iso_size(skin,&iso_size,0);
if(ret>0)
s= BURN_DISC_APPENDABLE;
}
}
printf("cdrskin: status %d ",s);
if(s==BURN_DISC_FULL) {
printf("burn_disc_full \"There is a disc with data on it in the drive\"\n");
@ -3951,77 +4039,6 @@ int Cdrskin_obtain_nwa(struct CdrskiN *skin, int *nwa, int flag)
}
/** Read and buffer the start of an existing ISO-9660 image from
overwriteable target media.
*/
int Cdrskin_overwriteable_iso_size(struct CdrskiN *skin, int *size, int flag)
{
#ifdef Cdrskin_libburn_has_random_access_rW
int ret;
off_t data_count= 0;
double size_in_bytes;
char *buf;
buf= skin->overwriteable_iso_head;
if(!skin->media_is_overwriteable)
{ret= 0; goto ex;}
/* Read first 64 kB */
ret= burn_read_data(skin->grabbed_drive,(off_t) 0,buf,32*2048,&data_count,0);
if(ret<=0)
{ret= 0; goto ex;}
ret= Scan_for_iso_size((unsigned char *) (buf+16*2048), &size_in_bytes,0);
if(ret<=0) {
if(skin->verbosity>=Cdrskin_verbose_debuG)
ClN(fprintf(stderr,"cdrskin_debug: No detectable ISO-9660 size on media\n"));
{ret= 0; goto ex;}
}
if(skin->verbosity>=Cdrskin_verbose_debuG)
ClN(fprintf(stderr,"cdrskin_debug: detected ISO-9660 size : %.f (%fs)\n",
size_in_bytes, size_in_bytes/2048.0));
if(size_in_bytes/2048.0>2147483647-1-16) {
fprintf(stderr,
"cdrskin: FATAL : ISO-9660 filesystem in terabyte size detected\n");
{ret= 0; goto ex;}
}
*size= size_in_bytes/2048.0;
if(size_in_bytes-((double) *size)*2048.0>0.0)
(*size)++;
if((*size)%16)
*size+= 16-((*size)%16);
skin->grow_overwriteable_iso= 2;
ret= 1;
ex:;
return(ret);
#else /* Cdrskin_libburn_has_random_access_rW */
return(-1);
#endif
}
int Cdrskin_invalidate_iso_head(struct CdrskiN *skin, int flag)
{
int ret;
int size;
fprintf(stderr,
"cdrskin: blank=... : invalidating ISO-9660 head on overwriteable media\n");
ret= Cdrskin_overwriteable_iso_size(skin,&size,0);
if(ret<=0) {
fprintf(stderr,
"cdrskin: NOTE : Not an ISO-9660 file system. Left unaltered.\n");
return(2);
}
skin->overwriteable_iso_head[16*2048]= 0;
skin->overwriteable_iso_head[16*2048+3]=
skin->overwriteable_iso_head[16*2048+4]= 'x';
ret= burn_random_access_write(skin->grabbed_drive,(off_t) 16*2048,
skin->overwriteable_iso_head+16*2048,
(off_t) 16*2048,1);
return(ret);
}
/** Perform -toc under control of Cdrskin_atip().
@param flag Bitfield for control purposes:
bit0= do not list sessions separately (do it cdrecord style)
@ -4158,7 +4175,7 @@ int Cdrskin_atip(struct CdrskiN *skin, int flag)
return(ret);
drive= skin->drives[skin->driveno].drive;
s= burn_disc_get_status(drive);
Cdrskin_report_disc_status(skin,s,0);
Cdrskin_report_disc_status(skin,s,1);
if(s==BURN_DISC_APPENDABLE && skin->no_blank_appendable) {
is_not_really_erasable= 1;
} else if(s==BURN_DISC_EMPTY) {
@ -4442,7 +4459,7 @@ int Cdrskin_blank(struct CdrskiN *skin, int flag)
#endif
if(skin->verbosity>=Cdrskin_verbose_progresS)
Cdrskin_report_disc_status(skin,s,0);
Cdrskin_report_disc_status(skin,s,1);
do_format= skin->blank_format_type & 0xff;
if(do_format == 1) {
verb= "format";
@ -4468,8 +4485,12 @@ int Cdrskin_blank(struct CdrskiN *skin, int flag)
/* Forceful blanking to Sequential Recording for DVD-R[W] and CD-RW */
if(!(profile_number == 0x14 || profile_number == 0x13 ||
profile_number == 0x0a))
goto unsupported_format_type;
profile_number == 0x0a)) {
if(skin->grow_overwriteable_iso>0 && skin->media_is_overwriteable)
goto pseudo_blank_ov;
else
goto unsupported_format_type;
}
} else if (do_format==1) {
/* Formatting to become overwriteable for DVD-RW and DVD+RW */
@ -4505,7 +4526,8 @@ int Cdrskin_blank(struct CdrskiN *skin, int flag)
} else if(do_format==0) {
/* Classical blanking of erasable media */
if(skin->grow_overwriteable_iso > 0 && skin->media_is_overwriteable) {
if(skin->grow_overwriteable_iso>0 && skin->media_is_overwriteable) {
pseudo_blank_ov:;
if(skin->dummy_mode) {
fprintf(stderr,
"cdrskin: would have begun to pseudo-blank disc if not in -dummy mode\n");
@ -5449,6 +5471,8 @@ int Cdrskin_grow_overwriteable_iso(struct CdrskiN *skin, int flag)
fprintf(stderr,"cdrskin: SORRY : No recognizable ISO-9660 on media\n");
return(0);
}
if(skin->write_start_address>=0.0)
media_size= skin->write_start_address;
/* Write new sum into media descr 0 */
md= skin->overwriteable_iso_head+16*2048;
@ -5534,7 +5558,7 @@ int Cdrskin_burn(struct CdrskiN *skin, int flag)
drive= skin->drives[skin->driveno].drive;
s= burn_disc_get_status(drive);
if(skin->verbosity>=Cdrskin_verbose_progresS)
Cdrskin_report_disc_status(skin,s,0);
Cdrskin_report_disc_status(skin,s,1);
#ifndef Cdrskin_libburn_write_mode_ruleS
@ -6007,8 +6031,10 @@ int Cdrskin_msinfo(struct CdrskiN *skin, int flag)
if(skin->grow_overwriteable_iso==1 || skin->grow_overwriteable_iso==2) {
lba= 0;
ret= Cdrskin_overwriteable_iso_size(skin,&nwa,0);
if(ret>0)
if(ret>0) {
s= BURN_DISC_APPENDABLE;
goto put_out;
}
}
Cdrskin_report_disc_status(skin,s,0);
fprintf(stderr,"cdrskin: FATAL : -msinfo can only operate on appendable (i.e. -multi) discs\n");

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2007.08.26.200829"
#define Cdrskin_timestamP "2007.08.28.143057"