[Libburn] [Patch] burn_read_opts_*
Chris Anderson
chris@simoniac.com
Mon, 15 Dec 2003 21:27:06 -0500
--=-rNiLrH9bShFiT1coQMo3
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Time for another minor patch :)
Added:
-burn_read_opts_set_raw_mode()
-burn_read_opts_set_c2errors()
-burn_read_opts_read_subcodes_audio()
-burn_read_opts_read_subcodes_data()
-burn_read_opts_set_hardware_error_recovery()
-burn_read_opts_report_recovered_errors()
-burn_read_opts_transfer_damaged_blocks()
-burn_read_opts_set_hardware_error_retries()
Removed:
-burn_read_opts.version
Other changes:
-struct burn_read_opts has been moved from libburn.h to options.h
-Chris
--=-rNiLrH9bShFiT1coQMo3
Content-Disposition: attachment; filename=patch_burn_read_opts.diff
Content-Type: text/x-patch; name=patch_burn_read_opts.diff; charset=ANSI_X3.4-1968
Content-Transfer-Encoding: 7bit
? patch_burn_read_opts.diff
? libburn/semantic.cache
Index: libburn/libburn.h
===================================================================
RCS file: /cvs/burn/burn/libburn/libburn.h,v
retrieving revision 1.177
diff -p -u -r1.177 libburn.h
--- libburn/libburn.h 15 Dec 2003 21:17:17 -0000 1.177
+++ libburn/libburn.h 16 Dec 2003 02:26:45 -0000
@@ -356,38 +356,6 @@ struct burn_message
} detail;
};
-/** 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
-{
- /** For internal use. */
- int version;
- /** For internal use. */
- int refcount;
-
- /** Read in raw mode, so that everything in the data tracks on the
- disc is read, including headers. Not needed if just reading a
- filesystem off a disc, but it should usually be used when making a
- disc image or copying a disc. */
- int raw:1;
- /** Report c2 errors. Useful for statistics reporting */
- int c2errors:1;
- /** Read subcodes from audio tracks on the disc */
- int subcodes_audio:1;
- /** Read subcodes from data tracks on the disc */
- int subcodes_data:1;
- /** Have the drive recover errors if possible */
- int hardware_error_recovery:1;
- /** Report errors even when they were recovered from */
- int report_recovered_errors:1;
- /** Read blocks even when there are unrecoverable errors in them */
- int transfer_damaged_blocks:1;
-
- /** The number of retries the hardware should make to correct
- errors. */
- unsigned char hardware_error_retries;
-};
-
/** Operation progress report. All values are 0 based indices.
* */
struct burn_progress {
@@ -744,6 +712,56 @@ void burn_write_opts_has_mediacatalog(st
/** Sets the media catalog for the write_ops struct */
void burn_write_opts_set_mediacatalog(struct burn_write_opts *opts, unsigned char mediacatalog[13]);
+
+/** Sets whether to read in raw mode or not
+ @param opts The read opts to change
+ @param raw_mode If non-zero, reading will be done in raw mode, so that everything in the data tracks on the
+ disc is read, including headers.
+*/
+void burn_read_opts_set_raw(struct burn_read_opts *opts, int raw);
+
+/** Sets whether to report c2 errors or not
+ @param opts The read opts to change
+ @param c2errors If non-zero, report c2 errors.
+*/
+void burn_read_opts_set_c2errors(struct burn_read_opts *opts, int c2errors);
+
+/** Sets whether to read subcodes from audio tracks or not
+ @param opts The read opts to change
+ @param subcodes_audio If non-zero, read subcodes from audio tracks on the disc.
+*/
+void burn_read_opts_read_subcodes_audio(struct burn_read_opts *opts, int subcodes_audio);
+
+/** Sets whether to read subcodes from data tracks or not
+ @param opts The read opts to change
+ @param subcodes_data If non-zero, read subcodes from data tracks on the disc.
+*/
+void burn_read_opts_read_subcodes_data(struct burn_read_opts *opts, int subcodes_data);
+
+/** Sets whether to recover errors if possible
+ @param opts The read opts to change
+ @param hardware_error_recovery If non-zero, attempt to recover errors if possible.
+*/
+void burn_read_opts_set_hardware_error_recovery(struct burn_read_opts *opts, int hardware_error_recovery);
+
+/** Sets whether to report recovered errors or not
+ @param opts The read opts to change
+ @param report_recovered_errors If non-zero, recovered errors will be reported.
+*/
+void burn_read_opts_report_recovered_errors(struct burn_read_opts *opts, int report_recovered_errors);
+
+/** Sets whether blocks with unrecoverable errors should be read or not
+ @param opts The read opts to change
+ @param transfer_damaged_blocks If non-zero, blocks with unrecoverable errors will still be read.
+*/
+void burn_read_opts_transfer_damaged_blocks(struct burn_read_opts *opts, int transfer_damaged_blocks);
+
+/** Sets the number of retries to attempt when trying to correct an error
+ @param opts The read opts to change
+ @param hardware_error_retries The number of retries to attempt when correcting an error.
+*/
+void burn_read_opts_set_hardware_error_retries(struct burn_read_opts *opts, unsigned char hardware_error_retries);
+
#ifndef DOXYGEN
BURN_END_DECLS
Index: libburn/mmc.c
===================================================================
RCS file: /cvs/burn/burn/libburn/mmc.c,v
retrieving revision 1.128
diff -p -u -r1.128 mmc.c
--- libburn/mmc.c 15 Dec 2003 04:52:51 -0000 1.128
+++ libburn/mmc.c 16 Dec 2003 02:26:46 -0000
@@ -14,6 +14,7 @@
#include "debug.h"
#include "toc.h"
#include "structure.h"
+#include "options.h"
static unsigned char MMC_GET_TOC[] = { 0x43, 2, 2, 0, 0, 0, 0, 16, 0, 0 };
static unsigned char MMC_GET_ATIP[] = { 0x43, 2, 4, 0, 0, 0, 0, 16, 0, 0 };
Index: libburn/options.c
===================================================================
RCS file: /cvs/burn/burn/libburn/options.c,v
retrieving revision 1.7
diff -p -u -r1.7 options.c
--- libburn/options.c 15 Dec 2003 21:17:17 -0000 1.7
+++ libburn/options.c 16 Dec 2003 02:26:46 -0000
@@ -33,7 +33,6 @@ struct burn_read_opts* burn_read_opts_ne
opts = malloc(sizeof(struct burn_read_opts));
- opts->version = OPTIONS_VERSION;
opts->refcount = 1;
opts->raw = 0;
opts->c2errors = 0;
@@ -94,3 +93,43 @@ void burn_write_opts_set_mediacatalog(st
{
memcpy(opts->mediacatalog, &mediacatalog, 13);
}
+
+void burn_read_opts_set_raw_mode(struct burn_read_opts *opts, int raw)
+{
+ opts->raw = raw;
+}
+
+void burn_read_opts_set_c2errors(struct burn_read_opts *opts, int c2errors)
+{
+ opts->c2errors = c2errors;
+}
+
+void burn_read_opts_read_subcodes_audio(struct burn_read_opts *opts, int subcodes_audio)
+{
+ opts->subcodes_audio = subcodes_audio;
+}
+
+void burn_read_opts_read_subcodes_data(struct burn_read_opts *opts, int subcodes_data)
+{
+ opts->subcodes_data = subcodes_data;
+}
+
+void burn_read_opts_set_hardware_error_recovery(struct burn_read_opts *opts, int hardware_error_recovery)
+{
+ opts->hardware_error_recovery = hardware_error_recovery;
+}
+
+void burn_read_opts_report_recovered_errors(struct burn_read_opts *opts, int report_recovered_errors)
+{
+ opts->report_recovered_errors = report_recovered_errors;
+}
+
+void burn_read_opts_transfer_damaged_blocks(struct burn_read_opts *opts, int transfer_damaged_blocks)
+{
+ opts->transfer_damaged_blocks = transfer_damaged_blocks;
+}
+
+void burn_read_opts_set_hardware_error_retries(struct burn_read_opts *opts, unsigned char hardware_error_retries)
+{
+ opts->hardware_error_retries = hardware_error_retries;
+}
Index: libburn/options.h
===================================================================
RCS file: /cvs/burn/burn/libburn/options.h,v
retrieving revision 1.3
diff -p -u -r1.3 options.h
--- libburn/options.h 15 Dec 2003 21:17:17 -0000 1.3
+++ libburn/options.h 16 Dec 2003 02:26:46 -0000
@@ -34,4 +34,34 @@ struct burn_write_opts
unsigned char mediacatalog[13];
};
+/** 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
+{
+ /** For internal use. */
+ int refcount;
+
+ /** Read in raw mode, so that everything in the data tracks on the
+ disc is read, including headers. Not needed if just reading a
+ filesystem off a disc, but it should usually be used when making a
+ disc image or copying a disc. */
+ int raw:1;
+ /** Report c2 errors. Useful for statistics reporting */
+ int c2errors:1;
+ /** Read subcodes from audio tracks on the disc */
+ int subcodes_audio:1;
+ /** Read subcodes from data tracks on the disc */
+ int subcodes_data:1;
+ /** Have the drive recover errors if possible */
+ int hardware_error_recovery:1;
+ /** Report errors even when they were recovered from */
+ int report_recovered_errors:1;
+ /** Read blocks even when there are unrecoverable errors in them */
+ int transfer_damaged_blocks:1;
+
+ /** The number of retries the hardware should make to correct
+ errors. */
+ unsigned char hardware_error_retries;
+};
+
#endif /* BURN__OPTIONS_H */
Index: libburn/toc.c
===================================================================
RCS file: /cvs/burn/burn/libburn/toc.c,v
retrieving revision 1.34
diff -p -u -r1.34 toc.c
--- libburn/toc.c 15 Dec 2003 04:52:51 -0000 1.34
+++ libburn/toc.c 16 Dec 2003 02:26:46 -0000
@@ -8,6 +8,7 @@
#include "transport.h"
#include "libburn.h"
#include "sector.h"
+#include "options.h"
#if 0
static void write_clonecd2(volatile struct toc *toc, int f);
--=-rNiLrH9bShFiT1coQMo3--