"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xorriso/write_run.c" between
xorriso-1.4.6.tar.gz and xorriso-1.4.8.tar.gz

About: GNU xorriso creates, loads, manipulates and writes ISO 9660 filesystem images with Rock Ridge extensions. It is suitable for incremental data backup and for production of bootable ISO 9660 images. GNU xorriso is a statical compilation of the libraries libburn, libisofs, libisoburn, and libjte.

write_run.c  (xorriso-1.4.6):write_run.c  (xorriso-1.4.8)
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
Copyright 2007-2016 Thomas Schmitt, <scdbackup@gmx.net> Copyright 2007-2017 Thomas Schmitt, <scdbackup@gmx.net>
Provided under GPL version 2 or later. Provided under GPL version 2 or later.
This file contains functions which are needed to write sessions. This file contains functions which are needed to write sessions.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "../config.h" #include "../config.h"
#endif #endif
skipping to change at line 747 skipping to change at line 747
if(platform_id == 0xef) { if(platform_id == 0xef) {
strcat(xorriso->info_text, strcat(xorriso->info_text,
"Will record 0 in El Torito to extend ESP to end-of-medium."); "Will record 0 in El Torito to extend ESP to end-of-medium.");
load_size= 0; load_size= 0;
} else { } else {
strcat(xorriso->info_text, "Will record 65535 in El Torito."); strcat(xorriso->info_text, "Will record 65535 in El Torito.");
load_size= 65535 * 512; load_size= 65535 * 512;
} }
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
} }
/* The function will understand negative short as positive unsigned */
el_torito_set_load_size(bootimg, (short) (load_size / 512)); if(xorriso->boot_img_full_size) {
el_torito_set_full_load(bootimg, 1);
} else {
/* The function will understand negative short as positive unsigned */
el_torito_set_load_size(bootimg, (short) (load_size / 512));
}
el_torito_set_id_string(bootimg, xorriso->boot_id_string); el_torito_set_id_string(bootimg, xorriso->boot_id_string);
el_torito_set_selection_crit(bootimg, xorriso->boot_selection_crit); el_torito_set_selection_crit(bootimg, xorriso->boot_selection_crit);
ret= Xorriso_set_isolinux_options(xorriso, image, 1); ret= Xorriso_set_isolinux_options(xorriso, image, 1);
if(!(flag & 1)) { if(!(flag & 1)) {
/* Register attachment and reset even in case of error return */ /* Register attachment and reset even in case of error return */
xorriso->boot_count++; xorriso->boot_count++;
xorriso->boot_platform_id= 0; xorriso->boot_platform_id= 0;
xorriso->patch_isolinux_image= 0; xorriso->patch_isolinux_image= 0;
xorriso->boot_image_bin_path[0]= 0; xorriso->boot_image_bin_path[0]= 0;
xorriso->boot_image_bin_form[0]= 0; xorriso->boot_image_bin_form[0]= 0;
xorriso->boot_image_emul= 0; xorriso->boot_image_emul= 0;
xorriso->boot_emul_default= 1; xorriso->boot_emul_default= 1;
xorriso->boot_image_load_size= 4 * 512; xorriso->boot_image_load_size= 4 * 512;
xorriso->boot_img_size_default= 1;
xorriso->boot_img_full_size= 0;
memset(xorriso->boot_id_string, 0, sizeof(xorriso->boot_id_string)); memset(xorriso->boot_id_string, 0, sizeof(xorriso->boot_id_string));
memset(xorriso->boot_selection_crit, 0, memset(xorriso->boot_selection_crit, 0,
sizeof(xorriso->boot_selection_crit)); sizeof(xorriso->boot_selection_crit));
xorriso->boot_efi_default= 0; xorriso->boot_efi_default= 0;
} }
if(ret <= 0) if(ret <= 0)
goto ex; goto ex;
ret= 1; ret= 1;
ex:; ex:;
skipping to change at line 847 skipping to change at line 855
ret= Xorriso_write_session(xorriso, 0); ret= Xorriso_write_session(xorriso, 0);
xorriso->do_close= do_close_mem; xorriso->do_close= do_close_mem;
xorriso->auto_close= auto_close_mem; xorriso->auto_close= auto_close_mem;
return(ret); return(ret);
} }
int Xorriso_make_iso_write_opts(struct XorrisO *xorriso, IsoImage *image, int Xorriso_make_iso_write_opts(struct XorrisO *xorriso, IsoImage *image,
struct isoburn_imgen_opts *sopts, int flag) struct isoburn_imgen_opts *sopts, int flag)
{ {
int ext, i, ret, pad_by_libisofs= 0, is_bootable= 0, relax, intvl_string= 0; int ext, i, ret, pad_by_libisofs= 0, is_bootable= 0, relax, intvl_string= 0;
int intvl_check= 2; /* 3 forbids "imported_iso" */
char *out_cs, *part_image; char *out_cs, *part_image;
IsoNode *root_node; IsoNode *root_node;
uint32_t padding; uint32_t padding;
relax= xorriso->relax_compliance; relax= xorriso->relax_compliance;
if(image != NULL) if(image != NULL)
is_bootable= iso_image_get_boot_image(image, NULL, NULL, NULL); is_bootable= iso_image_get_boot_image(image, NULL, NULL, NULL);
/* xorriso->patch_isolinux_image gets reset in Xorriso_attach_boot_image() /* xorriso->patch_isolinux_image gets reset in Xorriso_attach_boot_image()
So this applies only to -boot_image ... "patch" or "keep". So this applies only to -boot_image ... "patch" or "keep".
skipping to change at line 909 skipping to change at line 918
(uid_t) xorriso->global_uid, (uid_t) xorriso->global_uid,
(gid_t) xorriso->global_gid); (gid_t) xorriso->global_gid);
isoburn_igopt_set_out_charset(sopts, out_cs); isoburn_igopt_set_out_charset(sopts, out_cs);
isoburn_igopt_set_fifo_size(sopts, xorriso->fs * 2048); isoburn_igopt_set_fifo_size(sopts, xorriso->fs * 2048);
Ftimetxt(time(NULL), xorriso->scdbackup_tag_time, 8); Ftimetxt(time(NULL), xorriso->scdbackup_tag_time, 8);
isoburn_igopt_set_scdbackup_tag(sopts, xorriso->scdbackup_tag_name, isoburn_igopt_set_scdbackup_tag(sopts, xorriso->scdbackup_tag_name,
xorriso->scdbackup_tag_time, xorriso->scdbackup_tag_time,
xorriso->scdbackup_tag_written); xorriso->scdbackup_tag_written);
if(xorriso->prep_partition[0]) { if(xorriso->prep_partition[0]) {
part_image= xorriso->prep_partition; part_image= xorriso->prep_partition;
intvl_string= Xorriso_check_intvl_string(xorriso, &part_image, 3); intvl_string= Xorriso_check_intvl_string(xorriso, &part_image, intvl_check);
if(intvl_string < 0) if(intvl_string < 0)
{ret= 0; goto ex;} {ret= 0; goto ex;}
ret= isoburn_igopt_set_prep_partition(sopts, part_image, intvl_string); ret= isoburn_igopt_set_prep_partition(sopts, part_image, intvl_string);
if(ret <= 0) if(ret <= 0)
{ret= 0; goto ex;} {ret= 0; goto ex;}
} }
if(xorriso->efi_boot_partition[0]) { if(xorriso->efi_boot_partition[0]) {
part_image= xorriso->efi_boot_partition; part_image= xorriso->efi_boot_partition;
intvl_string= Xorriso_check_intvl_string(xorriso, &part_image, 3); intvl_string= Xorriso_check_intvl_string(xorriso, &part_image, intvl_check);
if(intvl_string < 0) if(intvl_string < 0)
{ret= 0; goto ex;} {ret= 0; goto ex;}
ret= isoburn_igopt_set_efi_bootp(sopts, part_image, intvl_string); ret= isoburn_igopt_set_efi_bootp(sopts, part_image, intvl_string);
if(ret <= 0) if(ret <= 0)
{ret= 0; goto ex;} {ret= 0; goto ex;}
} }
for(i= 0; i < Xorriso_max_appended_partitionS; i++) { for(i= 0; i < Xorriso_max_appended_partitionS; i++) {
if(xorriso->appended_partitions[i] == NULL) if(xorriso->appended_partitions[i] == NULL)
continue; continue;
if(xorriso->appended_partitions[i][0] == 0) if(xorriso->appended_partitions[i][0] == 0)
continue; continue;
if(strcmp(xorriso->appended_partitions[i], ".") == 0) if(strcmp(xorriso->appended_partitions[i], ".") == 0)
part_image= ""; part_image= "";
else else
part_image= xorriso->appended_partitions[i]; part_image= xorriso->appended_partitions[i];
intvl_string= Xorriso_check_intvl_string(xorriso, &part_image, 3); intvl_string= Xorriso_check_intvl_string(xorriso, &part_image, intvl_check);
if(intvl_string < 0) if(intvl_string < 0)
{ret= 0; goto ex;} {ret= 0; goto ex;}
isoburn_igopt_set_partition_img(sopts, i + 1, isoburn_igopt_set_partition_img(sopts, i + 1,
xorriso->appended_part_types[i], part_image); xorriso->appended_part_types[i], part_image);
isoburn_igopt_set_part_flag(sopts, i + 1, intvl_string); isoburn_igopt_set_part_flag(sopts, i + 1, intvl_string);
} }
isoburn_igopt_set_appended_as_gpt(sopts, xorriso->appended_as_gpt); isoburn_igopt_set_appended_as_gpt(sopts, xorriso->appended_as_gpt);
isoburn_igopt_set_appended_as_apm(sopts, xorriso->appended_as_apm); isoburn_igopt_set_appended_as_apm(sopts, xorriso->appended_as_apm);
isoburn_igopt_set_part_like_isohybrid(sopts, xorriso->part_like_isohybrid); isoburn_igopt_set_part_like_isohybrid(sopts, xorriso->part_like_isohybrid);
isoburn_igopt_set_iso_mbr_part_type(sopts, xorriso->iso_mbr_part_type);
isoburn_igopt_set_gpt_guid(sopts, xorriso->gpt_guid, xorriso->gpt_guid_mode); isoburn_igopt_set_gpt_guid(sopts, xorriso->gpt_guid, xorriso->gpt_guid_mode);
isoburn_igopt_set_disc_label(sopts, xorriso->ascii_disc_label); isoburn_igopt_set_disc_label(sopts, xorriso->ascii_disc_label);
isoburn_igopt_set_hfsp_serial_number(sopts, xorriso->hfsp_serial_number); isoburn_igopt_set_hfsp_serial_number(sopts, xorriso->hfsp_serial_number);
isoburn_igopt_set_hfsp_block_size(sopts, xorriso->hfsp_block_size, isoburn_igopt_set_hfsp_block_size(sopts, xorriso->hfsp_block_size,
xorriso->apm_block_size); xorriso->apm_block_size);
isoburn_igopt_set_pvd_times(sopts, isoburn_igopt_set_pvd_times(sopts,
xorriso->vol_creation_time, xorriso->vol_modification_time, xorriso->vol_creation_time, xorriso->vol_modification_time,
xorriso->vol_expiration_time, xorriso->vol_effective_time, xorriso->vol_expiration_time, xorriso->vol_effective_time,
xorriso->vol_uuid); xorriso->vol_uuid);
skipping to change at line 1058 skipping to change at line 1068
return(!was_failure); return(!was_failure);
} }
/* @param flag bit0= do not write but only prepare and return size in sectors /* @param flag bit0= do not write but only prepare and return size in sectors
@return <=0 error , 1= success @return <=0 error , 1= success
2= failure with DVD-RW, please call Xorriso_retry_write_session() 2= failure with DVD-RW, please call Xorriso_retry_write_session()
*/ */
int Xorriso_write_session(struct XorrisO *xorriso, int flag) int Xorriso_write_session(struct XorrisO *xorriso, int flag)
{ {
int ret, i, pacifier_speed= 0, data_lba, is_bootable= 0; int ret, i, pacifier_speed= 0, data_lba, is_bootable= 0;
int freshly_bootable= 0, hide_attr, signal_mode, role; int freshly_bootable= 0, hide_attr, signal_mode, role, is_bdr_pow= 0;
char *xorriso_id= NULL, *img_id, *sfe= NULL, *out_cs; char *xorriso_id= NULL, *img_id, *sfe= NULL, *out_cs;
struct isoburn_imgen_opts *sopts= NULL; struct isoburn_imgen_opts *sopts= NULL;
struct burn_drive_info *dinfo, *source_dinfo; struct burn_drive_info *dinfo, *source_dinfo;
struct burn_drive *drive, *source_drive; struct burn_drive *drive, *source_drive;
struct burn_disc *disc= NULL; struct burn_disc *disc= NULL;
struct burn_write_opts *burn_options= NULL; struct burn_write_opts *burn_options= NULL;
off_t readcounter= 0,writecounter= 0; off_t readcounter= 0,writecounter= 0;
int num_sessions= 0, num_tracks= 0; int num_sessions= 0, num_tracks= 0;
struct burn_session **sessions; struct burn_session **sessions;
struct burn_track **tracks; struct burn_track **tracks;
skipping to change at line 1102 skipping to change at line 1112
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
"on attempt to write", 2); "on attempt to write", 2);
if(ret<=0) if(ret<=0)
goto ex; goto ex;
if(!(flag & 1)) { if(!(flag & 1)) {
ret= Xorriso_auto_format(xorriso, 0); ret= Xorriso_auto_format(xorriso, 0);
if(ret <=0 ) if(ret <=0 )
{ret= 0; goto ex;} {ret= 0; goto ex;}
} }
is_bdr_pow= burn_drive_get_bd_r_pow(drive);
if(is_bdr_pow) {
sprintf(xorriso->info_text,
"May not write to Pseudo Overwrite formatted BD-R medium");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
{ret= 0; goto ex;}
}
s= isoburn_disc_get_status(drive); s= isoburn_disc_get_status(drive);
if (xorriso->do_hfsplus && ( if (xorriso->do_hfsplus && (
(xorriso->grow_blindly_msc2 >= 0 && (xorriso->grow_blindly_msc2 >= 0 &&
xorriso->out_drive_handle != xorriso->in_drive_handle) xorriso->out_drive_handle != xorriso->in_drive_handle)
|| ||
(xorriso->out_drive_handle == xorriso->in_drive_handle && (xorriso->out_drive_handle == xorriso->in_drive_handle &&
s != BURN_DISC_BLANK) s != BURN_DISC_BLANK)
)) { )) {
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"May not grow ISO image while -hfsplus is enabled"); "May not grow ISO image while -hfsplus is enabled");
skipping to change at line 2951 skipping to change at line 2969
if(ret < to_write) { if(ret < to_write) {
Xorriso_process_msg_queues(xorriso,0); Xorriso_process_msg_queues(xorriso,0);
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"Cannot write ISO image head to file copy"); "Cannot write ISO image head to file copy");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",0);
return(0); return(0);
} }
} else { } else {
/* This is a regular superblock relocation. Write full 64 kB. */ /* This is a regular superblock relocation. Write full 64 kB. */
to_write= 64 * 1024; to_write= 64 * 1024;
burn_drive_reset_simulate(drive, xorriso->do_dummy);
ret= burn_random_access_write(drive, (off_t) 0, head_buffer, to_write, 1); ret= burn_random_access_write(drive, (off_t) 0, head_buffer, to_write, 1);
if(ret<=0) { if(ret<=0) {
Xorriso_process_msg_queues(xorriso,0); Xorriso_process_msg_queues(xorriso,0);
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"Cannot write new ISO image head to LBA 0"); "Cannot write new ISO image head to LBA 0");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0); return(0);
} }
} }
if(flag & 4) { if(flag & 4) {
 End of changes. 11 change blocks. 
7 lines changed or deleted 26 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)