diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index b53d247..215c9c4 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2009.11.18.185733" +#define Cdrskin_timestamP "2009.11.20.134952" diff --git a/libburn/libburn.h b/libburn/libburn.h index 5ea49ae..16d9b19 100644 --- a/libburn/libburn.h +++ b/libburn/libburn.h @@ -2831,4 +2831,11 @@ int burn_drive_probe_cd_write_modes(struct burn_drive_info *drive_info) #endif /* Libburn_pioneer_dvr_216d_dummy_probe_wM */ +/* ts A91120 */ +/* Allocate write buffer via mmap() rather than calloc() and use flag + SG_FLAG_DIRECT_IO when running ioctl(SG_IO). +#define Libburn_mmap_write_buffeR 1 +*/ + + #endif /*LIBBURN_H*/ diff --git a/libburn/sg-linux.c b/libburn/sg-linux.c index 7322554..5609f8f 100644 --- a/libburn/sg-linux.c +++ b/libburn/sg-linux.c @@ -2,8 +2,10 @@ /* <<< ts A91112 : experiments to get better speed with USB -#define Libburn_sgio_as_growisofS 1 */ +#ifdef Libburn_mmap_write_buffeR +#define Libburn_sgio_as_growisofS 1 +#endif /* diff --git a/libburn/write.c b/libburn/write.c index f5d0559..47d961e 100644 --- a/libburn/write.c +++ b/libburn/write.c @@ -50,6 +50,12 @@ extern struct libdax_msgs *libdax_messenger; +/* ts A91120 : <<< experimental */ +#ifdef Libburn_mmap_write_buffeR +#include +#endif + + /* The maximum output size to be used with CD media. This is also curbed by BURN_OS_TRANSPORT_BUFFER_SIZE. The smaller number gets into effect. */ @@ -2307,6 +2313,11 @@ void burn_disc_write_sync(struct burn_write_opts *o, struct burn_disc *disc) off_t default_size; char msg[80]; +#ifdef Libburn_mmap_write_buffeR + size_t buffer_size; +#endif + + /* ts A60924 : libburn/message.c gets obsoleted burn_message_clear_queue(); */ @@ -2321,9 +2332,21 @@ void burn_disc_write_sync(struct burn_write_opts *o, struct burn_disc *disc) else d->stream_recording_start = 0; +#ifdef Libburn_mmap_write_buffeR + fprintf(stderr, + "libburn_EXPERIMENTAL: allocating write buffer via mmap()\n"); + buffer_size = sizeof(struct buffer); + if (buffer_size % (64 * 1024)) + buffer_size += 64 * 1024 - (buffer_size % (64 * 1024)); + d->buffer = mmap(NULL, buffer_size, PROT_READ | PROT_WRITE, + MAP_SHARED | MAP_ANONYMOUS, -1, (off_t) 0); + if(d->buffer == MAP_FAILED) + goto fail_wo_sync; +#else d->buffer = calloc(sizeof(struct buffer), 1); if (d->buffer == NULL) goto fail_wo_sync; +#endif /* ! Libburn_mmap_write_buffeR */ /* >>> ts A90321 @@ -2546,7 +2569,11 @@ fail_wo_sync:; ex:; d->do_stream_recording = 0; if (d->buffer != NULL) +#ifdef Libburn_mmap_write_buffeR + munmap(d->buffer, buffer_size); +#else free((char *) d->buffer); +#endif d->buffer = buffer_mem; return; }