New API calls isoburn_get_attached_start_lba(), isoburn_attach_start_lba()

This commit is contained in:
Thomas Schmitt 2012-02-14 10:31:00 +00:00
parent a61a461fa0
commit 719ef2a6d3
6 changed files with 63 additions and 1 deletions

View File

@ -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_size= Libisoburn_target_head_sizE;
o->target_iso_head= NULL; o->target_iso_head= NULL;
o->image= NULL; o->image= NULL;
o->image_start_lba= -1;
o->iso_data_source= NULL; o->iso_data_source= NULL;
o->read_pacifier= NULL; o->read_pacifier= NULL;
o->read_pacifier_handle= NULL; o->read_pacifier_handle= NULL;

View File

@ -141,6 +141,9 @@ struct isoburn {
/* Libisofs image context */ /* Libisofs image context */
IsoImage *image; IsoImage *image;
/* The start LBA of the image */
int image_start_lba;
/* The block data source from which the existing image is read. /* The block data source from which the existing image is read.
*/ */
IsoDataSource *iso_data_source; IsoDataSource *iso_data_source;

View File

@ -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) static void isoburn_idle_free_function(void *ignored)
{ {
return; return;
@ -133,6 +148,7 @@ int isoburn_read_image(struct burn_drive *d,
if (ret < 0 || o == NULL) if (ret < 0 || o == NULL)
{ret= 0; goto ex;} {ret= 0; goto ex;}
status = isoburn_disc_get_status(d); status = isoburn_disc_get_status(d);
o->image_start_lba= -1;
} }
if(read_opts==NULL) { if(read_opts==NULL) {
isoburn_msgs_submit(o, 0x00060000, isoburn_msgs_submit(o, 0x00060000,
@ -193,6 +209,8 @@ create_blank_image:;
if (ret <= 0) if (ret <= 0)
{ret= -2; goto ex;} {ret= -2; goto ex;}
ms_block= int_num; ms_block= int_num;
if (o != NULL)
o->image_start_lba= ms_block;
ret = isoburn_read_iso_head(d, int_num, &dummy, NULL, 0); ret = isoburn_read_iso_head(d, int_num, &dummy, NULL, 0);
if (ret <= 0) { if (ret <= 0) {
sprintf(msg, "No ISO 9660 image at LBA %d. Creating blank image.", int_num); 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) if(o->image != NULL)
iso_image_unref(o->image); iso_image_unref(o->image);
o->image = image; o->image = image;
o->image_start_lba = -1;
return(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 /* API function. See libisoburn.h
*/ */
int isoburn_activate_session(struct burn_drive *drive) int isoburn_activate_session(struct burn_drive *drive)

View File

@ -1629,6 +1629,14 @@ int isoburn_igopt_get_disc_label(struct isoburn_imgen_opts *opts,
*/ */
IsoImage *isoburn_get_attached_image(struct burn_drive *d); 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. /** 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 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); 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 /** Return the best possible estimation of the currently available capacity of
the medium. This might depend on particular write option settings and on the medium. This might depend on particular write option settings and on
drive state. drive state.

View File

@ -2,6 +2,7 @@ LIBISOBURN1 {
global: global:
isoburn_activate_session; isoburn_activate_session;
isoburn_attach_image; isoburn_attach_image;
isoburn_attach_start_lba;
isoburn_cancel_prepared_write; isoburn_cancel_prepared_write;
isoburn_disc_available_space; isoburn_disc_available_space;
isoburn_disc_erasable; isoburn_disc_erasable;
@ -18,6 +19,7 @@ isoburn_drive_set_msgs_submit;
isoburn_drive_wrote_well; isoburn_drive_wrote_well;
isoburn_finish; isoburn_finish;
isoburn_get_attached_image; isoburn_get_attached_image;
isoburn_get_attached_start_lba;
isoburn_get_fifo_status; isoburn_get_fifo_status;
isoburn_get_min_start_byte; isoburn_get_min_start_byte;
isoburn_get_mount_params; isoburn_get_mount_params;

View File

@ -1 +1 @@
#define Xorriso_timestamP "2012.02.01.163200" #define Xorriso_timestamP "2012.02.14.103107"