New API call iso_write_opts_set_will_cancel()

This commit is contained in:
Thomas Schmitt 2010-11-24 11:00:21 +01:00
parent 48ae8acbd6
commit b2997dcc46
4 changed files with 39 additions and 1 deletions

View File

@ -1412,7 +1412,9 @@ void *write_function(void *arg)
target->eff_partition_offset = 0; target->eff_partition_offset = 0;
if (res == ISO_CANCELED) { if (res == ISO_CANCELED) {
/* canceled */ /* canceled */
iso_msg_submit(target->image->id, ISO_IMAGE_WRITE_CANCELED, 0, NULL); if (!target->will_cancel)
iso_msg_submit(target->image->id, ISO_IMAGE_WRITE_CANCELED,
0, NULL);
} else { } else {
/* image write error */ /* image write error */
iso_msg_submit(target->image->id, ISO_WRITE_ERROR, res, iso_msg_submit(target->image->id, ISO_WRITE_ERROR, res,
@ -1565,6 +1567,7 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
target->image = src; target->image = src;
iso_image_ref(src); iso_image_ref(src);
target->will_cancel = opts->will_cancel;
target->iso_level = opts->level; target->iso_level = opts->level;
target->rockridge = opts->rockridge; target->rockridge = opts->rockridge;
target->joliet = opts->joliet; target->joliet = opts->joliet;
@ -2330,6 +2333,7 @@ int iso_write_opts_new(IsoWriteOpts **opts, int profile)
for (i = 0; i < ISO_MAX_PARTITIONS; i++) for (i = 0; i < ISO_MAX_PARTITIONS; i++)
wopts->appended_partitions[i] = NULL; wopts->appended_partitions[i] = NULL;
wopts->ascii_disc_label[0] = 0; wopts->ascii_disc_label[0] = 0;
wopts->will_cancel = 0;
*opts = wopts; *opts = wopts;
return ISO_SUCCESS; return ISO_SUCCESS;
@ -2352,6 +2356,15 @@ void iso_write_opts_free(IsoWriteOpts *opts)
free(opts); free(opts);
} }
int iso_write_opts_set_will_cancel(IsoWriteOpts *opts, int will_cancel)
{
if (opts == NULL) {
return ISO_NULL_POINTER;
}
opts->will_cancel = !!will_cancel;
return ISO_SUCCESS;
}
int iso_write_opts_set_iso_level(IsoWriteOpts *opts, int level) int iso_write_opts_set_iso_level(IsoWriteOpts *opts, int level)
{ {
if (opts == NULL) { if (opts == NULL) {

View File

@ -57,6 +57,8 @@
*/ */
struct iso_write_opts { struct iso_write_opts {
int will_cancel;
int level; /**< ISO level to write at. (ECMA-119, 10) */ int level; /**< ISO level to write at. (ECMA-119, 10) */
/** Which extensions to support. */ /** Which extensions to support. */
@ -379,6 +381,8 @@ struct ecma119_image
IsoImage *image; IsoImage *image;
Ecma119Node *root; Ecma119Node *root;
int will_cancel :1;
unsigned int iso_level :2; unsigned int iso_level :2;
/* extensions */ /* extensions */

View File

@ -1205,6 +1205,26 @@ int iso_write_opts_new(IsoWriteOpts **opts, int profile);
*/ */
void iso_write_opts_free(IsoWriteOpts *opts); void iso_write_opts_free(IsoWriteOpts *opts);
/**
* Announce that only the image size is desired and that the write thread
* will be cancelled by the .cancel() method of the struct burn_source that
* consumes the image output stream.
* This avoids to generate a MISHAP event when the effect of .cancel()
* reaches the image generator thread.
*
* @param opts
* The option set to be manipulated.
* @param will_cancel
* 0= normal image generation
* 1= prepare for being canceled before image stream output is completed
* @return
* 1 success, < 0 error
*
* @since 0.6.40
*/
int iso_write_opts_set_will_cancel(IsoWriteOpts *opts, int will_cancel);
/** /**
* Set the ISO-9960 level to write at. * Set the ISO-9960 level to write at.
* *

View File

@ -293,6 +293,7 @@ iso_write_opts_set_scdbackup_tag;
iso_write_opts_set_sort_files; iso_write_opts_set_sort_files;
iso_write_opts_set_system_area; iso_write_opts_set_system_area;
iso_write_opts_set_tail_blocks; iso_write_opts_set_tail_blocks;
iso_write_opts_set_will_cancel;
iso_zisofs_get_params; iso_zisofs_get_params;
iso_zisofs_get_refcounts; iso_zisofs_get_refcounts;
iso_zisofs_set_params; iso_zisofs_set_params;