From e65ccb2b5eb0fe9f5eb96a6238d5aaaa667d0899 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Mon, 12 Oct 2009 10:52:37 +0000 Subject: [PATCH 01/62] Made number transition to 0.7.3 --- Makefile.am | 4 +-- README | 26 +++++++++++++++++--- cdrskin/README | 8 +++--- cdrskin/cdrskin.c | 49 +++++++++++-------------------------- cdrskin/cdrskin_eng.html | 44 ++++++++++++++++----------------- cdrskin/cdrskin_timestamp.h | 2 +- cdrskin/compile_cdrskin.sh | 10 ++++---- configure.ac | 17 +++++++------ libburn/libburn.h | 2 +- 9 files changed, 79 insertions(+), 83 deletions(-) diff --git a/Makefile.am b/Makefile.am index ca79ef5..0770096 100644 --- a/Makefile.am +++ b/Makefile.am @@ -108,9 +108,9 @@ test_structest_CPPFLAGS = -Ilibburn test_structest_LDADD = $(libburn_libburn_la_OBJECTS) $(LIBBURN_EXTRALIBS) test_structest_SOURCES = test/structest.c -## cdrskin construction site - ts A60816 - A90507 +## cdrskin construction site - ts A60816 - A91012 cdrskin_cdrskin_CPPFLAGS = -Ilibburn -cdrskin_cdrskin_CFLAGS = -DCdrskin_libburn_0_7_1 +cdrskin_cdrskin_CFLAGS = -DCdrskin_libburn_0_7_3 # cdrskin_cdrskin_LDADD = $(libburn_libburn_la_OBJECTS) $(LIBBURN_EXTRALIBS) # ts A80123, change proposed by Simon Huggins to cause dynamic libburn linking diff --git a/README b/README index d98f042..9c4e7b2 100644 --- a/README +++ b/README @@ -11,7 +11,7 @@ Still containing parts of Libburn. By Derek Foreman and Ben Jansens Copyright (C) 2002-2006 Derek Foreman and Ben Jansens - http://files.libburnia-project.org/releases/libburn-0.7.0.pl00.tar.gz + http://files.libburnia-project.org/releases/libburn-0.7.2.pl00.tar.gz ------------------------------------------------------------------------------ @@ -19,10 +19,10 @@ Copyright (C) 2002-2006 Derek Foreman and Ben Jansens From tarball -Obtain libburn-0.7.0.pl00.tar.gz, take it to a directory of your choice and do: +Obtain libburn-0.7.2.pl00.tar.gz, take it to a directory of your choice and do: - tar xzf libburn-0.7.0.pl00.tar.gz - cd libburn-0.7.0 + tar xzf libburn-0.7.2.pl00.tar.gz + cd libburn-0.7.2 ./configure --prefix=/usr make @@ -425,6 +425,24 @@ Project history as far as known to me: supported profiles. It works around some pitfalls with U3 enhanced memory sticks which emulate a CD-ROM. +- 27 Aug 2009 libisoburn-0.4.0.pl00 can record MD5 checksums by which one may + verify the session or single data files in the image. When comparing image + files with files in the local filesystem, the MD5 sums avoid the need for + reading file content from the image. + +- 22 Sep 2009 libisoburn-0.4.0.pl01 fixes a bug in xorriso option -cut_out. + +- 08 Oct 2009 libisofs-0.6.24 fixes a bug which could cause the loss of blanks + in file names when a new session got added to an ISO image. With names + shorter than 251 characters this happened only to trailing blanks. + +- 08 Oct 2009 libisoburn-0.4.0.pl02 fixes bugs with xorriso option -for_backup, + with xorrisofs -help, and with xorrecord -help. + +- 12 Oct 2009 libburn-0.7.2 fixes a bug with CD TAO multi-track dummy sessions. + It can retrieve media product info and can process track input which was + prepared for CD-ROM XA Mode 2 Form 1. cdrskin now performs option -minfo. + ------------------------------------------------------------------------------ diff --git a/cdrskin/README b/cdrskin/README index 6f21d17..84ec606 100644 --- a/cdrskin/README +++ b/cdrskin/README @@ -4,7 +4,7 @@ cdrskin. By Thomas Schmitt Integrated sub project of libburnia-project.org but also published via: http://scdbackup.sourceforge.net/cdrskin_eng.html -http://scdbackup.sourceforge.net/cdrskin-0.7.1.tar.gz +http://scdbackup.sourceforge.net/cdrskin-0.7.3.tar.gz Copyright (C) 2006-2009 Thomas Schmitt, provided under GPL version 2. ------------------------------------------------------------------------------ @@ -24,10 +24,10 @@ By using this software you agree to the disclaimer at the end of this text Compilation, First Glimpse, Installation -Obtain cdrskin-0.7.1.tar.gz, take it to a directory of your choice and do: +Obtain cdrskin-0.7.3.tar.gz, take it to a directory of your choice and do: - tar xzf cdrskin-0.7.1.tar.gz - cd cdrskin-0.7.1 + tar xzf cdrskin-0.7.3.tar.gz + cd cdrskin-0.7.3 Within that directory execute: diff --git a/cdrskin/cdrskin.c b/cdrskin/cdrskin.c index 02ec9cb..e8132c2 100644 --- a/cdrskin/cdrskin.c +++ b/cdrskin/cdrskin.c @@ -88,7 +88,7 @@ or /** The official program version */ #ifndef Cdrskin_prog_versioN -#define Cdrskin_prog_versioN "0.7.1" +#define Cdrskin_prog_versioN "0.7.3" #endif /** The official libburn interface revision to use. @@ -101,7 +101,7 @@ or #define Cdrskin_libburn_minoR 7 #endif #ifndef Cdrskin_libburn_micrO -#define Cdrskin_libburn_micrO 1 +#define Cdrskin_libburn_micrO 3 #endif @@ -135,44 +135,42 @@ or #endif /* Cdrskin_libburn_cvs_A60220_tS */ -#ifdef Cdrskin_libburn_0_7_0 -#define Cdrskin_libburn_versioN "0.7.0" +#ifdef Cdrskin_libburn_0_7_2 +#define Cdrskin_libburn_versioN "0.7.2" #define Cdrskin_libburn_from_pykix_svN 1 -#endif /* Cdrskin_libburn_0_7_0 */ +#endif /* Cdrskin_libburn_0_7_2 */ -#ifdef Cdrskin_libburn_0_7_1 -#define Cdrskin_libburn_versioN "0.7.1" +#ifdef Cdrskin_libburn_0_7_3 +#define Cdrskin_libburn_versioN "0.7.3" #define Cdrskin_libburn_from_pykix_svN 1 /* Place novelty switch macros here. Move them down to Cdrskin_libburn_from_pykix_svN on version leap */ -#define Cdrskin_libburn_has_product_iD 1 -#define Cdrskin_libburn_has_cdxa_conV 1 -#endif /* Cdrskin_libburn_0_7_1 */ +#endif /* Cdrskin_libburn_0_7_3 */ #ifndef Cdrskin_libburn_versioN -#define Cdrskin_libburn_0_7_0 -#define Cdrskin_libburn_versioN "0.7.0" +#define Cdrskin_libburn_0_7_2 +#define Cdrskin_libburn_versioN "0.7.2" #define Cdrskin_libburn_from_pykix_svN 1 #endif -#ifdef Cdrskin_libburn_0_7_0 +#ifdef Cdrskin_libburn_0_7_2 #undef Cdrskin_libburn_majoR #undef Cdrskin_libburn_minoR #undef Cdrskin_libburn_micrO #define Cdrskin_libburn_majoR 0 #define Cdrskin_libburn_minoR 7 -#define Cdrskin_libburn_micrO 0 +#define Cdrskin_libburn_micrO 2 #endif -#ifdef Cdrskin_libburn_0_7_1 +#ifdef Cdrskin_libburn_0_7_3 #undef Cdrskin_libburn_majoR #undef Cdrskin_libburn_minoR #undef Cdrskin_libburn_micrO #define Cdrskin_libburn_majoR 0 #define Cdrskin_libburn_minoR 7 -#define Cdrskin_libburn_micrO 1 +#define Cdrskin_libburn_micrO 3 #endif @@ -1615,10 +1613,8 @@ int Cdrtrack_add_to_session(struct CdrtracK *track, int trackno, burn_track_set_default_size(tr, (off_t) track->tao_to_sao_tsize); burn_track_set_byte_swap(tr, (track->track_type==BURN_AUDIO && track->swap_audio_bytes)); -#ifdef Cdrskin_libburn_has_cdxa_conV if(!(track->cdxa_conversion & (1 << 31))) burn_track_set_cdxa_conv(tr, track->cdxa_conversion & 0x7fffffff); -#endif fixed_size= track->fixed_size; if((flag&2) && track->padding>0) { @@ -5270,14 +5266,8 @@ int Cdrskin_atip(struct CdrskiN *skin, int flag) burn_lba_to_msf(end_lba,&m_lo,&s_lo,&f_lo); printf(" ATIP start of lead out: %d (%-2.2d:%-2.2d/%-2.2d)\n", end_lba, m_lo, s_lo, f_lo); - -#ifdef Cdrskin_libburn_has_product_iD - if(current_is_cd) manuf= burn_guess_cd_manufacturer(min, sec, fr, m_lo, s_lo, f_lo, 0); - -#endif /* Cdrskin_libburn_has_product_iD */ - } } #endif /* Cdrskin_libburn_has_get_start_end_lbA */ @@ -5285,8 +5275,6 @@ int Cdrskin_atip(struct CdrskiN *skin, int flag) printf(" 1T speed low: %.f 1T speed high: %.f\n",x_speed_min,x_speed_max); } -#ifdef Cdrskin_libburn_has_product_iD - ret= burn_disc_get_media_id(drive, &product_id, &media_code1, &media_code2, &book_type, 0); if(ret > 0 && (!current_is_cd) && @@ -5294,9 +5282,6 @@ int Cdrskin_atip(struct CdrskiN *skin, int flag) manuf= burn_guess_manufacturer(profile_number, media_code1, media_code2, 0); } - -#endif /* Cdrskin_libburn_has_product_iD */ - if(product_id != NULL) printf("Product Id: %s\n", product_id); if(manuf != NULL) @@ -5312,14 +5297,8 @@ int Cdrskin_atip(struct CdrskiN *skin, int flag) if(book_type != NULL) free(book_type); product_id= media_code1= media_code2= book_type= NULL; - -#ifdef Cdrskin_libburn_has_product_iD ret= burn_disc_get_media_id(drive, &product_id, &media_code1, &media_code2, &book_type, 1); -#else - ret= 0; -#endif /* Cdrskin_libburn_has_product_iD */ - if(ret > 0) { if(profile_number == 0x11 || profile_number == 0x13 || profile_number == 0x14 || profile_number == 0x15) diff --git a/cdrskin/cdrskin_eng.html b/cdrskin/cdrskin_eng.html index b2f64ea..0054848 100644 --- a/cdrskin/cdrskin_eng.html +++ b/cdrskin/cdrskin_eng.html @@ -61,7 +61,7 @@ via SCSI, PATA (aka IDE, ATA), USB, or SATA. GPL software included:
-
libburn-0.7.0
+
libburn-0.7.2
(founded by Derek Foreman and Ben Jansens, developed and maintained since August 2006 by Thomas Schmitt from team of libburnia-project.org) @@ -111,7 +111,7 @@ as listed by option --devices.
Get info about a particular drive or loaded media:
$ cdrskin dev=0,1,0 -checkdrive
$ cdrskin dev=ATA:1,0,0 -v -atip
-
$ cdrskin dev=/dev/hdc -toc
+
$ cdrskin dev=/dev/hdc -minfo
Prepare CD-RW or DVD-RW for re-use, DVD-RAM or BD-RE for first use:
$ cdrskin -v dev=/dev/sg1 blank=as_needed -eject
@@ -193,8 +193,8 @@ Standalone ISO 9660 multi-session CD/DVD/BD tool

Download as source code (see README):
-
cdrskin-0.7.0.pl00.tar.gz -(750 KB). +
cdrskin-0.7.2.pl00.tar.gz +(780 KB).
The cdrskin tarballs are source code identical with libburn releases @@ -243,19 +243,22 @@ cdrskin_0.4.2.pl00-x86-suse9_0-static.tar.gz, (310 KB), -static compiled,

-Enhancements towards previous stable version cdrskin-0.6.8.pl00: +Enhancements towards previous stable version cdrskin-0.7.0.pl00:

    -
  • Adapted to pitfalls of U3 memory sticks which appear as CD-ROM drives
  • -
  • Listing all supported profiles with option -atip -v
  • +
  • Better interpretation of options -mode2, -xa, -xa1, -xa2
  • +
  • New option --xa1-ignore
  • +
  • New -atip report lines "Product Id:" and "Producer:"
  • +
  • Emulation of some -minfo output
-Bug fixes towards cdrskin-0.6.8.pl00: +Bug fixes towards cdrskin-0.7.0.pl00:
    -
  • none
  • +
  • CD TAO sessions with multiple tracks did not work in -dummy mode
@@ -263,22 +266,17 @@ Bug fixes towards cdrskin-0.6.8.pl00:

-

Development snapshot, version 0.7.1 :

-
Enhancements towards current stable version 0.7.0.pl00: +

Development snapshot, version 0.7.3 :

+
Enhancements towards current stable version 0.7.2.pl00:
    -
  • New option --long_toc, now printing media summary at end of TOC
  • -
  • New -atip report lines "Product Id:" and "Producer:"
  • -
  • Emulation of some -minfo output
  • -
  • Better interpretation of options -mode2, -xa, -xa1, -xa2
  • -
  • New option --xa1-ignore
  • -
-
Bug fixes towards cdrskin-0.7.0.pl00: +
Bug fixes towards cdrskin-0.7.2.pl00:
  • none yet
From 0f37170759fce666152d61e1fde2dc7979c86414 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 12 Nov 2009 17:54:06 +0000 Subject: [PATCH 22/62] Made SCSI logger permanent and controllable via API call --- cdrskin/cdrskin_timestamp.h | 2 +- libburn/init.c | 13 ++++++++ libburn/libburn.h | 30 +++++++++++++++--- libburn/sg-linux.c | 63 +++++++++++++++++++++++++++---------- libburn/write.c | 11 ++++--- 5 files changed, 93 insertions(+), 26 deletions(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index 40f1acc..5211c5a 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2009.11.11.105028" +#define Cdrskin_timestamP "2009.11.12.175514" diff --git a/libburn/init.c b/libburn/init.c index 32ecb02..d84e776 100644 --- a/libburn/init.c +++ b/libburn/init.c @@ -75,6 +75,13 @@ burn_abort_handler_t burn_global_signal_handler = NULL; /* ts A70223 : wether implemented untested profiles are supported */ int burn_support_untested_profiles = 0; +/* ts A91111 : + whether to log SCSI commands (to be implemented in sg-*.c) + bit0= log in /tmp/libburn_sg_command_log + bit1= log to stderr + bit2= flush every line +*/ +int burn_sg_log_scsi = 0; /* ts A60925 : ticket 74 */ /** Create the messenger object for libburn. */ @@ -414,3 +421,9 @@ int burn_set_messenger(void *messenger) return 1; } + +/* ts A91111 API */ +void burn_set_scsi_logging(int flag) +{ + burn_sg_log_scsi = flag & 7; +} diff --git a/libburn/libburn.h b/libburn/libburn.h index 3909f33..1a46f9e 100644 --- a/libburn/libburn.h +++ b/libburn/libburn.h @@ -762,6 +762,19 @@ int burn_abort_pacifier(void *handle, int patience, int elapsed); */ void burn_set_verbosity(int level); +/* ts A91111 */ +/** Enable resp. disable logging of SCSI commands (currently Linux only). + This call can be made at any time - even before burn_initialize(). + It is in effect for all active drives and currently not very thread + safe for multiple drives. + @param flag Bitfield for control purposes. The default is 0. + bit0= log to file /tmp/libburn_sg_command_log + bit1= log to stderr + bit2= flush output after each line + @since 0.7.4 +*/ +void burn_set_scsi_logging(int flag); + /* ts A60813 */ /** Set parameters for behavior on opening device files. To be called early after burn_initialize() and before any bus scan. But not mandatory at all. @@ -2772,12 +2785,21 @@ BURN_END_DECLS # define Libburn_pioneer_dvr_216d_get_evenT 1 */ -/* Probing of CD write modes hampers ejecting of the drive tray. - Needed is a more intelligent management of probing. - Note to myself: check whether feature interpretation can replace probing +/* ts A91112 */ +/* Do not probe CD modes but declare only data and audio modes supported. + For other modes resp. real probing one has to call + burn_drive_probe_cd_write_modes(). - # define Libburn_pioneer_dvr_216d_no_probe_wM 1 + # define Libburn_pioneer_dvr_216d_dummy_probe_wM 1 */ +#ifdef Libburn_pioneer_dvr_216d_dummy_probe_wM + +/* Probe available CD write modes and block types. + @param drive_info drive object to be inquired +*/ +int burn_drive_probe_cd_write_modes(struct burn_drive_info *drive_info) + +#endif /* Libburn_pioneer_dvr_216d_dummy_probe_wM */ #endif /*LIBBURN_H*/ diff --git a/libburn/sg-linux.c b/libburn/sg-linux.c index 1ef7822..7322554 100644 --- a/libburn/sg-linux.c +++ b/libburn/sg-linux.c @@ -1,5 +1,11 @@ /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ + +/* <<< ts A91112 : experiments to get better speed with USB +#define Libburn_sgio_as_growisofS 1 +*/ + + /* This is the main operating system dependent SCSI part of libburn. It implements @@ -196,17 +202,25 @@ static void enumerate_common(char *fname, int bus_no, int host_no, /* ts A60813 : storage objects are in libburn/init.c - wether to use O_EXCL with open(2) of devices - wether to use fcntl(,F_SETLK,) after open(2) of devices + whether to use O_EXCL with open(2) of devices + whether to use fcntl(,F_SETLK,) after open(2) of devices what device family to use : 0=default, 1=sr, 2=scd, (3=st), 4=sg - wether to use O_NOBLOCK with open(2) on devices - wether to take O_EXCL rejection as fatal error */ + whether to use O_NOBLOCK with open(2) on devices + whether to take O_EXCL rejection as fatal error +*/ extern int burn_sg_open_o_excl; extern int burn_sg_fcntl_f_setlk; extern int burn_sg_use_family; extern int burn_sg_open_o_nonblock; extern int burn_sg_open_abort_busy; +/* ts A91111 : + whether to log SCSI commands: + bit0= log in /tmp/libburn_sg_command_log + bit1= log to stderr + bit2= flush every line +*/ +extern int burn_sg_log_scsi; /* ts A60821 debug: for tracing calls which might use open drive fds @@ -1642,6 +1656,7 @@ int sg_release(struct burn_drive *d) } +/* <<< ts A91111: on its way out */ /** ts A70518: Debugging log facility. Controlled by existence of macros: Libburn_log_sg_commandS enables logging to file @@ -1650,10 +1665,11 @@ int sg_release(struct burn_drive *d) Libburn_log_sg_command_stderR enables additional log to stderr */ /* + ts A91111: now enabled by default and controlled burn_sg_log_scsi +*/ #define Libburn_log_sg_commandS 1 #define Libburn_fflush_log_sg_commandS 1 #define Libburn_log_sg_command_stderR 1 -*/ #ifdef Libburn_log_sg_commandS @@ -1661,16 +1677,16 @@ int sg_release(struct burn_drive *d) /** Logs command (before execution) */ static int sg_log_cmd(struct command *c, FILE *fp, int flag) { - - if (fp != NULL) { + if (fp != NULL && (fp == stderr || (burn_sg_log_scsi & 1))) { scsi_show_cmd_text(c, fp, 0); #ifdef Libburn_fflush_log_sg_commandS - fflush(fp); + if (burn_sg_log_scsi & 4) + fflush(fp); #endif } #ifdef Libburn_log_sg_command_stderR - if (fp == stderr) + if (fp == stderr || !(burn_sg_log_scsi & 2)) return 1; sg_log_cmd(c, stderr, flag); #endif @@ -1683,7 +1699,7 @@ static int sg_log_err(struct command *c, FILE *fp, sg_io_hdr_t *s, int flag) { - if(fp!=NULL) { + if(fp != NULL && (fp == stderr || (burn_sg_log_scsi & 1))) { if(flag & 1) { fprintf(fp, "+++ key=%X asc=%2.2Xh ascq=%2.2Xh (%6d ms)\n", @@ -1693,11 +1709,12 @@ static int sg_log_err(struct command *c, FILE *fp, fprintf(fp,"%6d ms\n", s->duration); } #ifdef Libburn_fflush_log_sg_commandS - fflush(fp); + if (burn_sg_log_scsi & 4) + fflush(fp); #endif } #ifdef Libburn_log_sg_command_stderR - if (fp == stderr) + if (fp == stderr || !(burn_sg_log_scsi & 2)) return 1; sg_log_err(c, stderr, s, flag); #endif @@ -1738,11 +1755,15 @@ int sg_issue_command(struct burn_drive *d, struct command *c) #ifdef Libburn_log_sg_commandS /* ts A61030 */ - if(fp==NULL) { - fp= fopen("/tmp/libburn_sg_command_log","a"); - fprintf(fp,"\n-----------------------------------------\n"); + if (burn_sg_log_scsi & 1) { + if (fp == NULL) { + fp= fopen("/tmp/libburn_sg_command_log", "a"); + fprintf(fp, + "\n-----------------------------------------\n"); + } } - sg_log_cmd(c,fp,0); + if (burn_sg_log_scsi & 3) + sg_log_cmd(c,fp,0); #endif /* Libburn_log_sg_commandS */ @@ -1757,6 +1778,13 @@ int sg_issue_command(struct burn_drive *d, struct command *c) s.interface_id = 'S'; +#ifdef Libburn_sgio_as_growisofS + /* ??? ts A91112 : does this speed up USB ? (from growisofs) + --- did not help + */ + s.flags = SG_FLAG_DIRECT_IO; +#endif /* Libburn_sgio_as_growisofS */ + if (c->dir == TO_DRIVE) s.dxfer_direction = SG_DXFER_TO_DEV; else if (c->dir == FROM_DRIVE) @@ -1879,7 +1907,8 @@ ex:; } #ifdef Libburn_log_sg_commandS - sg_log_err(c, fp, &s, c->error != 0); + if (burn_sg_log_scsi & 3) + sg_log_err(c, fp, &s, c->error != 0); #endif /* Libburn_log_sg_commandS */ return 1; diff --git a/libburn/write.c b/libburn/write.c index c9a4eda..a89247a 100644 --- a/libburn/write.c +++ b/libburn/write.c @@ -1255,7 +1255,7 @@ int burn_dvd_write_track(struct burn_write_opts *o, struct buffer *out = d->buffer; int sectors; int i, open_ended = 0, ret= 0, is_flushed = 0; - int first_buf_cap = 0, further_cap = 0; + int first_buf_cap = 0, further_cap = 0, buf_cap_step = 256; /* ts A70213 : eventually expand size of track to max */ burn_track_apply_fillup(t, d->media_capacity_remaining, 0); @@ -1314,7 +1314,8 @@ int burn_dvd_write_track(struct burn_write_opts *o, before the drive buffer is full. See above DVD- */ if (i == first_buf_cap || - ((i % 256) == 0 && (i >= further_cap || further_cap < 0))) { + ((i % buf_cap_step) == 0 && + (i >= further_cap || further_cap < 0))) { d->read_buffer_capacity(d); if (further_cap < 0) further_cap = @@ -1787,8 +1788,10 @@ int burn_dvd_write_sync(struct burn_write_opts *o, /* <<< test only : Does this increase effective speed with USB ? ts A90801 : 64kB: speed with 16x DVD-R is 12 rather than 8 - >>> next try is 128 kB - o->obs = 128 * 1024; + 128kB: glibc complains about double free + BURN_OS_TRANSPORT_BUFFER_SIZE would need to + be enlarged anyway. + o->obs = 64 * 1024; */ From 9160b1dcbb587a4fc852307aedde564e7f52a308 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 12 Nov 2009 17:56:18 +0000 Subject: [PATCH 23/62] Workaround for Pioneer DVR-216D refusal to eject --- cdrskin/cdrskin_timestamp.h | 2 +- libburn/mmc.c | 6 +++++ libburn/sbc.c | 45 +++++++++++++++++++++++-------------- libburn/spc.c | 11 --------- 4 files changed, 35 insertions(+), 29 deletions(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index 5211c5a..f3aaf37 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2009.11.12.175514" +#define Cdrskin_timestamP "2009.11.12.175735" diff --git a/libburn/mmc.c b/libburn/mmc.c index 4c7f702..d715be4 100644 --- a/libburn/mmc.c +++ b/libburn/mmc.c @@ -245,8 +245,14 @@ int mmc_function_spy(struct burn_drive *d, char * text) d->cancel = 1; return 0; } + + /* >>> should one rather have a positve list ? */ + if (d->is_stopped && strcmp(text, "stop_unit") != 0 && + strcmp(text, "eject") != 0 && strcmp(text, "start_unit") != 0 && + strcmp(text, "load") != 0 && + strncmp(text, "enumerate", 9) != 0 && strncmp(text, "sg_", 3) != 0) { d->start_unit(d); d->is_stopped = 0; diff --git a/libburn/sbc.c b/libburn/sbc.c index 3e005dd..08c0350 100644 --- a/libburn/sbc.c +++ b/libburn/sbc.c @@ -31,11 +31,6 @@ void sbc_load(struct burn_drive *d) return; scsi_init_command(&c, SBC_LOAD, sizeof(SBC_LOAD)); -/* - memcpy(c.opcode, SBC_LOAD, sizeof(SBC_LOAD)); - c.oplen = sizeof(SBC_LOAD); - c.page = NULL; -*/ c.retry = 1; /* ts A70921 : Had to revoke Immed because of LG GSA-4082B */ @@ -59,14 +54,7 @@ void sbc_eject(struct burn_drive *d) return; scsi_init_command(&c, SBC_UNLOAD, sizeof(SBC_UNLOAD)); -/* - memcpy(c.opcode, SBC_UNLOAD, sizeof(SBC_UNLOAD)); - c.oplen = sizeof(SBC_UNLOAD); - c.page = NULL; -*/ - c.opcode[1] |= 1; /* ts A70918 : Immed */ - c.page = NULL; c.dir = NO_TRANSFER; d->issue_command(d, &c); @@ -76,8 +64,11 @@ void sbc_eject(struct burn_drive *d) spc_wait_unit_attention(d, 1800, "STOP UNIT (+ EJECT)", 0); } -/* ts A61118 : is it necessary to tell the drive to get ready for use ? */ -int sbc_start_unit(struct burn_drive *d) + +/* ts A91112 : Now with flag */ +/* @param flag bit0= asynchronous waiting +*/ +int sbc_start_unit_flag(struct burn_drive *d, int flag) { struct command c; int ret; @@ -87,17 +78,37 @@ int sbc_start_unit(struct burn_drive *d) scsi_init_command(&c, SBC_START_UNIT, sizeof(SBC_START_UNIT)); c.retry = 1; - c.opcode[1] |= 1; /* ts A70918 : Immed */ + c.opcode[1] |= (flag & 1); /* ts A70918 : Immed */ c.dir = NO_TRANSFER; d->issue_command(d, &c); if (c.error) return 0; - /* ts A70918 : now asynchronous */ - d->is_stopped = 0; + if (!(flag & 1)) + return 1; + /* ts A70918 : asynchronous */ ret = spc_wait_unit_attention(d, 1800, "START UNIT", 0); return ret; } + +int sbc_start_unit(struct burn_drive *d) +{ + int ret; + + d->is_stopped = 0; /* no endless starting attempts */ + + /* Asynchronous, not to block controller by waiting */ + ret = sbc_start_unit_flag(d, 1); + if (ret <= 0) + return ret; + /* Synchronous to catch Pioneer DVD-216D which is ready too early. + A pending START UNIT can prevent ejecting of the tray. + */ + ret = sbc_start_unit_flag(d, 0); + return ret; +} + + /* ts A90824 : Trying to reduce drive noise */ int sbc_stop_unit(struct burn_drive *d) { diff --git a/libburn/spc.c b/libburn/spc.c index ec8e1ba..b3543bb 100644 --- a/libburn/spc.c +++ b/libburn/spc.c @@ -761,14 +761,6 @@ void spc_probe_write_modes(struct burn_drive *d) c.page->data[23] = 150; c.dir = TO_DRIVE; -#ifdef Libburn_pioneer_dvr_216d_no_probe_wM - - key = asc = ascq = 0; - if (last_try) - break; - -#else /* Libburn_pioneer_dvr_216d_no_probe_wM */ - d->silent_on_scsi_error = 1; d->issue_command(d, &c); d->silent_on_scsi_error = 0; @@ -779,9 +771,6 @@ void spc_probe_write_modes(struct burn_drive *d) key = c.sense[2]; asc = c.sense[12]; ascq = c.sense[13]; - -#endif /* ! Libburn_pioneer_dvr_216d_no_probe_wM */ - if (key) burn_print(7, "%d not supported\n", try_block_type); else { From 055876d6b7b92f7ff565b8a51063192a55e63826 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 12 Nov 2009 18:00:01 +0000 Subject: [PATCH 24/62] Macro Libburn_pioneer_dvr_216d_dummy_probe_wM for omitting write mode probe --- cdrskin/cdrskin_timestamp.h | 2 +- libburn/drive.c | 43 +++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index f3aaf37..d6ad6e9 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2009.11.12.175735" +#define Cdrskin_timestamP "2009.11.12.180048" diff --git a/libburn/drive.c b/libburn/drive.c index b986b71..6cd4aa0 100644 --- a/libburn/drive.c +++ b/libburn/drive.c @@ -910,6 +910,22 @@ static int drive_getcaps(struct burn_drive *d, struct burn_drive_info *out) out->write_simulate = !!d->mdata->simulate; out->c2_errors = !!d->mdata->c2_pointers; out->drive = d; + +#ifdef Libburn_pioneer_dvr_216d_dummy_probe_wM + + /* ts A91112 */ + /* Set default block types. The call d->probe_write_modes() is quite + obtrusive. It may be performed explicitely by new API call + burn_drive_probe_cd_write_modes(). + */ + out->tao_block_types = d->block_types[BURN_WRITE_TAO] = + BURN_BLOCK_MODE1 | BURN_BLOCK_RAW0; + out->sao_block_types = d->block_types[BURN_WRITE_SAO] = BURN_BLOCK_SAO; + out->raw_block_types = d->block_types[BURN_WRITE_RAW] = 0; + out->packet_block_types = 0; + +#else /* Libburn_pioneer_dvr_216d_dummy_probe_wM */ + /* update available block types for burners */ if (out->write_dvdram || out->write_dvdr || out->write_cdrw || out->write_cdr) @@ -918,10 +934,37 @@ static int drive_getcaps(struct burn_drive *d, struct burn_drive_info *out) out->sao_block_types = d->block_types[BURN_WRITE_SAO]; out->raw_block_types = d->block_types[BURN_WRITE_RAW]; out->packet_block_types = d->block_types[BURN_WRITE_PACKET]; + +#endif /* ! Libburn_pioneer_dvr_216d_dummy_probe_wM */ + return 1; } +#ifdef Libburn_pioneer_dvr_216d_dummy_probe_wM + +/* ts A91112 candidate for API */ +/* Probe available CD write modes and block types. +*/ +int burn_drive_probe_cd_write_modes(struct burn_drive_info *dinfo) +{ + struct burn_drive *d = dinfo->drive; + + if (d == NULL) + return 0; + if (dinfo->write_dvdram || dinfo->write_dvdr || + dinfo->write_cdrw || dinfo->write_cdr) + d->probe_write_modes(d); + dinfo->tao_block_types = d->block_types[BURN_WRITE_TAO]; + dinfo->sao_block_types = d->block_types[BURN_WRITE_SAO]; + dinfo->raw_block_types = d->block_types[BURN_WRITE_RAW]; + dinfo->packet_block_types = d->block_types[BURN_WRITE_PACKET]; + return 1; +} + +#endif /* Libburn_pioneer_dvr_216d_dummy_probe_wM */ + + /* ts A70907 : added parameter flag */ /* @param flag bit0= reset global drive list */ int burn_drive_scan_sync(struct burn_drive_info *drives[], From ca2cae9b0aaa4482e5ae3fb0c0c1da345b01dc74 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 12 Nov 2009 18:01:26 +0000 Subject: [PATCH 25/62] Implemented option -V for logging of SCSI commands --- cdrskin/cdrskin.c | 10 +++++++++- cdrskin/cdrskin_timestamp.h | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cdrskin/cdrskin.c b/cdrskin/cdrskin.c index 5b6a543..26eb939 100644 --- a/cdrskin/cdrskin.c +++ b/cdrskin/cdrskin.c @@ -2136,6 +2136,8 @@ int Cdrpreskin_fallback(struct CdrpreskiN *preskin, int argc, char **argv, int i, wp= 1; char *ept, *upt; + if(preskin->fallback_program[0] == 0) + return(1); if(getuid()!=geteuid() && !preskin->allow_setuid) { fprintf(stderr, "cdrskin: SORRY : uid and euid differ. Will not start external fallback program.\n"); @@ -2914,12 +2916,16 @@ see_cdrskin_eng_html:; } else if(strcmp(argv[i],"-tao")==0) { strcpy(o->write_mode_name,"TAO"); + } else if(strcmp(argv[i],"-V")==0 || strcmp(argv[i],"-Verbose")==0) { + burn_set_scsi_logging(2 | 4); /* log SCSI to stderr */ + } else if(strcmp(argv[i],"-v")==0 || strcmp(argv[i],"-verbose")==0) { (o->verbosity)++; ClN(printf("cdrskin: verbosity level : %d\n",o->verbosity)); set_severities:; if(o->verbosity>=Cdrskin_verbose_debuG) Cdrpreskin_set_severities(o,"NEVER","DEBUG",0); + } else if(strcmp(argv[i],"-vv")==0 || strcmp(argv[i],"-vvv")==0 || strcmp(argv[i],"-vvvv")==0) { (o->verbosity)+= strlen(argv[i])-1; @@ -7454,7 +7460,7 @@ int Cdrskin_setup(struct CdrskiN *skin, int argc, char **argv, int flag) "" }; static char ignored_full_options[][41]= { - "-d", "-Verbose", "-V", "-silent", "-s", "-setdropts", "-prcap", + "-d", "-silent", "-s", "-setdropts", "-prcap", "-reset", "-abort", "-overburn", "-ignsize", "-useinfo", "-fix", "-nofix", "-raw", "-raw96p", "-raw16", "-raw96r", @@ -8265,6 +8271,8 @@ track_too_large:; if(skin->smallest_tsize<0 || skin->smallest_tsize>skin->fixed_size) skin->smallest_tsize= skin->fixed_size; + } else if(strcmp(argv[i],"-V")==0 || strcmp(argv[i],"-Verbose")==0) { + /* is handled in Cdrpreskin_setup() */; } else if(strcmp(argv[i],"-v")==0 || strcmp(argv[i],"-verbose")==0) { /* is handled in Cdrpreskin_setup() */; } else if(strcmp(argv[i],"-vv")==0 || strcmp(argv[i],"-vvv")==0 || diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index d6ad6e9..75b94a0 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2009.11.12.180048" +#define Cdrskin_timestamP "2009.11.12.180241" From 0fc685fc85ef2ff05b01a48ed2b24a557529ca91 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 12 Nov 2009 19:34:58 +0000 Subject: [PATCH 26/62] Man page entry and help text for option -V --- cdrskin/cdrskin.1 | 5 +++++ cdrskin/cdrskin.c | 4 +++- cdrskin/cdrskin_timestamp.h | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/cdrskin/cdrskin.1 b/cdrskin/cdrskin.1 index e819043..9fcfbde 100644 --- a/cdrskin/cdrskin.1 +++ b/cdrskin/cdrskin.1 @@ -796,6 +796,11 @@ Level 2 additionally reports about option settings derived from arguments or startup files. Level 3 is for debugging and useful mainly in conjunction with somebody who had a look into the program sourcecode. .TP +.BI \-V +Enable logging of SCSI commands to stderr. This allows expert examination +of the interaction between libburn and the drive. The commands are specified +in SCSI-3 standards SPC, SBC, MMC. +.TP .BI \-waiti Wait until input data is available at stdin or EOF occurs at stdin. Only then begin to access any drives. diff --git a/cdrskin/cdrskin.c b/cdrskin/cdrskin.c index 26eb939..6825802 100644 --- a/cdrskin/cdrskin.c +++ b/cdrskin/cdrskin.c @@ -2789,7 +2789,9 @@ see_cdrskin_eng_html:; "\tdev=target\tpseudo-SCSI target to use as CD-Recorder\n"); fprintf(stderr, "\tgracetime=#\tset the grace time before starting to write to #.\n"); - fprintf(stderr,"\t-v\t\tincrement verbose level by one\n"); + fprintf(stderr,"\t-v\t\tincrement general verbose level by one\n"); + fprintf(stderr, + "\t-V\t\tincrement SCSI command transport verbose level by one\n"); fprintf(stderr, "\tdriveropts=opt\topt= one of {burnfree,noburnfree,help}\n"); fprintf(stderr, diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index 75b94a0..7b0f72e 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2009.11.12.180241" +#define Cdrskin_timestamP "2009.11.12.193617" From 677b007100852cfa8c9ebd41894fe77da313e876 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 15 Nov 2009 15:21:04 +0000 Subject: [PATCH 27/62] Corrected an outdated remark --- cdrskin/cdrskin_timestamp.h | 2 +- libburn/file.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index 7b0f72e..fa59a30 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2009.11.12.193617" +#define Cdrskin_timestamP "2009.11.15.115923" diff --git a/libburn/file.c b/libburn/file.c index 0f49ce1..236f46a 100644 --- a/libburn/file.c +++ b/libburn/file.c @@ -1,5 +1,6 @@ /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ + #include #include #include @@ -27,8 +28,6 @@ an unreadable disc */ /* This is a generic OS oriented function wrapper which compensates shortcommings of read() in respect to a guaranteed amount of return data. See man 2 read , paragraph "RETURN VALUE". - Possibly libburn/file.c is not the right storage location for this. - To make it ready for a move, this function is not declared static. */ static int read_full_buffer(int fd, unsigned char *buffer, int size) { From 738b83ac03857f6dc23d5cfd819fc3fb60daec75 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 15 Nov 2009 15:24:21 +0000 Subject: [PATCH 28/62] New compile_cdrskin.sh option -o_direct (Linux only) --- cdrskin/cdrfifo.c | 65 +++++++++++++++++++++++++++++++++++++ cdrskin/cdrskin.c | 23 ++++++++++++- cdrskin/cdrskin_timestamp.h | 2 +- cdrskin/compile_cdrskin.sh | 4 +++ 4 files changed, 92 insertions(+), 2 deletions(-) diff --git a/cdrskin/cdrfifo.c b/cdrskin/cdrfifo.c index e61c533..6d912e2 100644 --- a/cdrskin/cdrfifo.c +++ b/cdrskin/cdrfifo.c @@ -25,6 +25,10 @@ #include #include +#ifdef Cdrskin_read_o_direcT +#include +#endif /* Cdrskin_read_o_direcT */ + #include "cdrfifo.h" @@ -174,9 +178,18 @@ int Cdrfifo_new(struct CdrfifO **ff, int source_fd, int dest_fd, o->follow_up_fd_idx= -1; o->next= o->prev= NULL; o->chain_idx= 0; + +#ifdef Cdrskin_read_o_direcT + o->buffer= mmap(NULL, (size_t) buffer_size, PROT_READ | PROT_WRITE, + MAP_SHARED | MAP_ANONYMOUS, -1, (off_t) 0); + if(o->buffer == MAP_FAILED) + goto failed; +#else o->buffer= TSOB_FELD(char,buffer_size); if(o->buffer==NULL) goto failed; +#endif /* Cdrskin_read_o_direcT */ + return(1); failed:; Cdrfifo_destroy(ff,0); @@ -226,8 +239,14 @@ int Cdrfifo_destroy(struct CdrfifO **ff, int flag) if(o->iso_fs_descr!=NULL) free((char *) o->iso_fs_descr); + if(o->buffer!=NULL) +#ifdef Cdrskin_read_o_direcT + munmap(o->buffer, o->buffer_size); +#else free((char *) o->buffer); +#endif /* Cdrskin_read_o_direcT */ + free((char *) o); (*ff)= NULL; return(1); @@ -659,6 +678,49 @@ return: <0 = error , 0 = idle , 1 = did some work after_write:; if(o->source_fd>=0) if(FD_ISSET((o->source_fd),rds)) { can_read= o->buffer_size - o->write_idx; + +#ifdef Cdrskin_read_o_direcT + + /* ts A91115 + This chunksize must be aligned to filesystem blocksize. + One might try to inquire the block size behind o->source_fd, but since + O_DIRECT is a dirty hack anyway, i just guess that 64 KiB is divisible + by any existing block size on Linux. + */ +#define Cdrfifo_o_direct_chunK 65536 + + if(o->write_idx < o->read_idx && o->write_idx + can_read > o->read_idx) + can_read= o->read_idx - o->write_idx; + if(o->fd_in_limit>=0.0) + if(can_read > o->fd_in_limit - o->fd_in_counter) + can_read= o->fd_in_limit - o->fd_in_counter; + /* Make sure to read with properly aligned size */ + if(can_read > Cdrfifo_o_direct_chunK) + can_read= Cdrfifo_o_direct_chunK; + else if(can_read < Cdrfifo_o_direct_chunK) + can_read= -1; + ret= 0; + if(can_read>0) + ret= read(o->source_fd,o->buffer+o->write_idx,can_read); + if(can_read < 0) { + /* waiting for a full Cdrfifo_o_direct_chunK to fit */ + if(can_write <= 0 && o->dest_fd >= 0) { + fd_set rds,wts,exs; + struct timeval wt; + + FD_ZERO(&rds); + FD_ZERO(&wts); + FD_ZERO(&exs); + FD_SET((o->dest_fd),&wts); + wt.tv_sec= 0; + wt.tv_usec= 10000; + select(o->dest_fd + 1,&rds, &wts, &exs, &wt); + + } + } else + +#else /* Cdrskin_read_o_direcT */ + if(can_read>o->chunk_size) can_read= o->chunk_size; if(o->write_idxread_idx && o->write_idx+can_read > o->read_idx) @@ -669,6 +731,9 @@ after_write:; ret= 0; if(can_read>0) ret= read(o->source_fd,o->buffer+o->write_idx,can_read); + +#endif /* ! Cdrskin_read_o_direcT */ + if(ret==-1) { /* >>> handle input error */; diff --git a/cdrskin/cdrskin.c b/cdrskin/cdrskin.c index 6825802..8f9a5a2 100644 --- a/cdrskin/cdrskin.c +++ b/cdrskin/cdrskin.c @@ -339,6 +339,23 @@ or /** Verbosity level for fifo debugging */ #define Cdrskin_verbose_debug_fifO 4 +#ifdef Cdrskin_read_o_direcT +/* Linux 2.6.18: + This can avoid low write speed via USB with 32 KB SCSI write chunks. + 64 KB write chunking is 20% more effective, though, and this size is + not in need for O_DIRECT. + Strange: Vanilla read() brings USB 32 KB WRITE down from 11x to 7.5x. + Throughput from /dev/zero to /dev/null is 230x. The disk delivers 56x. + Clearly Linux USB has a problem with 32 KB chunks. read() without O_DIRECT + makes it worse. + cdrecord and growisofs bring 11x. At least growisofs uses O_DIRECT for its + fifo input. +*/ +# ifndef _GNU_SOURCE +# define _GNU_SOURCE +# endif +#endif /* Cdrskin_read_o_direcT */ + #include #include @@ -1388,7 +1405,11 @@ int Cdrtrack_open_source_path(struct CdrtracK *track, int *fd, int flag) if(is_wav==-3) return(0); if(is_wav==0) - *fd= open(track->source_path,O_RDONLY); +#ifdef Cdrskin_read_o_direcT + *fd= open64(track->source_path, O_RDONLY | O_DIRECT); +#else + *fd= open(track->source_path, O_RDONLY); +#endif if(*fd==-1) { fprintf(stderr,"cdrskin: failed to open source address '%s'\n", track->source_path); diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index fa59a30..b2f5af4 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2009.11.15.115923" +#define Cdrskin_timestamP "2009.11.15.152541" diff --git a/cdrskin/compile_cdrskin.sh b/cdrskin/compile_cdrskin.sh index 6093f32..b7eafcb 100755 --- a/cdrskin/compile_cdrskin.sh +++ b/cdrskin/compile_cdrskin.sh @@ -55,6 +55,9 @@ do elif test "$i" = "-no_largefile" then largefile_opts= + elif test "$i" = "-o_direct" + then + def_opts="$def_opts -DCdrskin_read_o_direcT" elif test "$i" = "-do_not_compile_cdrskin" then compile_cdrskin=0 @@ -77,6 +80,7 @@ do echo " -compile_dewav compile program test/dewav without libburn." echo " -libburn_0_7_2 set macro to match libburn-0.7.2" echo " -libburn_svn set macro to match current libburn-SVN." + echo " -o_direct use open(O_DIRECT) on fifo input (Linux only)." echo " -do_not_compile_cdrskin omit compilation of cdrskin/cdrskin." echo " -experimental use newly introduced libburn features." echo " -oldfashioned use pre-0.2.2 libburn features only." From 79a33ca2ac976e70f0befb6317785a99f9fd23e8 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 15 Nov 2009 15:30:26 +0000 Subject: [PATCH 29/62] New API calls burn_write_opts_set_dvd_obs(), burn_write_opts_set_stdio_fsync() --- cdrskin/cdrskin_timestamp.h | 2 +- libburn/libburn.h | 29 +++++++ libburn/options.c | 21 +++++ libburn/options.h | 17 ++++- libburn/write.c | 148 ++++++++++++++++++++++++++++++++++-- 5 files changed, 210 insertions(+), 7 deletions(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index b2f5af4..ab8d348 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2009.11.15.152541" +#define Cdrskin_timestamP "2009.11.15.153140" diff --git a/libburn/libburn.h b/libburn/libburn.h index 1a46f9e..5ea49ae 100644 --- a/libburn/libburn.h +++ b/libburn/libburn.h @@ -767,6 +767,9 @@ void burn_set_verbosity(int level); This call can be made at any time - even before burn_initialize(). It is in effect for all active drives and currently not very thread safe for multiple drives. + + >>> ??? Shouldn't the file path with bit1 be adjustable ? + @param flag Bitfield for control purposes. The default is 0. bit0= log to file /tmp/libburn_sg_command_log bit1= log to stderr @@ -2119,6 +2122,32 @@ void burn_write_opts_set_force(struct burn_write_opts *opts, int use_force); void burn_write_opts_set_stream_recording(struct burn_write_opts *opts, int value); +/* ts A91115 */ +/** Overrides the write chunk size for DVD and BD media which is normally + determined according to media type and setting of stream recording. + A chunk size of 64 KB may improve throughput with bus systems which show + latency problems. + @param opts The write opts to change + @param obs Number of bytes which shall be sent by a single write command. + 0 means automatic size, 32768 and 65336 are the only other + accepted sizes for now. + @since 0.7.4 +*/ +void burn_write_opts_set_dvd_obs(struct burn_write_opts *opts, int obs); + +/* ts A91115 */ +/** Sets the rythm by which stdio pseudo drives force their output data to + be consumed by the receiving storage device. This forcing keeps the memory + from being clogged with lots of pending data for slow devices. + @param opts The write opts to change + @param rythm Number of 2KB output blocks after which fsync(2) is + performed. -1 means no fsync(), 0 means default, + elsewise the value must be >= 32. + Default is currently 8192 = 16 MB. + @since 0.7.4 +*/ +void burn_write_opts_set_stdio_fsync(struct burn_write_opts *opts, int rythm); + /** Sets whether to read in raw mode or not @param opts The read opts to change diff --git a/libburn/options.c b/libburn/options.c index b48a1b5..070502b 100644 --- a/libburn/options.c +++ b/libburn/options.c @@ -39,6 +39,8 @@ struct burn_write_opts *burn_write_opts_new(struct burn_drive *drive) opts->fill_up_media = 0; opts->force_is_set = 0; opts->do_stream_recording = 0; + opts->dvd_obs_override = 0; + opts->stdio_fsync_size = Libburn_stdio_fsync_limiT; opts->has_mediacatalog = 0; opts->format = BURN_CDROM; opts->multi = 0; @@ -389,6 +391,25 @@ void burn_write_opts_set_stream_recording(struct burn_write_opts *opts, } +/* ts A91115: API */ +void burn_write_opts_set_dvd_obs(struct burn_write_opts *opts, int obs) +{ + if (obs != 0 && obs != 32 * 1024 && obs != 64 * 1024) + return; + opts->dvd_obs_override = obs; +} + + +/* ts A91115: API */ +void burn_write_opts_set_stdio_fsync(struct burn_write_opts *opts, int rythm) +{ + if (rythm == -1) + opts->stdio_fsync_size = 0; + else if (rythm == 0) + opts->stdio_fsync_size = Libburn_stdio_fsync_limiT; + else if (rythm >= 32) + opts->stdio_fsync_size = rythm; +} /* ts A70901: API */ diff --git a/libburn/options.h b/libburn/options.h index 17c961d..9fc9db0 100644 --- a/libburn/options.h +++ b/libburn/options.h @@ -51,9 +51,19 @@ struct burn_write_opts /* ts A80412 : whether to use WRITE12 with Streaming bit set rather than WRITE10. Speeds up DVD-RAM. Might help with BD-RE. - This gets transferred to burn_drive.do_stream_recording */ + This gets transferred to burn_drive.do_stream_recording + */ int do_stream_recording; + /* ts A91115 : override value for .obs on DVD media. + Only values 0, 32K and 64K are allowed for now. */ + int dvd_obs_override; + + /* ts A91115 : size of the fsync() interval for stdio writing. + Values 0 or >= 32 counted in 2 KB blocks. */ + int stdio_fsync_size; + + /** A disc can have a media catalog number */ int has_mediacatalog; unsigned char mediacatalog[13]; @@ -64,6 +74,11 @@ struct burn_write_opts unsigned char multi; }; +/* Default value for burn_write_opts.stdio_flush_size +*/ +#define Libburn_stdio_fsync_limiT 8192 + + /** Options for disc reading operations. This should be created with burn_read_opts_new() and freed with burn_read_opts_free(). */ struct burn_read_opts diff --git a/libburn/write.c b/libburn/write.c index a89247a..3d8d8f6 100644 --- a/libburn/write.c +++ b/libburn/write.c @@ -1246,6 +1246,126 @@ int burn_disc_close_track_dvd_plus_r(struct burn_write_opts *o, } +/* <<< +#define Libburn_simplified_dvd_chunk_transactioN 1 +*/ + +#ifdef Libburn_simplified_dvd_chunk_transactioN + +/* ts A91114 : EXPERIMENTAL, NOT COMPLETELY IMPLEMENTED + + Simplified data transmission for DVD. libburn via Linux USB is 30 % slower + than growisofs or cdrecord when transmitting 32 KB chunks. + With 64 KB chunks it is 20% faster than the competitors. + No heavy CPU load is visible but there might be subtle race conditions in + the USB driver which work better with shorter time gaps between WRITE + commands. + + Insight: It is actually about the interference of track source reading + with SCSI writing via USB. growisofs reads with O_DIRECT into a + mmap()ed buffer. When doing the same, libburn with 32 KB chunks + reaches similar write speed. + On the other hand, 64 KB chunks are 20% faster than that and + are not improved by reading O_DIRECT. + + O_DIRECT is a property of the input fd of struct burn_source. + It can only be done with properly aligned memory and with aligned + read size. Alignment size is file system system specific. + System call + mmap(NULL, (size_t) buffer_size, PROT_READ | PROT_WRITE, + MAP_SHARED | MAP_ANONYMOUS, -1, (off_t) 0); + is supposed to allocate a properly aligned buffer. + 64 KB is supposed to be a safe size. + + @return 1= ok, go on , 2= no input with track->open_ended = nothing written + <= 0 = error +*/ +static int transact_dvd_chunk(struct burn_write_opts *opts, + struct burn_track *track) +{ + int curr = 0, valid, err; + struct burn_drive *d = opts->drive; + struct buffer *out = d->buffer; + unsigned char *data = out->data; + +#ifdef Libburn_log_in_and_out_streaM + /* <<< ts A61031 */ + static int tee_fd= -1; + if(tee_fd==-1) + tee_fd= open("/tmp/libburn_sg_readin", + O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR); +#endif /* Libburn_log_in_and_out_streaM */ + + + /* Read a chunk full of data */ + + /* ??? Do we have offset padding ? >>> First produce offset padding */; + + /* <<<< */ + if (0 && !track->eos) { + for (curr = 0; curr < opts->obs; curr += 2048) { + if (track->source->read != NULL) + valid = track->source->read(track->source, + data + curr, 2048); + else + valid = track->source->read_xt(track->source, + data + curr, 2048); + if (valid <= 0) { + track->eos = 1; + break; + } + track->sourcecount += valid; + +#ifdef Libburn_log_in_and_out_streaM + if(tee_fd!=-1 && valid>0) { + write(tee_fd, data + curr, valid); + } +#endif /* Libburn_log_in_and_out_streaM */ + + } + } else if (!track->eos){ + valid = track->source->read(track->source, data, opts->obs); + if (valid <= 0) { + track->eos = 1; + } else { + track->sourcecount += valid; + curr = valid; + +#ifdef Libburn_log_in_and_out_streaM + if(tee_fd!=-1 && valid>0) { + write(tee_fd, data, valid); + } +#endif /* Libburn_log_in_and_out_streaM */ + } + } + if (curr == 0 && track->open_ended) { + + /* >>> allow tail padding */; + + return 2; + } + if (curr < opts->obs) + memset(data + curr , 0, opts->obs - curr); + + /* Write chunk */ + out->bytes = opts->obs; + out->sectors = out->bytes / 2048; + err = d->write(d, d->nwa, out); + if (err == BE_CANCELLED) + return 0; + track->writecount += out->bytes; + track->written_sectors += out->sectors; + d->progress.buffered_bytes += out->bytes; + d->nwa += out->sectors; + out->bytes = 0; + out->sectors = 0; + + return 1; +} + +#endif /* Libburn_simplified_dvd_chunk_transactioN */ + + /* ts A61218 - A81208 */ int burn_dvd_write_track(struct burn_write_opts *o, struct burn_session *s, int tnum, int is_last_track) @@ -1322,9 +1442,18 @@ int burn_dvd_write_track(struct burn_write_opts *o, d->progress.buffer_capacity / 2048 + 128; } +#ifdef Libburn_simplified_dvd_chunk_transactioN + + ret = transact_dvd_chunk(o, t); + if (ret <= 0) + {ret = 0; goto ex;} + i += o->obs / 2048 - 1; + d->progress.sector += o->obs / 2048 - 1; +#else /* transact a (CD sized) sector */ if (!sector_data(o, t, 0)) { ret = 0; goto ex; } +#endif if (open_ended) { d->progress.sectors = sectors = i; @@ -1789,11 +1918,22 @@ int burn_dvd_write_sync(struct burn_write_opts *o, /* <<< test only : Does this increase effective speed with USB ? ts A90801 : 64kB: speed with 16x DVD-R is 12 rather than 8 128kB: glibc complains about double free - BURN_OS_TRANSPORT_BUFFER_SIZE would need to - be enlarged anyway. + With BURN_OS_TRANSPORT_BUFFER_SIZE + enlarged to 128 MB, the first WRITE fails + with an i/o error. o->obs = 64 * 1024; */ + if (o->dvd_obs_override >= 32 * 1024) + o->obs = o->dvd_obs_override; + + if (o->obs > BUFFER_SIZE) { + sprintf(msg, "Chosen write chunk size %d exceeds system dependent buffer size", o->obs); + libdax_msgs_submit(libdax_messenger, d->global_index, + 0x00000002, LIBDAX_MSGS_SEV_DEBUG, + LIBDAX_MSGS_PRIO_ZERO, msg, 0, 0); + o->obs = BUFFER_SIZE; + } sprintf(msg, "dvd/bd Profile= %2.2Xh , obs= %d , obs_pad= %d", d->current_profile, o->obs, o->obs_pad); @@ -2043,8 +2183,6 @@ int burn_stdio_slowdown(struct burn_drive *d, struct timeval *prev_time, return 1; } -/* Flush write buffer after each 16 MB */ -#define Libburn_stdio_flush_limiT 8192 /* ts A70904 */ int burn_stdio_write_track(struct burn_write_opts *o, struct burn_session *s, @@ -2085,7 +2223,7 @@ int burn_stdio_write_track(struct burn_write_opts *o, struct burn_session *s, d->progress.sector++; /* Flush to disk from time to time */ if (d->progress.sector - prev_sync_sector >= - Libburn_stdio_flush_limiT) { + o->stdio_fsync_size && o->stdio_fsync_size > 0) { prev_sync_sector = d->progress.sector; if (!o->simulate) burn_stdio_sync_cache(d->stdio_fd, d, 1); From 25489521bb14fc8ff29ec60c9fadecaf1829225c Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 15 Nov 2009 16:49:04 +0000 Subject: [PATCH 30/62] New options dvd_obs= and stdio_fsync= --- cdrskin/cdrskin.1 | 36 ++++++++++++++-------- cdrskin/cdrskin.c | 60 +++++++++++++++++++++++++++++++++++++ cdrskin/cdrskin_timestamp.h | 2 +- 3 files changed, 85 insertions(+), 13 deletions(-) diff --git a/cdrskin/cdrskin.1 b/cdrskin/cdrskin.1 index 9fcfbde..ff1ea56 100644 --- a/cdrskin/cdrskin.1 +++ b/cdrskin/cdrskin.1 @@ -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 "Sep 10, 2009" +.TH CDRSKIN 1 "Nov 15, 2009" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -899,6 +899,13 @@ Both, write_start_address and direct_write_amount size must be aligned to a media dependend transaction size. With DVD-RAM, BD-RE, DVD+RW this is 2k, with overwriteable DVD-RW it is 32k. .TP +.BI dvd_obs= default|32k|64k +Linux specific: +Set the number of bytes to be transmitted with each write operation to DVD +or BD media. A number of 64 KB may improve throughput with bus systems which +show latency problems. The default depends on media type and option +stream_recording= . +.TP .BI fallback_program= command Set a command name to be executed if cdrskin encounters a known cdrecord option which it does not yet support. If a non-empty command is given with @@ -1013,6 +1020,22 @@ which can only do DAO but not Incremental Streaming. .BI \--single_track Accept only the last argument of the command line as track source address. .TP +.BI stdio_sync= on|off|number +Set the number of bytes after which to force output to drives with prefix +"stdio:". This forcing keeps the memory from being clogged with lots of +pending data for slow devices. Default "on" is the same as "16m". +Forced output can be disabled by "off". +.TP +.BI stream_recording= on|off|number +By setting "on" request that compliance to the desired speed setting is +preferred over management of write errors. With DVD-RAM and BD this can +bring effective write speed near to the nominal write speed of the media. +But it will also disable the automatic use of replacement blocks +if write errors occur. It might as well be disliked or ignored by the drive. +.br +If a number is given, then error management stays enabled for all byte +addresses below that number. Any number below 16s is the same as "off". +.TP .BI tao_to_sao_tsize= size Set an exact fixed size for the next track to be in effect only if the track source cannot deliver a size prediction and no tsize= was specified and an @@ -1199,17 +1222,6 @@ Linux specific: Use and report literal Bus,Target,Lun addresses rather than real SCSI and pseudo ATA addresses. This method is outdated and was never compatible with original cdrecord. -.TP -.BI stream_recording="on"|"off"|number -By setting "on" request that compliance to the desired speed setting is -preferred over management of write errors. With DVD-RAM and BD this can -bring effective write speed near to the nominal write speed of the media. -But it will also disable the automatic use of replacement blocks -if write errors occur. It might as well be disliked or ignored by the drive. -.br -If a number is given, then error management stays enabled for all byte -addresses below that number. Any number below 16s is the same as "off". -.TP .BI --xa1-ignore Silently interpret option -xa1 as -data. This may be necessary if a frontent does not prepare -xa1 block headers but insists in using option -xa1. diff --git a/cdrskin/cdrskin.c b/cdrskin/cdrskin.c index 8f9a5a2..e1accad 100644 --- a/cdrskin/cdrskin.c +++ b/cdrskin/cdrskin.c @@ -148,6 +148,10 @@ or Move them down to Cdrskin_libburn_from_pykix_svN on version leap */ +/* burn_write_opts_set_dvd_obs() and burn_write_opts_set_stdio_fsync() +*/ +#define Cdrskin_libburn_has_fsync_obS 1 + #endif /* Cdrskin_libburn_0_7_3 */ #ifndef Cdrskin_libburn_versioN @@ -2695,6 +2699,11 @@ set_dev:; printf( " --drive_scsi_exclusive try to exclusively reserve device files\n"); printf(" /dev/srN, /dev/scdM, /dev/stK of drive.\n"); +#ifdef Cdrskin_libburn_has_fsync_obS + printf(" dvd_obs=\"default\"|number\n"); + printf( + " set number of bytes per DVD/BD write: 32k or 64k\n"); +#endif #ifdef Cdrskin_burn_drive_eject_brokeN printf( " eject_device= set the device address for command eject\n"); @@ -2745,6 +2754,13 @@ set_dev:; printf( " byte addresses below that number.\n"); #endif +#ifdef Cdrskin_libburn_has_fsync_obS + printf(" stdio_sync=\"default\"|\"off\"|number\n"); + printf( + " set number of bytes after which to force output\n"); + printf( + " to drives with prefix \"stdio:\".\n"); +#endif #ifdef Cdrskin_allow_libburn_taO printf( @@ -3191,6 +3207,8 @@ struct CdrskiN { int dummy_mode; int force_is_set; int stream_recording_is_set; /* see burn_write_opts_set_stream_recording() */ + int dvd_obs; /* DVD write chunk size: 0, 32k or 64k */ + int stdio_sync; /* stdio fsync interval: -1, 0, >=32 */ int single_track; int prodvd_cli_compatible; @@ -3409,6 +3427,8 @@ int Cdrskin_new(struct CdrskiN **skin, struct CdrpreskiN *preskin, int flag) o->dummy_mode= 0; o->force_is_set= 0; o->stream_recording_is_set= 0; + o->dvd_obs= 0; + o->stdio_sync= 0; o->single_track= 0; o->prodvd_cli_compatible= 0; o->do_devices= 0; @@ -6951,6 +6971,10 @@ burn_failed:; #ifdef Cdrskin_libburn_has_stream_recordinG burn_write_opts_set_stream_recording(o, skin->stream_recording_is_set); #endif +#ifdef Cdrskin_libburn_has_fsync_obS + burn_write_opts_set_dvd_obs(o, skin->dvd_obs); + burn_write_opts_set_stdio_fsync(o, skin->stdio_sync); +#endif if(skin->dummy_mode) { fprintf(stderr, @@ -7825,6 +7849,22 @@ set_driveropts:; } else if(strcmp(argv[i],"-dummy")==0) { skin->dummy_mode= 1; + } else if(strncmp(argv[i], "-dvd_obs=", 9)==0) { + value_pt= argv[i] + 9; + goto dvd_obs; + } else if(strncmp(argv[i], "dvd_obs=", 8)==0) { + value_pt= argv[i] + 8; +dvd_obs:; + if(strcmp(value_pt, "default") == 0) + num= 0; + else + num = Scanf_io_size(value_pt,0); + if(num != 0 && num != 32768 && num != 65536) { + fprintf(stderr, + "cdrskin: SORRY : Option dvd_obs= accepts only sizes 0, 32k, 64k\n"); + } else + skin->dvd_obs= num; + } else if(strcmp(argv[i],"-eject")==0) { skin->do_eject= 1; if(skin->verbosity>=Cdrskin_verbose_cmD) @@ -8215,6 +8255,26 @@ set_speed:; if(skin->verbosity>=Cdrskin_verbose_cmD) ClN(printf("cdrskin: speed : %f\n",skin->x_speed)); + } else if(strncmp(argv[i], "-stdio_sync=", 12)==0) { + value_pt= argv[i] + 12; + goto stdio_sync; + } else if(strncmp(argv[i], "stdio_sync=", 11)==0) { + value_pt= argv[i] + 11; +stdio_sync:; + if(strcmp(value_pt, "default") == 0 || strcmp(value_pt, "on") == 0) + num= 0; + else if(strcmp(value_pt, "off") == 0) + num= -1; + else + num = Scanf_io_size(value_pt,0); + if(num > 0) + num/= 2048; + if(num != -1 && num != 0 && (num < 32 || num > 512 * 1024)) { + fprintf(stderr, + "cdrskin: SORRY : Option stdio_sync= accepts only sizes -1, 0, 32k ... 1g\n"); + } else + skin->stdio_sync= num; + } else if(strncmp(argv[i],"-stream_recording=",18)==0) { value_pt= argv[i]+18; goto set_stream_recording; diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index ab8d348..f94eafb 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2009.11.15.153140" +#define Cdrskin_timestamP "2009.11.15.165016" From b28165f10bcb4cdd2f5f27b23c9681ecba165694 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Mon, 16 Nov 2009 16:53:07 +0000 Subject: [PATCH 31/62] Configure options --enable-cdrskin-fifo-odirect, --enable-dvd-obs-64k --- Makefile.am | 4 +++- cdrskin/cdrfifo.c | 6 ++++-- cdrskin/cdrfifo.h | 2 +- cdrskin/cdrskin.1 | 9 +++++---- cdrskin/cdrskin.c | 39 +++++++++++++++++++++++++++---------- cdrskin/cdrskin_timestamp.h | 2 +- configure.ac | 38 ++++++++++++++++++++++++++++++------ libburn/write.c | 5 ++++- 8 files changed, 79 insertions(+), 26 deletions(-) diff --git a/Makefile.am b/Makefile.am index 48dd8c5..d76a538 100644 --- a/Makefile.am +++ b/Makefile.am @@ -12,6 +12,7 @@ lib_LTLIBRARIES = libburn/libburn.la # Build libraries libburn_libburn_la_LDFLAGS = \ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) +libburn_libburn_la_CFLAGS = $(LIBBURN_DVD_OBS_64K) libburn_libburn_la_LIBADD = $(LIBBURN_ARCH_LIBS) $(THREAD_LIBS) libburn_libburn_la_SOURCES = \ libburn/async.c \ @@ -112,7 +113,8 @@ test_structest_SOURCES = test/structest.c ## cdrskin construction site - ts A60816 - A91012 cdrskin_cdrskin_CPPFLAGS = -Ilibburn -cdrskin_cdrskin_CFLAGS = -DCdrskin_libburn_0_7_3 +cdrskin_cdrskin_CFLAGS = -DCdrskin_libburn_0_7_3 \ + $(CDRSKIN_O_DIRECT_DEF) $(CDRSKIN_DVD_OBS_64K) # cdrskin_cdrskin_LDADD = $(libburn_libburn_la_OBJECTS) $(LIBBURN_EXTRALIBS) # ts A80123, change proposed by Simon Huggins to cause dynamic libburn linking diff --git a/cdrskin/cdrfifo.c b/cdrskin/cdrfifo.c index 6d912e2..bb87f8b 100644 --- a/cdrskin/cdrfifo.c +++ b/cdrskin/cdrfifo.c @@ -124,7 +124,7 @@ struct CdrfifO { struct burn_source object. @param chunk_size Size of buffer block for a single transaction (0=default) @param buffer_size Size of fifo buffer - @param flag Unused yet + @param flag bit0= Debugging verbosity @return 1 on success, <=0 on failure */ int Cdrfifo_new(struct CdrfifO **ff, int source_fd, int dest_fd, @@ -180,6 +180,8 @@ int Cdrfifo_new(struct CdrfifO **ff, int source_fd, int dest_fd, o->chain_idx= 0; #ifdef Cdrskin_read_o_direcT + if(flag & 1) + fprintf(stderr,"cdrfifo: DEBUG : allocating fifo buffer via mmap()\n"); o->buffer= mmap(NULL, (size_t) buffer_size, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, (off_t) 0); if(o->buffer == MAP_FAILED) @@ -188,7 +190,7 @@ int Cdrfifo_new(struct CdrfifO **ff, int source_fd, int dest_fd, o->buffer= TSOB_FELD(char,buffer_size); if(o->buffer==NULL) goto failed; -#endif /* Cdrskin_read_o_direcT */ +#endif /* ! Cdrskin_read_o_direcT */ return(1); failed:; diff --git a/cdrskin/cdrfifo.h b/cdrskin/cdrfifo.h index 1237d20..94a291a 100644 --- a/cdrskin/cdrfifo.h +++ b/cdrskin/cdrfifo.h @@ -33,7 +33,7 @@ struct CdrfifO; struct burn_source object. @param chunk_size Size of buffer block for a single transaction (0=default) @param buffer_size Size of fifo buffer - @param flag unused yet + @param flag bit0= Debugging verbosity @return 1 on success, <=0 on failure */ int Cdrfifo_new(struct CdrfifO **ff, int source_fd, int dest_fd, diff --git a/cdrskin/cdrskin.1 b/cdrskin/cdrskin.1 index ff1ea56..1e9752b 100644 --- a/cdrskin/cdrskin.1 +++ b/cdrskin/cdrskin.1 @@ -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 "Nov 15, 2009" +.TH CDRSKIN 1 "Nov 16, 2009" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -902,9 +902,10 @@ overwriteable DVD-RW it is 32k. .BI dvd_obs= default|32k|64k Linux specific: Set the number of bytes to be transmitted with each write operation to DVD -or BD media. A number of 64 KB may improve throughput with bus systems which -show latency problems. The default depends on media type and option -stream_recording= . +or BD media. Tracks get padded up to the next multiple of this write +size. A number of 64 KB may improve throughput with bus systems which +show latency problems. The default depends on media type, option +stream_recording=, and on compile time options. .TP .BI fallback_program= command Set a command name to be executed if cdrskin encounters a known cdrecord diff --git a/cdrskin/cdrskin.c b/cdrskin/cdrskin.c index e1accad..c139058 100644 --- a/cdrskin/cdrskin.c +++ b/cdrskin/cdrskin.c @@ -1319,6 +1319,7 @@ int Cdrtrack_seek_isosize(struct CdrtracK *track, int fd, int flag) bit0=debugging verbosity bit1=open as source for direct write: no audio extract, no minimum track size + bit2=permission to use O_DIRECT (if enabled at compile time) @return <=0 error, 1 success */ int Cdrtrack_open_source_path(struct CdrtracK *track, int *fd, int flag) @@ -1408,12 +1409,18 @@ int Cdrtrack_open_source_path(struct CdrtracK *track, int *fd, int flag) return(-1); if(is_wav==-3) return(0); - if(is_wav==0) + if(is_wav==0) { #ifdef Cdrskin_read_o_direcT - *fd= open64(track->source_path, O_RDONLY | O_DIRECT); -#else - *fd= open(track->source_path, O_RDONLY); + if(flag & 4) { + *fd= open64(track->source_path, O_RDONLY | O_DIRECT); + if(flag & 1) + fprintf(stderr,"cdrskin: DEBUG : opened track inlet O_DIRECT\n"); + } else #endif + { + *fd= open(track->source_path, O_RDONLY); + } + } if(*fd==-1) { fprintf(stderr,"cdrskin: failed to open source address '%s'\n", track->source_path); @@ -1499,7 +1506,8 @@ int Cdrtrack_attach_fifo(struct CdrtracK *track, int *outlet_fd, *outlet_fd= -1; if(track->fifo_size<=0) return(2); - ret= Cdrtrack_open_source_path(track,&source_fd,flag&1); + ret= Cdrtrack_open_source_path(track,&source_fd, + (flag&1) | (4 * (track->fifo_size >= 256 * 1024))); if(ret<=0) return(ret); if(pipe(pipe_fds)==-1) @@ -1516,7 +1524,7 @@ int Cdrtrack_attach_fifo(struct CdrtracK *track, int *outlet_fd, /* >>> ??? obtain track sector size and use instead of 2048 ? */ - ret= Cdrfifo_new(&ff,source_fd,pipe_fds[1],2048,track->fifo_size,0); + ret= Cdrfifo_new(&ff,source_fd,pipe_fds[1],2048,track->fifo_size, flag & 1); if(ret<=0) return(ret); if(previous_fifo!=NULL) @@ -1591,6 +1599,7 @@ int Cdrtrack_add_to_session(struct CdrtracK *track, int trackno, /* bit0= debugging verbosity bit1= apply padding hack (<<< should be unused for now) + bit2= permission to use O_DIRECT (if enabled at compile time) */ { struct burn_track *tr; @@ -1606,7 +1615,7 @@ int Cdrtrack_add_to_session(struct CdrtracK *track, int trackno, /* Note: track->track_type may get set in here */ if(track->source_fd==-1) { - ret= Cdrtrack_open_source_path(track,&source_fd,(flag&1)); + ret= Cdrtrack_open_source_path(track, &source_fd, flag & (4 | 1)); if(ret<=0) goto ex; } @@ -5995,8 +6004,10 @@ thank_you_for_patience:; if(skin->is_writing) fprintf(stderr,"\n"); pending[0]= 0; +/* if(bytes_to_write > 0 && skin->verbosity >= Cdrskin_verbose_debuG) sprintf(pending, " pnd %.f", bytes_to_write - written_total_bytes); +*/ fprintf(stderr, "\rcdrskin: thank you for being patient for %.f seconds%21.21s", elapsed_total_time, pending); @@ -6602,7 +6613,8 @@ int Cdrskin_direct_write(struct CdrskiN *skin, int flag) &source_path,&source_fd,&is_from_stdin,0); if(source_fd==-1) { ret= Cdrtrack_open_source_path(skin->tracklist[0],&source_fd, - 2|(skin->verbosity>=Cdrskin_verbose_debuG)); + 2 | (skin->verbosity >= Cdrskin_verbose_debuG) | + (4 * (skin->fifo_size >= 256 * 1024))); if(ret<=0) goto ex; } @@ -6836,6 +6848,8 @@ burn_failed:; hflag= (skin->verbosity>=Cdrskin_verbose_debuG); if(i==skin->track_counter-1) Cdrtrack_ensure_padding(skin->tracklist[i],hflag&1); + if(skin->fifo_size >= 256 * 1024) + hflag|= 4; ret= Cdrtrack_add_to_session(skin->tracklist[i],i,session,hflag); if(ret<=0) { fprintf(stderr,"cdrskin: FATAL : Cannot add track %d to session.\n",i+1); @@ -6972,9 +6986,14 @@ burn_failed:; burn_write_opts_set_stream_recording(o, skin->stream_recording_is_set); #endif #ifdef Cdrskin_libburn_has_fsync_obS - burn_write_opts_set_dvd_obs(o, skin->dvd_obs); +#ifdef Cdrskin_dvd_obs_default_64K + if(skin->dvd_obs == 0) + burn_write_opts_set_dvd_obs(o, 64 * 1024); + else +#endif + burn_write_opts_set_dvd_obs(o, skin->dvd_obs); burn_write_opts_set_stdio_fsync(o, skin->stdio_sync); -#endif +#endif /* Cdrskin_libburn_has_fsync_obS */ if(skin->dummy_mode) { fprintf(stderr, diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index f94eafb..ee60d31 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2009.11.15.165016" +#define Cdrskin_timestamP "2009.11.16.165420" diff --git a/configure.ac b/configure.ac index d9c2631..aed9586 100644 --- a/configure.ac +++ b/configure.ac @@ -111,15 +111,15 @@ AC_SUBST(BURN_VERSION) dnl Libtool versioning LT_RELEASE=$BURN_MAJOR_VERSION.$BURN_MINOR_VERSION.$BURN_MICRO_VERSION dnl -dnl ts A91012 +dnl ts A91116 dnl ### This is the release version libburn-0.7.2 = libburn.so.4.37.0 dnl This is the development version after above release version -dnl LT_CURRENT++, LT_AGE++ has not yet happened. -dnl ### LT_CURRENT++, LT_AGE++ has happened meanwhile. +dnl ### LT_CURRENT++, LT_AGE++ has not yet happened. +dnl LT_CURRENT++, LT_AGE++ has happened meanwhile. dnl -dnl SONAME = 41 - 37 = 4 . Linux library name = libburn.so.4.37.0 -LT_CURRENT=41 -LT_AGE=37 +dnl SONAME = 42 - 38 = 4 . Linux library name = libburn.so.4.38.0 +LT_CURRENT=42 +LT_AGE=38 LT_REVISION=0 LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE` @@ -198,6 +198,32 @@ else CFLAGS="$CFLAGS -DDEBUG" fi +# ts A91116 +AC_ARG_ENABLE(cdrskin-fifo-odirect, +[ --enable-cdrskin-fifo-odirect Enable use of O_DIRECT with cdrskin fifo inlet, default=no], + , enable_cdrskin_fifo_odirect=no) +if test x$enable_cdrskin_fifo_odirect = xyes; then + CDRSKIN_O_DIRECT_DEF="-DCdrskin_read_o_direcT" + echo "enabled use of O_DIRECT with cdrskin fifo inlet" +else + CDRSKIN_O_DIRECT_DEF= + echo "disabled use of O_DIRECT with cdrskin fifo inlet" +fi +AC_SUBST(CDRSKIN_O_DIRECT_DEF) + +# ts A91116 +AC_ARG_ENABLE(dvd-obs-64k, +[ --enable-dvd-obs-64k 64 KB default size for DVD/BD writing, default=no], + , enable_fifo_odirect=no) +if test x$enable_dvd_obs_64k = xyes; then + LIBBURN_DVD_OBS_64K="-DLibburn_dvd_obs_default_64K" + echo "enabled write size default 64 KB on DVD and BD" +else + LIBBURN_DVD_OBS_64K= + echo "disabled write size default 64 KB on DVD and BD" +fi +AC_SUBST(LIBBURN_DVD_OBS_64K) + dnl Determine target directory for libburn-*.pc dnl Important: Must be performed _after_ TARGET_SHIZZLE diff --git a/libburn/write.c b/libburn/write.c index 3d8d8f6..389f0c3 100644 --- a/libburn/write.c +++ b/libburn/write.c @@ -1914,6 +1914,9 @@ int burn_dvd_write_sync(struct burn_write_opts *o, o->obs_pad = 1; /* fill-up track's last 32k buffer */ } +#ifdef Libburn_dvd_obs_default_64K + o->obs = 64 * 1024; +#endif /* <<< test only : Does this increase effective speed with USB ? ts A90801 : 64kB: speed with 16x DVD-R is 12 rather than 8 @@ -1932,7 +1935,7 @@ int burn_dvd_write_sync(struct burn_write_opts *o, libdax_msgs_submit(libdax_messenger, d->global_index, 0x00000002, LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO, msg, 0, 0); - o->obs = BUFFER_SIZE; + o->obs = 32 * 1024; /* This size is required to work */ } sprintf(msg, "dvd/bd Profile= %2.2Xh , obs= %d , obs_pad= %d", From 43761c55ef22ebd89f0441258f2c213d0d28798c Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Mon, 16 Nov 2009 16:55:58 +0000 Subject: [PATCH 32/62] New compile_cdrskin.sh option -dvd_obs_64k, adapted to new .o names of libburn --- cdrskin/compile_cdrskin.sh | 67 ++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 31 deletions(-) diff --git a/cdrskin/compile_cdrskin.sh b/cdrskin/compile_cdrskin.sh index b7eafcb..5137aff 100755 --- a/cdrskin/compile_cdrskin.sh +++ b/cdrskin/compile_cdrskin.sh @@ -8,9 +8,10 @@ debug_opts="-O2" def_opts= largefile_opts="-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1" libvers="-DCdrskin_libburn_0_7_3" -cleanup_src_or_obj="libburn/cleanup.o" -libdax_msgs_o="libburn/libdax_msgs.o" -libdax_audioxtr_o="libburn/libdax_audioxtr.o" +burn="libburn/libburn_libburn_la-" +cleanup_src_or_obj="$burn"cleanup.o +libdax_msgs_o="$burn"libdax_msgs.o +libdax_audioxtr_o="$burn"libdax_audioxtr.o do_strip=0 static_opts= warn_opts="-Wall" @@ -31,20 +32,20 @@ do then libvers="-DCdrskin_libburn_cvs_A60220_tS" libdax_audioxtr_o= - libdax_msgs_o="libburn/message.o" + libdax_msgs_o="$burn"message.o cleanup_src_or_obj="-DCleanup_has_no_libburn_os_H cdrskin/cleanup.c" elif test "$i" = "-libburn_0_7_2" then libvers="-DCdrskin_libburn_0_7_2" - libdax_audioxtr_o="libburn/libdax_audioxtr.o" - libdax_msgs_o="libburn/libdax_msgs.o" - cleanup_src_or_obj="libburn/cleanup.o" + libdax_audioxtr_o="$burn"libdax_audioxtr.o + libdax_msgs_o="$burn"libdax_msgs.o + cleanup_src_or_obj="$burn"cleanup.o elif test "$i" = "-libburn_svn" then libvers="-DCdrskin_libburn_0_7_3" - libdax_audioxtr_o="libburn/libdax_audioxtr.o" - libdax_msgs_o="libburn/libdax_msgs.o" - cleanup_src_or_obj="libburn/cleanup.o" + libdax_audioxtr_o="$burn"libdax_audioxtr.o + libdax_msgs_o="$burn"libdax_msgs.o + cleanup_src_or_obj="$burn"cleanup.o elif test "$i" = "-newapi" -o "$i" = "-experimental" then def_opts="$def_opts -DCdrskin_new_api_tesT" @@ -58,6 +59,9 @@ do elif test "$i" = "-o_direct" then def_opts="$def_opts -DCdrskin_read_o_direcT" + elif test "$i" = "-dvd_obs_64k" + then + def_opts="$def_opts -DCdrskin_dvd_obs_default_64K" elif test "$i" = "-do_not_compile_cdrskin" then compile_cdrskin=0 @@ -81,6 +85,7 @@ do echo " -libburn_0_7_2 set macro to match libburn-0.7.2" echo " -libburn_svn set macro to match current libburn-SVN." echo " -o_direct use open(O_DIRECT) on fifo input (Linux only)." + echo " -dvd_obs_64k 64 KB default size for cdrskin DVD/BD writing." echo " -do_not_compile_cdrskin omit compilation of cdrskin/cdrskin." echo " -experimental use newly introduced libburn features." echo " -oldfashioned use pre-0.2.2 libburn features only." @@ -120,31 +125,31 @@ then \ $cleanup_src_or_obj \ \ - libburn/async.o \ - libburn/debug.o \ - libburn/drive.o \ - libburn/file.o \ - libburn/init.o \ - libburn/options.o \ - libburn/source.o \ - libburn/structure.o \ + "$burn"async.o \ + "$burn"debug.o \ + "$burn"drive.o \ + "$burn"file.o \ + "$burn"init.o \ + "$burn"options.o \ + "$burn"source.o \ + "$burn"structure.o \ \ - libburn/sg.o \ - libburn/write.o \ - libburn/read.o \ + "$burn"sg.o \ + "$burn"write.o \ + "$burn"read.o \ $libdax_audioxtr_o \ $libdax_msgs_o \ \ - libburn/mmc.o \ - libburn/sbc.o \ - libburn/spc.o \ - libburn/util.o \ + "$burn"mmc.o \ + "$burn"sbc.o \ + "$burn"spc.o \ + "$burn"util.o \ \ - libburn/sector.o \ - libburn/toc.o \ + "$burn"sector.o \ + "$burn"toc.o \ \ - libburn/crc.o \ - libburn/ecma130ab.o \ + "$burn"crc.o \ + "$burn"ecma130ab.o \ \ -lpthread @@ -187,8 +192,8 @@ then -DDewav_without_libburN \ -o test/dewav \ test/dewav.c \ - libburn/libdax_audioxtr.o \ - libburn/libdax_msgs.o \ + "$burn"libdax_audioxtr.o \ + "$burn"libdax_msgs.o \ \ -lpthread From c2c10e263e50075b3b3a8ccd66dabeca0af56f11 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Mon, 16 Nov 2009 18:00:30 +0000 Subject: [PATCH 33/62] Updated build instructions of libburn and cdrskin --- README | 30 +++++++++++++++++++++++++++++- cdrskin/README | 18 +++++++++++++++--- cdrskin/cdrskin_eng.html | 19 ++++++++++++++----- 3 files changed, 58 insertions(+), 9 deletions(-) diff --git a/README b/README index 9c4e7b2..0698ac8 100644 --- a/README +++ b/README @@ -57,6 +57,25 @@ Do in a directory of your choice: Warning: The trunk might contain experimental features which might not persist until next release. + + Special ./configure options + +In some situations Linux delivers a better write performance to drives if +the track input is read with O_DIRECT (see man 2 open). The input reader of +the cdrskin fifo can be told to use this peculiar read mode by : + --enable-cdrskin-fifo-odirect + +But typically libburn call burn_write_opts_set_dvd_obs(opts, 64*1024) will +yield even better performance in such a situation. 64k can be made default +at configure time by : + --enable-dvd-obs-64k +This may be combined with above --enable-cdrskin-fifo-odirect . + +Make sure to re-compile all source files after running ./configure + make clean ; make + make install + + ------------------------------------------------------------------------------ An important part of the project, libisofs, is hosted in a bzr repository at @@ -137,7 +156,8 @@ The project components (list subject to growth, hopefully): Rock Ridge extensions. Manipulation is not only adding or overwriting of files but also deleting, renaming, attribute changing, incremental backups, activating boot images, and - extracting of files from ISO images to disk. + extracting of files from ISO images to disk. An own ISO 9660 + extension stores ACLs, xattr, and MD5 of file content. See xorriso/README for more. - "test" is a collection of application gestures and examples given by the @@ -443,6 +463,14 @@ Project history as far as known to me: It can retrieve media product info and can process track input which was prepared for CD-ROM XA Mode 2 Form 1. cdrskin now performs option -minfo. +- 28 Oct 2009 libisoburn-0.4.4 fixes a bug with cdrecord emulation and + introduces new information options about media type and ISO image id strings. + On Linux it helps with mounting two sessions of the same media + simultaneously. + +- 12 Nov 2009 libburn-0.7.2.pl01 works around problems with Pioneer DVR-216D. + DVD-R runs made the drive stuck. Ejecting the tray did not work properly. + ------------------------------------------------------------------------------ diff --git a/cdrskin/README b/cdrskin/README index 84ec606..2cfa0e9 100644 --- a/cdrskin/README +++ b/cdrskin/README @@ -35,8 +35,7 @@ Within that directory execute: make This will already produce a cdrskin binary. But it will be necessary to -install libburn in order to use this binary. Installation of libburn is -beyond the scope of cdrskin. For this, see included libburn docs. +install libburn in order to use this binary. In order to surely get a standalone binary, execute @@ -73,7 +72,7 @@ It is not necessary for the standalone cdrskin binary to have libburn installed, since it incorporates the necessary libburn parts at compile time. It will not collide with an installed version of libburn either. But libpthread must be installed on the system and glibc has to match. (See -below for a way to create a statically linked binary.) +below for a way to create a totally static linked binary.) To install the man page, you may do: echo $MANPATH and choose one of the listed directories to copy the man-page under its ./man1 directory. Like: @@ -398,6 +397,19 @@ drive. See man page section FILES for a way to lift that ban. Special compilation variations +All following options of cdrskin/compile_cdrskin.sh are combinable. + +In some situations Linux delivers a better write performance to drives if +the track input is read with O_DIRECT (see man 2 open). The input reader of +the cdrskin fifo can be told to use this peculiar read mode by : + cdrskin/compile_cdrskin.sh -o_direct + +But typically cdrskin option dvd_obs=64k will yield even better performance in +such a situation. 64k can be made default at compile time by + cdrskin/compile_cdrskin.sh -dvd_obs_64k +It can also be enabled at configure time by + ./configure ... --enable-dvd-obs-64k ... + You may get a (super fat) statically linked binary by : cdrskin/compile_cdrskin.sh -static if your system supports static linking, at all. This will not help with kernels diff --git a/cdrskin/cdrskin_eng.html b/cdrskin/cdrskin_eng.html index 162b57b..fcc3172 100644 --- a/cdrskin/cdrskin_eng.html +++ b/cdrskin/cdrskin_eng.html @@ -193,7 +193,7 @@ Standalone ISO 9660 multi-session CD/DVD/BD tool

Download as source code (see README):
-
cdrskin-0.7.2.pl00.tar.gz +
cdrskin-0.7.2.pl01.tar.gz (780 KB).
@@ -262,6 +262,12 @@ Bug fixes towards cdrskin-0.7.0.pl00: --> +Bug fixes towards cdrskin-0.7.2.pl00: +
    +
  • Workaround for Pioneer DVR-216D which got stuck on DVD-R burns.
  • +
  • Workaround for Pioneer DVR-216D which did not always eject the tray.
  • +
+

@@ -269,8 +275,11 @@ Bug fixes towards cdrskin-0.7.0.pl00:

Development snapshot, version 0.7.3 :

Enhancements towards current stable version 0.7.2.pl00:
    -
  • none yet
  • +
  • Implemented option -V for logging of SCSI commands
  • +
  • New options dvd_obs= and stdio_fsync=
  • +
  • New compile_cdrskin.sh options -o_direct (Linux only), -dvd_obs_64k
@@ -278,8 +287,8 @@ Bug fixes towards cdrskin-0.7.0.pl00:
Bug fixes towards cdrskin-0.7.2.pl00:
    -
  • Workaround for firmware bug of Pioneer DVR-216D which prevented DVD-R -burns from ever ending.
  • +
  • Workaround for Pioneer DVR-216D which got stuck on DVD-R burns.
  • +
  • Workaround for Pioneer DVR-216D which did not always eject the tray.
  • @@ -311,7 +320,7 @@ admins with full system souvereignty.
cdrskin-0.7.3.tar.gz -(780 KB). +(800 KB).
- - -Bug fixes towards cdrskin-0.7.0.pl00: -
    -
  • CD TAO sessions with multiple tracks did not work in -dummy mode
  • +
  • Implemented option -V for logging of SCSI commands
  • +
  • New options dvd_obs= and stdio_fsync=
  • +
  • New ./configure options --enable-track-src-odirect, --enable-dvd-obs-64k +
  • +
  • New compile_cdrskin.sh option -dvd_obs_64k
  • @@ -266,40 +259,40 @@ Bug fixes towards cdrskin-0.7.2.pl00:
    • Workaround for Pioneer DVR-216D which got stuck on DVD-R burns.
    • Workaround for Pioneer DVR-216D which did not always eject the tray.
    • +
    • DVD DAO track size was rounded up much too generously
    • +
    • SIGSEGV from NULL pointer with media product id inquiry on LG GH22LS30
    • +

    -

    Development snapshot, version 0.7.3 :

    -
    Enhancements towards current stable version 0.7.2.pl00: +

    Development snapshot, version 0.7.5 :

    +
    Enhancements towards current stable version 0.7.4.pl00:
      -
    • Implemented option -V for logging of SCSI commands
    • -
    • New options dvd_obs= and stdio_fsync=
    • -
    • New compile_cdrskin.sh options -o_direct (Linux only), -dvd_obs_64k
    • -
    -
    Bug fixes towards cdrskin-0.7.2.pl00: +
    Bug fixes towards cdrskin-0.7.4.pl00:
      -
    • Workaround for Pioneer DVR-216D which got stuck on DVD-R burns.
    • -
    • Workaround for Pioneer DVR-216D which did not always eject the tray.
    • -
     
    -
    README 0.7.3 -
    cdrskin_0.7.3 --help
    -
    cdrskin_0.7.3 -help
    -
    man cdrskin (as of 0.7.3)
    +
    README 0.7.5 +
    cdrskin_0.7.5 --help
    +
    cdrskin_0.7.5 -help
    +
    man cdrskin (as of 0.7.5)
     
    Maintainers of cdrskin unstable packages please use SVN of libburnia-project.org
    @@ -319,8 +312,8 @@ admins with full system souvereignty. upcoming README ):
-cdrskin-0.7.3.tar.gz -(800 KB). +cdrskin-0.7.5.tar.gz +(810 KB).