Refusing to burn if foreseeable size exceeds media capacity

This commit is contained in:
Thomas Schmitt 2011-01-09 13:59:19 +00:00
parent aea5cc33cf
commit 9cde8b2601
3 changed files with 33 additions and 14 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 "Aug 21, 2010" .TH CDRSKIN 1 "Jan 09, 2011"
.\" 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:
@ -554,6 +554,9 @@ which appear to be in the desired blank or format state already.
This option enables a burn run with option -dummy even if libburn believes This option enables a burn run with option -dummy even if libburn believes
that drive and media will not simulate the write mode but will write for real. that drive and media will not simulate the write mode but will write for real.
.br .br
It enables a burn run where cdrskin expects to exceed the available media
capacity.
.br
.B Caution: .B Caution:
Use this only when in urgent need. Use this only when in urgent need.
.TP .TP

View File

@ -1,6 +1,6 @@
/* /*
cdrskin.c , Copyright 2006-2010 Thomas Schmitt <scdbackup@gmx.net> cdrskin.c , Copyright 2006-2011 Thomas Schmitt <scdbackup@gmx.net>
Provided under GPL version 2 or later. Provided under GPL version 2 or later.
A cdrecord compatible command line interface for libburn. A cdrecord compatible command line interface for libburn.
@ -7081,6 +7081,10 @@ int Cdrskin_burn(struct CdrskiN *skin, int flag)
double put_counter, get_counter, empty_counter, full_counter; double put_counter, get_counter, empty_counter, full_counter;
int total_min_fill, fifo_percent; int total_min_fill, fifo_percent;
#endif #endif
#ifdef Cdrskin_libburn_has_get_spacE
off_t free_space;
char msg[80];
#endif
if(skin->tell_media_space) if(skin->tell_media_space)
doing= "estimating"; doing= "estimating";
@ -7324,17 +7328,12 @@ burn_failed:;
/* write capacity estimation and return without actual burning */ /* write capacity estimation and return without actual burning */
#ifdef Cdrskin_libburn_has_get_spacE #ifdef Cdrskin_libburn_has_get_spacE
{
off_t free_space;
char msg[80];
free_space= burn_disc_available_space(drive,o); free_space= burn_disc_available_space(drive,o);
sprintf(msg,"%d\n",(int) (free_space/(off_t) 2048)); sprintf(msg,"%d\n",(int) (free_space/(off_t) 2048));
if(skin->preskin->result_fd>=0) { if(skin->preskin->result_fd>=0) {
write(skin->preskin->result_fd,msg,strlen(msg)); write(skin->preskin->result_fd,msg,strlen(msg));
} else } else
printf("%s",msg); printf("%s",msg);
}
#endif /* Cdrskin_libburn_has_get_spacE */ #endif /* Cdrskin_libburn_has_get_spacE */
if(skin->track_counter>0) if(skin->track_counter>0)
@ -7344,6 +7343,23 @@ burn_failed:;
{ret= 1; goto ex;} {ret= 1; goto ex;}
} }
#ifdef Cdrskin_libburn_has_get_spacE
if(skin->fixed_size > 0 && !skin->force_is_set) {
free_space= burn_disc_available_space(drive,o);
if(skin->fixed_size > free_space && free_space > 0) {
fprintf(stderr,
"cdrskin: FATAL : predicted session size %lus does not fit on media (%lus)\n",
(unsigned long) ((skin->fixed_size + 2047.0) / 2048.0),
(unsigned long) ((free_space + 2047) / 2048));
ClN(fprintf(stderr,
"cdrskin: HINT : This test may be disabled by option -force\n");)
{ret= 0; goto ex;}
}
}
#endif /* Cdrskin_libburn_has_get_spacE */
Cdrskin_adjust_speed(skin,0); Cdrskin_adjust_speed(skin,0);
#ifndef Cdrskin_extra_leaN #ifndef Cdrskin_extra_leaN

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2011.01.03.195125" #define Cdrskin_timestamP "2011.01.09.135915"