From 719ef2a6d373e9d5887ca90ce3a413c868f18f30 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Tue, 14 Feb 2012 10:31:00 +0000 Subject: [PATCH] New API calls isoburn_get_attached_start_lba(), isoburn_attach_start_lba() --- libisoburn/isoburn.c | 1 + libisoburn/isoburn.h | 3 +++ libisoburn/isofs_wrap.c | 37 +++++++++++++++++++++++++++++++++++++ libisoburn/libisoburn.h | 19 +++++++++++++++++++ libisoburn/libisoburn.ver | 2 ++ xorriso/xorriso_timestamp.h | 2 +- 6 files changed, 63 insertions(+), 1 deletion(-) diff --git a/libisoburn/isoburn.c b/libisoburn/isoburn.c index 505b6a0b..85de46e7 100644 --- a/libisoburn/isoburn.c +++ b/libisoburn/isoburn.c @@ -142,6 +142,7 @@ int isoburn_new(struct isoburn **objpt, int flag) o->target_iso_head_size= Libisoburn_target_head_sizE; o->target_iso_head= NULL; o->image= NULL; + o->image_start_lba= -1; o->iso_data_source= NULL; o->read_pacifier= NULL; o->read_pacifier_handle= NULL; diff --git a/libisoburn/isoburn.h b/libisoburn/isoburn.h index 82ebc8dc..fd735965 100644 --- a/libisoburn/isoburn.h +++ b/libisoburn/isoburn.h @@ -141,6 +141,9 @@ struct isoburn { /* Libisofs image context */ IsoImage *image; + /* The start LBA of the image */ + int image_start_lba; + /* The block data source from which the existing image is read. */ IsoDataSource *iso_data_source; diff --git a/libisoburn/isofs_wrap.c b/libisoburn/isofs_wrap.c index 842b37d5..ddf66715 100644 --- a/libisoburn/isofs_wrap.c +++ b/libisoburn/isofs_wrap.c @@ -105,6 +105,21 @@ IsoImage *isoburn_get_attached_image(struct burn_drive *d) } +/* API */ +int isoburn_get_attached_start_lba(struct burn_drive *d) +{ + int ret; + struct isoburn *o= NULL; + + ret = isoburn_find_emulator(&o, d, 0); + if (ret < 0 || o == NULL) + return -1; + if(o->image == NULL) + return -1; + return o->image_start_lba; +} + + static void isoburn_idle_free_function(void *ignored) { return; @@ -133,6 +148,7 @@ int isoburn_read_image(struct burn_drive *d, if (ret < 0 || o == NULL) {ret= 0; goto ex;} status = isoburn_disc_get_status(d); + o->image_start_lba= -1; } if(read_opts==NULL) { isoburn_msgs_submit(o, 0x00060000, @@ -193,6 +209,8 @@ create_blank_image:; if (ret <= 0) {ret= -2; goto ex;} ms_block= int_num; + if (o != NULL) + o->image_start_lba= ms_block; ret = isoburn_read_iso_head(d, int_num, &dummy, NULL, 0); if (ret <= 0) { sprintf(msg, "No ISO 9660 image at LBA %d. Creating blank image.", int_num); @@ -312,10 +330,29 @@ int isoburn_attach_image(struct burn_drive *d, IsoImage *image) if(o->image != NULL) iso_image_unref(o->image); o->image = image; + o->image_start_lba = -1; return(1); } +/* API */ +int isoburn_attach_start_lba(struct burn_drive *d, int lba, int flag) +{ + int ret; + struct isoburn *o; + + ret = isoburn_find_emulator(&o, d, 0); + if(ret < 0) + return ret; + if(o == NULL) + return 0; + if(o->image == NULL) + return 0; + o->image_start_lba = lba; + return 1; +} + + /* API function. See libisoburn.h */ int isoburn_activate_session(struct burn_drive *drive) diff --git a/libisoburn/libisoburn.h b/libisoburn/libisoburn.h index e39fcf9d..f48d845b 100644 --- a/libisoburn/libisoburn.h +++ b/libisoburn/libisoburn.h @@ -1629,6 +1629,14 @@ int isoburn_igopt_get_disc_label(struct isoburn_imgen_opts *opts, */ IsoImage *isoburn_get_attached_image(struct burn_drive *d); +/** Get the start address of the image that is attached to the drive, if any. + @since 1.2.2 + @param d The drive to inquire + @return The logical block address where the System Area of the image + starts. <0 means that the address is invalid. +*/ +int isoburn_get_attached_start_lba(struct burn_drive *d); + /** Load the ISO filesystem directory tree from the medium in the given drive. This will give libisoburn the base on which it can let libisofs perform @@ -1714,6 +1722,17 @@ int isoburn_get_img_partition_offset(struct burn_drive *drive, int isoburn_attach_image(struct burn_drive *d, IsoImage *image); +/** Set the start address of the image that is attached to the drive, if any. + @since 1.2.2 + @param d The drive to inquire + @param lba The logical block address where the System Area of the image + starts. <0 means that the address is invalid. + @param flag Bitfield, submit 0 for now. + @return <=0 error (e.g. because no image is attached), 1 = success +*/ +int isoburn_attach_start_lba(struct burn_drive *d, int lba, int flag); + + /** Return the best possible estimation of the currently available capacity of the medium. This might depend on particular write option settings and on drive state. diff --git a/libisoburn/libisoburn.ver b/libisoburn/libisoburn.ver index 3ac45f5b..5da4eea1 100644 --- a/libisoburn/libisoburn.ver +++ b/libisoburn/libisoburn.ver @@ -2,6 +2,7 @@ LIBISOBURN1 { global: isoburn_activate_session; isoburn_attach_image; +isoburn_attach_start_lba; isoburn_cancel_prepared_write; isoburn_disc_available_space; isoburn_disc_erasable; @@ -18,6 +19,7 @@ isoburn_drive_set_msgs_submit; isoburn_drive_wrote_well; isoburn_finish; isoburn_get_attached_image; +isoburn_get_attached_start_lba; isoburn_get_fifo_status; isoburn_get_min_start_byte; isoburn_get_mount_params; diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 9fa7e0af..7f4e46c9 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2012.02.01.163200" +#define Xorriso_timestamP "2012.02.14.103107"