"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "libburn/write.c" between
xorriso-1.5.2.tar.gz and xorriso-1.5.4.tar.gz

About: GNU xorriso creates, loads, manipulates and writes ISO 9660 filesystem images with Rock Ridge extensions. It is suitable for incremental data backup and for production of bootable ISO 9660 images. GNU xorriso is a statical compilation of the libraries libburn, libisofs, libisoburn, and libjte.

write.c  (xorriso-1.5.2):write.c  (xorriso-1.5.4)
skipping to change at page 5, line ? skipping to change at page 5, line ?
#else /* Libburn_track_multi_indeX */ #else /* Libburn_track_multi_indeX */
if (i == 0) { if (i == 0) {
ret = add_cue(sheet, ctladr | 1, session->firsttrack, ret = add_cue(sheet, ctladr | 1, session->firsttrack,
0, form, 0, runtime); 0, form, 0, runtime);
if (ret <= 0) if (ret <= 0)
goto failed; goto failed;
runtime += 150; runtime += 150;
} else if (pform != form) { } else if (pform != form) {
/* ts A70121 : This seems to be thw wrong test. Correct would /* ts A70121 : This seems to be the wrong test. Correct would
be to compare tar[]->mode or bit2 of ctladr. be to compare tar[]->mode or bit2 of ctladr.
*/ */
ret = add_cue(sheet, ctladr | 1, ret = add_cue(sheet, ctladr | 1,
i + session->firsttrack, 0, form, scms, i + session->firsttrack, 0, form, scms,
runtime); runtime);
if (ret <= 0) if (ret <= 0)
goto failed; goto failed;
runtime += 150; runtime += 150;
skipping to change at page 5, line ? skipping to change at page 5, line ?
struct burn_track *t = s->track[tnum]; struct burn_track *t = s->track[tnum];
struct burn_drive *d = o->drive; struct burn_drive *d = o->drive;
struct buffer *out = d->buffer; struct buffer *out = d->buffer;
int sectors; int sectors;
int i, open_ended = 0, ret= 0, is_flushed = 0, track_open = 0; int i, open_ended = 0, ret= 0, is_flushed = 0, track_open = 0;
int first_buf_cap = 0, further_cap = 0, buf_cap_step = 1024; int first_buf_cap = 0, further_cap = 0, buf_cap_step = 1024;
/* ts A70213 : eventually expand size of track to max */ /* ts A70213 : eventually expand size of track to max */
burn_track_apply_fillup(t, d->media_capacity_remaining, 0); burn_track_apply_fillup(t, d->media_capacity_remaining, 0);
/* ts C00806 : Consider the track state changed by try to open */
d->medium_state_changed = 1;
if (d->current_profile == 0x11 || d->current_profile == 0x14 || if (d->current_profile == 0x11 || d->current_profile == 0x14 ||
d->current_profile == 0x15) { d->current_profile == 0x15) {
/* DVD-R, DVD-RW Sequential, DVD-R/DL Sequential */ /* DVD-R, DVD-RW Sequential, DVD-R/DL Sequential */
ret = burn_disc_open_track_dvd_minus_r(o, s, tnum); ret = burn_disc_open_track_dvd_minus_r(o, s, tnum);
if (ret <= 0) if (ret <= 0)
goto ex; goto ex;
/* Pioneer DVR-216D rev 1.09 hates multiple buffer inquiries /* Pioneer DVR-216D rev 1.09 hates multiple buffer inquiries
before the drive buffer is full. before the drive buffer is full.
*/ */
first_buf_cap = 0; first_buf_cap = 0;
skipping to change at page 5, line ? skipping to change at page 5, line ?
if (d->current_profile == 0x41 && d->status == BURN_DISC_APPENDABLE && if (d->current_profile == 0x41 && d->status == BURN_DISC_APPENDABLE &&
d->state_of_last_session == 1) { d->state_of_last_session == 1) {
/* last session on BD-R is still open */; /* last session on BD-R is still open */;
/* BR-R were not closed by libburn-0.6.0.pl00 if o->multi==0. /* BR-R were not closed by libburn-0.6.0.pl00 if o->multi==0.
This leads to an unreadable, but recoverable) media state. This leads to an unreadable, but recoverable) media state.
Technically they are appendable although the last session Technically they are appendable although the last session
is not readable. is not readable.
By default the open session gets closed here before the new By default the open session gets closed here before the new
session is written. E.g. after writing a small dummy seesion session is written. E.g. after writing a small dummy session
number 2 one can read session 1 and write session 3 which number 2 one can read session 1 and write session 3 which
points to data of session 1. points to data of session 1.
For the case that no media with 3 sessions is desired it is For the case that no media with 3 sessions is desired it is
possible to activate the following coarse single-session possible to activate the following coarse single-session
closing code: closing code:
No new session will be written but calling programs will No new session will be written but calling programs will
report success. Quite misleading. report success. Quite misleading.
Activate only if really needed by Activate only if really needed by
# define Libburn_bug_A90108_close_disC yes # define Libburn_bug_A90108_close_disC yes
skipping to change at line 2709 skipping to change at line 2712
return ret; return ret;
} }
/* ts A70911 : to be used as burn_drive.sync_cache(), /* ts A70911 : to be used as burn_drive.sync_cache(),
emulating mmc_sync_cache() */ emulating mmc_sync_cache() */
void burn_stdio_mmc_sync_cache(struct burn_drive *d) void burn_stdio_mmc_sync_cache(struct burn_drive *d)
{ {
burn_stdio_sync_cache(d->stdio_fd, d, 0); burn_stdio_sync_cache(d->stdio_fd, d, 0);
} }
/* ts A70912 */ /* ts C00824 : API */
/* Enforces eventual nominal write speed. /* Enforces nominal write speed */
@param flag bit0= initialize *prev_time */ int burn_nominal_slowdown(int kb_per_second, int max_corr,
int burn_stdio_slowdown(struct burn_drive *d, struct timeval *prev_time, struct timeval *prev_time,
int amount, int flag) int *us_corr, off_t b_since_prev, int flag)
{ {
struct timeval tnow; struct timeval tnow;
double to_wait; double to_wait, goal, corr;
int abs_max_corr;
if (flag & 1) { if (flag & 1) {
gettimeofday(prev_time, NULL); gettimeofday(prev_time, NULL);
*us_corr = 0;
return 1; return 1;
} }
if(d->nominal_write_speed <= 0) if (kb_per_second <= 0)
return 2; return 2;
if (max_corr < -1.0e9 || max_corr > 1.0e9)
abs_max_corr = 1000000000;
else
abs_max_corr = abs(max_corr);
gettimeofday(&tnow, NULL); gettimeofday(&tnow, NULL);
to_wait = ( ((double) amount) / (double) d->nominal_write_speed ) - goal = ((double) b_since_prev) / 1000.0 / ((double) kb_per_second) +
(double) ( tnow.tv_sec - prev_time->tv_sec ) - ((double) prev_time->tv_sec) +
(double) ( tnow.tv_usec - prev_time->tv_usec ) / 1.0e6 ((double) prev_time->tv_usec) / 1.0e6 +
- 0.001; /* best would be 1 / kernel granularity HZ */ ((double) *us_corr) / 1.0e6 ;
if (to_wait >= 0.0001) { to_wait = goal - ((double) tnow.tv_sec) -
usleep((int) (to_wait * 1000000.0)); ((double) tnow.tv_usec) / 1.0e6;
/* usleep might be restricted to 999999 microseconds */
while (to_wait > 0.0) {
if (to_wait >= 0.5) {
usleep(500000);
to_wait -= 0.5;
} else if (to_wait >= 0.00001) {
usleep((int) (to_wait * 1000000.0));
to_wait = 0.0;
} else {
to_wait = 0.0;
}
} }
gettimeofday(prev_time, NULL); gettimeofday(prev_time, NULL);
corr = (goal - ((double) prev_time->tv_sec) -
((double) prev_time->tv_usec) / 1.0e6) * 1.0e6;
if (corr > abs_max_corr)
*us_corr = abs_max_corr;
else if (corr < -abs_max_corr)
*us_corr = -abs_max_corr;
else
*us_corr = corr;
return 1; return 1;
} }
/* ts A70904 */ /* ts A70904 */
int burn_stdio_write_track(struct burn_write_opts *o, struct burn_session *s, int burn_stdio_write_track(struct burn_write_opts *o, struct burn_session *s,
int tnum, int flag) int tnum, int flag)
{ {
int open_ended, bufsize = 16 * 2048, ret, sectors; int open_ended, bufsize = 16 * 2048, ret, sectors;
struct burn_track *t = s->track[tnum]; struct burn_track *t = s->track[tnum];
struct burn_drive *d = o->drive; struct burn_drive *d = o->drive;
char *buf = NULL; char *buf = NULL;
int i, prev_sync_sector = 0; int i, prev_sync_sector = 0, us_corr = 0, max_corr = 250000;
struct buffer *out = d->buffer; struct buffer *out = d->buffer;
struct timeval prev_time; struct timeval prev_time;
BURN_ALLOC_MEM(buf, char, bufsize); BURN_ALLOC_MEM(buf, char, bufsize);
sectors = burn_track_get_sectors_2(t, 1); sectors = burn_track_get_sectors_2(t, 1);
burn_disc_init_track_status(o, s, t, tnum, sectors); burn_disc_init_track_status(o, s, t, tnum, sectors);
open_ended = burn_track_is_open_ended(t); open_ended = burn_track_is_open_ended(t);
t->end_on_premature_eoi = (o->write_type == BURN_WRITE_TAO); t->end_on_premature_eoi = (o->write_type == BURN_WRITE_TAO);
/* attach stdio emulators for mmc_*() functions */ /* attach stdio emulators for mmc_*() functions */
if (o->simulate) if (o->simulate)
d->write = burn_stdio_mmc_dummy_write; d->write = burn_stdio_mmc_dummy_write;
else else
d->write = burn_stdio_mmc_write; d->write = burn_stdio_mmc_write;
d->do_simulate = o->simulate; d->do_simulate = o->simulate;
d->sync_cache = burn_stdio_mmc_sync_cache; d->sync_cache = burn_stdio_mmc_sync_cache;
burn_stdio_slowdown(d, &prev_time, 0, 1); /* initialize */ /* initialize */
burn_nominal_slowdown(d->nominal_write_speed, max_corr,
&prev_time, &us_corr, (off_t) 0, 1);
for (i = 0; open_ended || i < sectors; i++) { for (i = 0; open_ended || i < sectors; i++) {
/* transact a (CD sized) sector */ /* transact a (CD sized) sector */
if (!sector_data(o, t, 0)) if (!sector_data(o, t, 0))
{ret= 0; goto ex;} {ret= 0; goto ex;}
if (open_ended) if (open_ended)
d->progress.sectors = sectors = d->progress.sector; d->progress.sectors = sectors = d->progress.sector;
if (open_ended || t->end_on_premature_eoi) { if (open_ended || t->end_on_premature_eoi) {
if (burn_track_is_data_done(t)) if (burn_track_is_data_done(t))
break; break;
} }
d->progress.sector++; d->progress.sector++;
/* Flush to disk from time to time */ /* Flush to disk from time to time */
if (d->progress.sector - prev_sync_sector >= if (o->stdio_fsync_size > 0) {
o->stdio_fsync_size && o->stdio_fsync_size > 0) { if (d->progress.sector - prev_sync_sector >=
prev_sync_sector = d->progress.sector; o->stdio_fsync_size) {
if (!o->simulate) if (!o->simulate)
burn_stdio_sync_cache(d->stdio_fd, d, 1); burn_stdio_sync_cache(d->stdio_fd, d,
1);
burn_nominal_slowdown(
d->nominal_write_speed, max_corr,
&prev_time, &us_corr,
(off_t) (d->progress.sector -
prev_sync_sector) *
(off_t) 2048,
0);
prev_sync_sector = d->progress.sector;
}
} else if ((d->progress.sector % 512) == 0) {
burn_nominal_slowdown(d->nominal_write_speed, max_corr,
&prev_time, &us_corr, (off_t) (512 * 2048), 0);
} }
if ((d->progress.sector % 512) == 0)
burn_stdio_slowdown(d, &prev_time, 512 * 2, 0);
} }
/* Pad up buffer to next full o->obs (usually 32 kB) */ /* Pad up buffer to next full o->obs (usually 32 kB) */
if (o->obs_pad && out->bytes > 0 && out->bytes < o->obs) { if (o->obs_pad && out->bytes > 0 && out->bytes < o->obs) {
memset(out->data + out->bytes, 0, o->obs - out->bytes); memset(out->data + out->bytes, 0, o->obs - out->bytes);
out->sectors += (o->obs - out->bytes) / 2048; out->sectors += (o->obs - out->bytes) / 2048;
out->bytes = o->obs; out->bytes = o->obs;
} }
ret = burn_write_flush(o, t); ret = burn_write_flush(o, t);
ret= 1; ret= 1;
skipping to change at line 3017 skipping to change at line 3061
/* ts A61009 */ /* ts A61009 */
if (sheet == NULL) if (sheet == NULL)
goto fail_wo_sync; goto fail_wo_sync;
#ifdef Libburn_write_with_function_print_cuE #ifdef Libburn_write_with_function_print_cuE
print_cue(sheet); print_cue(sheet);
/* goto fail_wo_sync; */ /* goto fail_wo_sync; */
#endif /* Libburn_write_with_function_print_cuE */ #endif /* Libburn_write_with_function_print_cuE */
d->medium_state_changed = 1;
ret = 1; ret = 1;
if (o->write_type == BURN_WRITE_SAO) if (o->write_type == BURN_WRITE_SAO)
ret = d->send_cue_sheet(d, sheet); ret = d->send_cue_sheet(d, sheet);
if (sheet->data != NULL) if (sheet->data != NULL)
free(sheet->data); free(sheet->data);
free(sheet); free(sheet);
if (ret <= 0) if (ret <= 0)
goto fail_wo_sync; goto fail_wo_sync;
/* --- From here on, final sync is needed. --- */ /* --- From here on, final sync is needed. --- */
 End of changes. 15 change blocks. 
24 lines changed or deleted 69 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)