2010-05-15 18:48:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
|
|
|
|
|
2023-01-22 15:19:28 +00:00
|
|
|
Copyright 2007-2023 Thomas Schmitt, <scdbackup@gmx.net>
|
2010-05-15 18:48:10 +00:00
|
|
|
|
|
|
|
Provided under GPL version 2 or later.
|
|
|
|
|
|
|
|
This file contains functions which are needed to read data
|
|
|
|
from ISO image.
|
|
|
|
*/
|
|
|
|
|
2010-05-16 09:32:14 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "../config.h"
|
|
|
|
#endif
|
|
|
|
|
2010-05-15 18:48:10 +00:00
|
|
|
#include <ctype.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <errno.h>
|
2012-09-11 09:28:05 +00:00
|
|
|
#include <pthread.h>
|
2011-01-18 15:47:18 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_STDINT_H
|
2010-09-29 09:24:20 +00:00
|
|
|
#include <stdint.h>
|
2011-01-18 15:47:18 +00:00
|
|
|
#else
|
|
|
|
#ifdef HAVE_INTTYPES_H
|
|
|
|
#include <inttypes.h>
|
|
|
|
#endif
|
|
|
|
#endif
|
2010-09-29 09:24:20 +00:00
|
|
|
|
2010-10-15 12:55:03 +00:00
|
|
|
#ifdef Xorriso_standalonE
|
2010-10-07 11:49:41 +00:00
|
|
|
|
2010-09-29 09:24:20 +00:00
|
|
|
#ifdef Xorriso_with_libjtE
|
2010-10-07 11:49:41 +00:00
|
|
|
#include "../libjte/libjte.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
2010-10-07 18:13:58 +00:00
|
|
|
#ifdef Xorriso_with_libjtE
|
2010-09-29 09:24:20 +00:00
|
|
|
#include <libjte/libjte.h>
|
|
|
|
#endif
|
2010-05-15 18:48:10 +00:00
|
|
|
|
2010-10-15 12:55:03 +00:00
|
|
|
#endif /* ! Xorriso_standalonE */
|
2010-10-07 11:49:41 +00:00
|
|
|
|
2010-05-15 18:48:10 +00:00
|
|
|
#include "xorriso.h"
|
|
|
|
#include "xorriso_private.h"
|
|
|
|
|
|
|
|
#include "base_obj.h"
|
|
|
|
#include "lib_mgt.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* See Xorriso__preset_signal_behavior() */
|
|
|
|
static int Xorriso_signal_behavioR= 1;
|
|
|
|
|
|
|
|
|
2010-05-21 13:37:25 +00:00
|
|
|
void Xorriso__version(int *major, int *minor, int *micro)
|
2010-05-15 18:48:10 +00:00
|
|
|
{
|
2010-05-21 13:37:25 +00:00
|
|
|
*major= Xorriso_header_version_majoR;
|
|
|
|
*minor= Xorriso_header_version_minoR;
|
|
|
|
*micro= Xorriso_header_version_micrO;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int Xorriso__is_compatible(int major, int minor, int micro, int flag)
|
|
|
|
{
|
|
|
|
int own_major, own_minor, own_micro;
|
|
|
|
|
|
|
|
Xorriso__version(&own_major, &own_minor, &own_micro);
|
|
|
|
return(own_major > major ||
|
|
|
|
(own_major == major && (own_minor > minor ||
|
|
|
|
(own_minor == minor && own_micro >= micro))));
|
2010-05-15 18:48:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char *Xorriso__get_patch_level_text(int flag)
|
|
|
|
{
|
|
|
|
return(Xorriso_program_patch_leveL);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** The list of startup file names */
|
|
|
|
#define Xorriso_rc_nuM 4
|
|
|
|
|
|
|
|
static char Xorriso_sys_rc_nameS[Xorriso_rc_nuM][80]= {
|
|
|
|
"/etc/default/xorriso",
|
|
|
|
"/etc/opt/xorriso/rc",
|
|
|
|
"/etc/xorriso/xorriso.conf",
|
|
|
|
"placeholder for $HOME/.xorrisorc"
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
|
|
|
|
{
|
|
|
|
int i, ret;
|
|
|
|
struct XorrisO *m;
|
2011-05-02 09:16:27 +00:00
|
|
|
char *leafname= NULL;
|
|
|
|
|
|
|
|
leafname= TSOB_FELD(char, SfileadrL);
|
|
|
|
if(leafname == NULL)
|
|
|
|
return(-1);
|
2010-05-15 18:48:10 +00:00
|
|
|
*xorriso= m= TSOB_FELD(struct XorrisO,1);
|
2011-05-02 09:16:27 +00:00
|
|
|
if(m==NULL) {
|
|
|
|
free(leafname);
|
2010-05-15 18:48:10 +00:00
|
|
|
return(-1);
|
2011-05-02 09:16:27 +00:00
|
|
|
}
|
2014-06-14 19:22:41 +00:00
|
|
|
|
|
|
|
/* Base initialization by actions which must not fail */
|
|
|
|
|
2010-05-15 18:48:10 +00:00
|
|
|
m->libs_are_started= 0;
|
|
|
|
strncpy(m->progname,progname,sizeof(m->progname)-1);
|
|
|
|
m->progname[sizeof(m->progname)-1]= 0;
|
|
|
|
if(getcwd(m->initial_wdx,sizeof(m->initial_wdx)-1)==NULL)
|
|
|
|
m->initial_wdx[0]= 0;
|
|
|
|
m->no_rc= 0;
|
|
|
|
m->argument_emulation= 0;
|
|
|
|
|
|
|
|
m->rc_filename_count= Xorriso_rc_nuM;
|
|
|
|
for(i=0;i<m->rc_filename_count-1;i++)
|
|
|
|
strcpy(m->rc_filenames[i],Xorriso_sys_rc_nameS[i]);
|
|
|
|
m->rc_filenames[m->rc_filename_count-1][0]= 0;
|
2012-01-31 13:04:28 +00:00
|
|
|
m->arrange_args= 0;
|
2010-06-25 17:59:01 +00:00
|
|
|
m->mkisofsrc_done= 0;
|
2010-05-15 18:48:10 +00:00
|
|
|
|
|
|
|
m->wdi[0]= 0;
|
|
|
|
strcpy(m->wdx, m->initial_wdx);
|
|
|
|
m->did_something_useful= 0;
|
|
|
|
m->add_plainly= 0;
|
|
|
|
m->split_size= 0;
|
|
|
|
strcpy(m->list_delimiter, "--");
|
2013-05-06 16:17:42 +00:00
|
|
|
m->ino_behavior= 1 | 2 | 4 | 32; /* off:no_lsl_count */
|
2010-12-25 07:15:36 +00:00
|
|
|
m->iso_level= 3;
|
2013-03-10 19:34:09 +00:00
|
|
|
m->iso_level_is_default= 1;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->do_joliet= 0;
|
2012-05-24 07:13:20 +00:00
|
|
|
m->do_hfsplus= 0;
|
2012-06-10 18:41:17 +00:00
|
|
|
m->do_fat= 0;
|
2012-05-22 12:13:18 +00:00
|
|
|
m->do_rockridge= 1;
|
2010-12-23 19:01:42 +00:00
|
|
|
m->do_iso1999= 0;
|
2015-08-17 20:08:42 +00:00
|
|
|
m->ecma119_map= 1;
|
2020-11-22 13:51:26 +00:00
|
|
|
m->joliet_map= 1;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->do_aaip= 0;
|
2020-01-02 17:50:59 +00:00
|
|
|
m->do_md5= 64;
|
2010-05-23 07:27:09 +00:00
|
|
|
m->no_emul_toc= 0;
|
2011-01-26 13:31:05 +00:00
|
|
|
m->do_old_empty= 0;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->scdbackup_tag_name[0]= 0;
|
|
|
|
m->scdbackup_tag_time[0]= 0;
|
|
|
|
m->scdbackup_tag_written[0]= 0;
|
|
|
|
m->scdbackup_tag_listname[0]= 0;
|
|
|
|
m->relax_compliance= 0;
|
2013-03-10 19:34:09 +00:00
|
|
|
m->allow_dir_id_ext_dflt= 1;
|
2012-03-10 14:59:44 +00:00
|
|
|
m->rr_reloc_dir[0]= 0;
|
|
|
|
m->rr_reloc_flags= 1;
|
2010-12-22 13:39:55 +00:00
|
|
|
m->untranslated_name_len= 0;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->do_follow_pattern= 1;
|
|
|
|
m->do_follow_param= 0;
|
|
|
|
m->do_follow_links= 0;
|
|
|
|
m->follow_link_limit= 100;
|
2014-02-10 10:49:59 +00:00
|
|
|
m->resolve_link_rec_count= 0;
|
|
|
|
m->resolve_link_rec_limit= 100;
|
2014-04-21 16:56:44 +00:00
|
|
|
m->do_follow_concat= 0;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->do_follow_mount= 1;
|
|
|
|
m->do_global_uid= 0;
|
|
|
|
m->global_uid= 0;
|
2020-12-08 12:33:09 +00:00
|
|
|
m->isofs_size= 0;
|
2020-12-07 18:42:46 +00:00
|
|
|
m->isofs_has_what= 0;
|
|
|
|
m->tree_loaded= 0;
|
|
|
|
m->rr_loaded= 0;
|
2010-05-15 18:48:10 +00:00
|
|
|
strcpy(m->volid, "ISOIMAGE");
|
|
|
|
m->volid_default= 1;
|
|
|
|
m->loaded_volid[0]= 0;
|
|
|
|
m->assert_volid[0]= 0;
|
|
|
|
m->assert_volid_sev[0]= 0;
|
2010-07-30 15:52:09 +00:00
|
|
|
m->preparer_id[0]= 0;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->publisher[0]= 0;
|
|
|
|
m->application_id[0]= 0;
|
|
|
|
m->system_id[0]= 0;
|
|
|
|
m->volset_id[0]= 0;
|
2010-06-26 11:40:36 +00:00
|
|
|
m->copyright_file[0]= 0;
|
|
|
|
m->biblio_file[0]= 0;
|
|
|
|
m->abstract_file[0]= 0;
|
2013-08-04 17:23:58 +00:00
|
|
|
strcpy(m->application_use, " ");
|
2010-05-15 18:48:10 +00:00
|
|
|
m->session_logfile[0]= 0;
|
|
|
|
m->session_lba= -1;
|
|
|
|
m->session_blocks= 0;
|
|
|
|
m->do_global_gid= 0;
|
|
|
|
m->global_gid= 0;
|
|
|
|
m->do_global_mode= 0;
|
|
|
|
m->global_dir_mode= 0555;
|
|
|
|
m->global_file_mode= 0444;
|
2012-07-08 13:47:36 +00:00
|
|
|
m->do_tao= 0;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->filters= NULL;
|
|
|
|
m->filter_list_closed= 0;
|
|
|
|
m->zlib_level_default= m->zlib_level= 6;
|
|
|
|
m->zisofs_block_size= m->zisofs_block_size_default= (1 << 15);
|
|
|
|
m->zisofs_by_magic= 0;
|
2020-10-14 20:59:35 +00:00
|
|
|
m->zisofs_v2_enabled= 0;
|
|
|
|
m->zisofs_max_total_blocks= m->zisofs_max_total_blocks_default= 0x2000000;
|
|
|
|
m->zisofs_max_file_blocks= m->zisofs_max_file_blocks_default= 0x2000000;
|
|
|
|
m->zisofs_block_size= m->zisofs_block_size_default= (1 << 15);
|
|
|
|
m->zisofs_v2_block_size= m->zisofs_v2_block_size_default= (1 << 17);
|
2020-10-17 13:30:26 +00:00
|
|
|
m->zisofs_block_number_target= -1;
|
2020-10-22 11:42:51 +00:00
|
|
|
m->zisofs_bpt_discard_free_ratio= m->zisofs_bpt_discard_free_ratio_default=
|
2020-10-25 16:04:24 +00:00
|
|
|
-1.0;
|
2020-10-29 08:31:48 +00:00
|
|
|
m->zisofs_susp_z2= m->zisofs_susp_z2_default= 0;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->do_overwrite= 2;
|
|
|
|
m->do_reassure= 0;
|
|
|
|
m->drive_blacklist= NULL;
|
|
|
|
m->drive_greylist= NULL;
|
|
|
|
m->drive_whitelist= NULL;
|
|
|
|
m->toc_emulation_flag= 0;
|
|
|
|
m->image_start_mode= 0;
|
|
|
|
m->image_start_value[0]= 0;
|
2010-11-30 09:43:32 +00:00
|
|
|
m->displacement= 0;
|
|
|
|
m->displacement_sign= 0;
|
2015-09-22 15:59:16 +00:00
|
|
|
m->read_fs= 0;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->drives_exclusive= 1;
|
2019-09-08 10:30:52 +00:00
|
|
|
m->drives_access= 1;
|
2016-03-18 13:55:09 +00:00
|
|
|
m->linux_scsi_dev_family= 0;
|
2011-03-21 09:37:02 +00:00
|
|
|
m->early_stdio_test= 0;
|
2012-03-11 16:41:10 +00:00
|
|
|
m->cache_num_tiles= 0;
|
|
|
|
m->cache_tile_blocks= 0;
|
|
|
|
m->cache_default= 1 | 2;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->do_calm_drive= 1;
|
|
|
|
m->indev[0]= 0;
|
|
|
|
m->in_drive_handle= NULL;
|
|
|
|
m->in_volset_handle= NULL;
|
|
|
|
m->in_charset= NULL;
|
|
|
|
m->isofs_st_out= time(0) - 1;
|
|
|
|
m->indev_is_exclusive= 1;
|
2019-09-08 10:30:52 +00:00
|
|
|
m->indev_access= 1;
|
2011-09-22 14:22:02 +00:00
|
|
|
m->indev_off_adr[0]= 0;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->isofs_st_in= 0;
|
|
|
|
m->volset_change_pending= 0;
|
2023-08-08 11:43:51 +00:00
|
|
|
m->commit_attempts= 0;
|
|
|
|
m->print_size_attempts= 0;
|
|
|
|
m->write_session_counter= 0;
|
|
|
|
m->print_size_counter= 0;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->no_volset_present= 0;
|
|
|
|
m->in_sector_map= NULL;
|
|
|
|
m->check_media_default= NULL;
|
|
|
|
m->check_media_bad_limit= Xorriso_read_quality_invaliD;
|
|
|
|
m->outdev[0]= 0;
|
|
|
|
m->out_drive_handle= NULL;
|
|
|
|
m->out_charset= NULL;
|
|
|
|
m->dev_fd_1= -1;
|
|
|
|
m->outdev_is_exclusive= 1;
|
2019-09-08 10:30:52 +00:00
|
|
|
m->outdev_access= 1;
|
2011-09-22 14:22:02 +00:00
|
|
|
m->outdev_off_adr[0]= 0;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->grow_blindly_msc2= -1;
|
|
|
|
m->ban_stdio_write= 0;
|
|
|
|
m->do_dummy= 0;
|
|
|
|
m->do_close= 0;
|
2013-10-20 12:56:01 +00:00
|
|
|
m->auto_close= 0;
|
2013-10-08 17:58:09 +00:00
|
|
|
m->write_speed= 0; /* max */
|
|
|
|
m->read_speed= -2; /* do not set */
|
2020-08-26 14:29:40 +00:00
|
|
|
m->read_speed_force= 0;
|
|
|
|
m->read_speed_corr= 250000; /* look back at most 0.25 seconds with _force */
|
2010-05-15 18:48:10 +00:00
|
|
|
m->fs= 4*512; /* 4 MiB */
|
|
|
|
m->padding= 300*1024;
|
2011-03-02 09:30:10 +00:00
|
|
|
m->do_padding_by_libisofs= 0;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->alignment= 0;
|
|
|
|
m->do_stream_recording= 0;
|
|
|
|
m->dvd_obs= 0;
|
2021-08-30 10:35:26 +00:00
|
|
|
m->do_obs_pad= 0;
|
2021-09-12 09:27:54 +00:00
|
|
|
m->bdr_obs_exempt= 0;
|
2015-07-31 16:23:08 +00:00
|
|
|
m->modesty_on_drive= 0;
|
2015-08-30 18:48:11 +00:00
|
|
|
m->min_buffer_usec= 5000;
|
|
|
|
m->max_buffer_usec= 25000;
|
|
|
|
m->buffer_timeout_sec= 120;
|
|
|
|
m->min_buffer_percent= 90;
|
2015-07-31 16:23:08 +00:00
|
|
|
m->max_buffer_percent= 95;
|
2016-07-31 07:38:41 +00:00
|
|
|
m->use_immed_bit= 0;
|
|
|
|
m->use_immed_bit_default= 0;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->stdio_sync= 0;
|
2014-04-08 09:18:14 +00:00
|
|
|
m->stdio_sync_is_default= 1;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->keep_boot_image= 0;
|
|
|
|
m->boot_image_cat_path[0]= 0;
|
2010-06-19 15:21:36 +00:00
|
|
|
m->boot_image_cat_hidden= 0;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->boot_count= 0;
|
|
|
|
m->boot_platform_id= 0x00; /* El Torito Boot Catalog Platform ID: 0 = 80x86 */
|
|
|
|
m->patch_isolinux_image= 0;
|
|
|
|
m->boot_image_bin_path[0]= 0;
|
|
|
|
m->boot_image_bin_form[0]= 0;
|
|
|
|
m->boot_image_emul= 0;
|
2013-03-10 19:34:09 +00:00
|
|
|
m->boot_emul_default= 1;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->boot_image_load_size= 4 * 512; /* hearsay out of libisofs/demo/iso.c */
|
2016-11-13 10:13:33 +00:00
|
|
|
m->boot_img_size_default= 1;
|
|
|
|
m->boot_img_full_size= 0;
|
2010-05-15 18:48:10 +00:00
|
|
|
memset(m->boot_id_string, 0, sizeof(m->boot_id_string));
|
|
|
|
memset(m->boot_selection_crit, 0, sizeof(m->boot_selection_crit));
|
|
|
|
|
|
|
|
#ifdef Xorriso_with_isohybriD
|
|
|
|
m->boot_image_isohybrid= 1;
|
|
|
|
#else
|
|
|
|
m->boot_image_isohybrid= 0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
m->boot_efi_default= 0;
|
|
|
|
m->system_area_disk_path[0]= 0;
|
2015-12-23 11:18:38 +00:00
|
|
|
m->system_area_clear_loaded= 0;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->system_area_options= 0;
|
|
|
|
m->patch_system_area= 0;
|
2010-09-05 11:37:45 +00:00
|
|
|
m->partition_offset= 0;
|
|
|
|
m->partition_secs_per_head= 0;
|
|
|
|
m->partition_heads_per_cyl= 0;
|
2012-06-12 11:35:05 +00:00
|
|
|
m->prep_partition[0]= 0;
|
|
|
|
m->efi_boot_partition[0]= 0;
|
2010-11-05 14:46:34 +00:00
|
|
|
for(i= 0; i < Xorriso_max_appended_partitionS; i++) {
|
|
|
|
m->appended_partitions[i]= NULL;
|
2010-10-18 21:22:23 +00:00
|
|
|
m->appended_part_types[i]= 0;
|
2019-02-18 12:19:32 +00:00
|
|
|
memset(m->appended_part_type_guids[i], 0, 16);
|
|
|
|
m->appended_part_gpt_flags[i]= 0;
|
2010-10-18 21:22:23 +00:00
|
|
|
}
|
2015-02-06 11:56:31 +00:00
|
|
|
m->appended_as_gpt= 0;
|
2016-02-05 10:06:25 +00:00
|
|
|
m->appended_as_apm= 0;
|
|
|
|
m->part_like_isohybrid= 0;
|
2017-02-27 09:38:16 +00:00
|
|
|
m->iso_mbr_part_type= -1;
|
2019-02-18 12:19:32 +00:00
|
|
|
memset(m->iso_gpt_type_guid, 0, 16);
|
|
|
|
m->iso_mbr_part_flag= 0;
|
2016-08-12 18:57:21 +00:00
|
|
|
memset(m->gpt_guid, 0, 16);
|
|
|
|
m->gpt_guid_mode= 0;
|
2023-01-22 15:19:28 +00:00
|
|
|
m->max_ce_entries= 31; /* Linux hates >= RR_MAX_CE_ENTRIES = 32 */
|
|
|
|
m->max_ce_entries_flag= 2; /* omit non-isofs fattr and ACL if needed */
|
2010-11-05 14:46:34 +00:00
|
|
|
m->ascii_disc_label[0]= 0;
|
2013-04-13 20:54:04 +00:00
|
|
|
m->grub2_sparc_core[0]= 0;
|
2012-05-27 16:58:51 +00:00
|
|
|
memset(m->hfsp_serial_number, 0, 8);
|
2012-06-27 18:48:16 +00:00
|
|
|
m->hfsp_block_size= 0;
|
|
|
|
m->apm_block_size= 0;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->vol_creation_time= 0;
|
|
|
|
m->vol_modification_time= 0;
|
|
|
|
m->vol_expiration_time= 0;
|
|
|
|
m->vol_effective_time= 0;
|
|
|
|
m->vol_uuid[0]= 0;
|
2016-08-16 13:13:05 +00:00
|
|
|
m->all_file_dates[0]= 0;
|
2019-04-18 09:28:35 +00:00
|
|
|
m->do_override_now_time= 0;
|
|
|
|
m->now_time_override= 0;
|
2010-09-29 09:24:20 +00:00
|
|
|
|
|
|
|
#ifdef Xorriso_with_libjtE
|
|
|
|
m->libjte_handle= NULL;
|
|
|
|
#endif
|
|
|
|
|
2010-10-01 19:02:57 +00:00
|
|
|
m->jigdo_params= NULL;
|
|
|
|
m->jigdo_values= NULL;
|
2010-11-23 20:04:08 +00:00
|
|
|
m->libjte_params_given= 0;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->loaded_boot_bin_lba= 0;
|
|
|
|
m->loaded_boot_cat_path[0]= 0;
|
|
|
|
m->allow_graft_points= 0;
|
|
|
|
m->allow_restore= 0;
|
|
|
|
m->do_concat_split= 1;
|
|
|
|
m->do_auto_chmod= 0;
|
|
|
|
m->do_restore_sort_lba= 0;
|
2011-08-23 10:42:01 +00:00
|
|
|
m->do_strict_acl= 0;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->dialog= 0;
|
2013-07-04 09:47:13 +00:00
|
|
|
m->buffered_dialog= NULL;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->bsl_interpretation= 0;
|
2013-07-01 18:06:39 +00:00
|
|
|
m->sh_style_result= 0;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->search_mode= 0;
|
|
|
|
m->structured_search= 1;
|
|
|
|
m->do_iso_rr_pattern= 1;
|
|
|
|
m->do_disk_pattern= 2;
|
|
|
|
m->temp_mem_limit= 16*1024*1024;
|
|
|
|
m->file_size_limit= Xorriso_default_file_size_limiT;
|
2015-09-17 12:12:41 +00:00
|
|
|
m->file_name_limit= 255;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->disk_exclusions= NULL;
|
2010-06-23 13:43:40 +00:00
|
|
|
m->iso_rr_hidings= NULL;
|
|
|
|
m->joliet_hidings= NULL;
|
2012-05-24 07:13:20 +00:00
|
|
|
m->hfsplus_hidings= NULL;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->disk_excl_mode= 1;
|
|
|
|
m->use_stdin= 0;
|
2013-06-30 16:00:40 +00:00
|
|
|
m->tolerate_stdin_eof= 0;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->result_page_length= 0;
|
|
|
|
m->result_page_width= 80;
|
|
|
|
m->mark_text[0]= 0;
|
|
|
|
m->packet_output= 0;
|
|
|
|
for(i=0; i<4; i++) {
|
|
|
|
m->logfile[i][0]= 0;
|
|
|
|
m->logfile_fp[i]= NULL;
|
|
|
|
}
|
|
|
|
m->pktlog_fp= NULL;
|
2012-04-11 16:32:21 +00:00
|
|
|
m->stderr_fp= NULL;
|
2010-05-15 18:48:10 +00:00
|
|
|
for(i= 0; i < Xorriso_max_outlist_stacK; i++) {
|
|
|
|
m->result_msglists[i]= NULL;
|
|
|
|
m->info_msglists[i]= NULL;
|
|
|
|
m->msglist_flags[i]= 0;
|
|
|
|
}
|
2012-09-11 09:28:05 +00:00
|
|
|
m->lib_msg_queue_lock_ini= 0;
|
|
|
|
m->result_msglists_lock_ini= 0;
|
2012-09-13 13:09:54 +00:00
|
|
|
m->write_to_channel_lock_ini= 0;
|
2012-09-14 17:52:21 +00:00
|
|
|
m->msg_watcher_lock_ini= 0;
|
|
|
|
m->msg_watcher_state= 0;
|
|
|
|
m->msgw_result_handler= NULL;
|
2012-09-15 09:52:29 +00:00
|
|
|
m->msgw_result_handle= NULL;
|
2012-09-14 17:52:21 +00:00
|
|
|
m->msgw_info_handler= NULL;
|
2012-09-15 09:52:29 +00:00
|
|
|
m->msgw_info_handle= NULL;
|
2012-09-14 17:52:21 +00:00
|
|
|
m->msgw_stack_handle= -1;
|
2012-09-15 17:04:32 +00:00
|
|
|
m->msgw_msg_pending= 0;
|
|
|
|
m->msgw_fetch_lock_ini= 0;
|
2012-12-06 13:22:13 +00:00
|
|
|
m->msg_sieve= NULL;
|
2012-12-08 17:55:58 +00:00
|
|
|
m->msg_sieve_disabled= 0;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->msglist_stackfill= 0;
|
|
|
|
m->status_history_max= Xorriso_status_history_maX;
|
|
|
|
m->scsi_log= 0;
|
|
|
|
strcpy(m->report_about_text, "UPDATE");
|
|
|
|
Xorriso__text_to_sev(m->report_about_text, &m->report_about_severity, 0);
|
|
|
|
m->library_msg_direct_print= 0;
|
2011-01-04 19:30:49 +00:00
|
|
|
strcpy(m->abort_on_text,"FAILURE");
|
2010-05-15 18:48:10 +00:00
|
|
|
Xorriso__text_to_sev(m->abort_on_text, &m->abort_on_severity, 0);
|
2011-01-04 19:30:49 +00:00
|
|
|
m->abort_on_is_default= 1;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->problem_status= 0;
|
2012-09-13 13:09:54 +00:00
|
|
|
m->problem_status_lock_ini= 0;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->problem_status_text[0]= 0;
|
|
|
|
m->errfile_log[0]= 0;
|
|
|
|
m->errfile_mode= 0;
|
|
|
|
m->errfile_fp= NULL;
|
|
|
|
|
2011-03-21 09:37:02 +00:00
|
|
|
m->img_read_error_mode= 1; /* abort faulty image reading with FAILURE */
|
2010-05-15 18:48:10 +00:00
|
|
|
m->extract_error_mode= 1; /* keep extracted files after read error */
|
|
|
|
strcpy(m->return_with_text, "SORRY");
|
|
|
|
Xorriso__text_to_sev(m->return_with_text, &m->return_with_severity, 0);
|
|
|
|
m->return_with_value= 32;
|
|
|
|
m->eternal_problem_status= 0;
|
|
|
|
m->eternal_problem_status_text[0]= 0;
|
|
|
|
m->re= NULL;
|
|
|
|
/* >>> ??? how to initialize m->match[0] ? */
|
|
|
|
m->re_constants= NULL;
|
|
|
|
m->re_count= 0;
|
|
|
|
m->re_fill= 0;
|
|
|
|
m->reg_expr[0]= 0;
|
|
|
|
m->run_state= 0;
|
|
|
|
m->is_dialog= 0;
|
|
|
|
m->bar_is_fresh= 0;
|
|
|
|
m->pending_option[0]= 0;
|
|
|
|
m->request_to_abort= 0;
|
|
|
|
m->request_not_to_ask= 0;
|
|
|
|
m->idle_time= 0.0;
|
|
|
|
m->re_failed_at= -1;
|
|
|
|
m->prepended_wd= 0;
|
|
|
|
m->insert_count= 0;
|
|
|
|
m->insert_bytes= 0;
|
|
|
|
m->error_count= 0;
|
2012-12-20 20:22:58 +00:00
|
|
|
m->launch_frontend_banned= 0;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->pacifier_style= 0;
|
|
|
|
m->pacifier_interval= 1.0;
|
|
|
|
m->pacifier_count= 0;
|
2012-01-23 10:38:48 +00:00
|
|
|
m->pacifier_prev_count= 0;
|
2010-05-15 18:48:10 +00:00
|
|
|
m->pacifier_total= 0;
|
|
|
|
m->pacifier_byte_count= 0;
|
|
|
|
m->pacifier_fifo= NULL;
|
|
|
|
m->start_time= 0.0;
|
|
|
|
m->last_update_time= 0.0;
|
|
|
|
m->find_compare_result= 1;
|
|
|
|
m->find_check_md5_result= 0;
|
2010-11-03 08:11:45 +00:00
|
|
|
m->last_abort_file_time= 0.0;
|
2010-05-15 18:48:10 +00:00
|
|
|
|
|
|
|
m->node_counter= 0;
|
|
|
|
m->node_array_size= 0;
|
|
|
|
m->node_array= NULL;
|
|
|
|
m->node_disk_prefixes= NULL;
|
|
|
|
m->node_img_prefixes= NULL;
|
|
|
|
|
|
|
|
m->hln_count= 0;
|
|
|
|
m->hln_array= NULL;
|
|
|
|
m->hln_targets= NULL;
|
|
|
|
m->hln_change_pending= 0;
|
|
|
|
m->di_do_widen= NULL;
|
|
|
|
m->di_disk_paths= NULL;
|
|
|
|
m->di_iso_paths= NULL;
|
|
|
|
|
|
|
|
m->node_targets_availmem= 0;
|
|
|
|
|
|
|
|
m->di_count= 0;
|
|
|
|
m->di_array= NULL;
|
|
|
|
|
|
|
|
m->perm_stack= NULL;
|
|
|
|
|
2011-02-12 17:14:23 +00:00
|
|
|
m->update_flags= 0;
|
|
|
|
|
2015-05-14 10:08:32 +00:00
|
|
|
m->show_hfs_cmd_flag= 0;
|
|
|
|
m->show_hfs_cmd_count= 0;
|
|
|
|
m->show_hfs_cmds= NULL;
|
|
|
|
|
2020-11-03 08:27:41 +00:00
|
|
|
m->sparse_min_gap= 0;
|
|
|
|
|
2010-05-15 18:48:10 +00:00
|
|
|
m->result_line[0]= 0;
|
|
|
|
m->result_line_counter= 0;
|
|
|
|
m->result_page_counter= 0;
|
|
|
|
m->result_open_line_len= 0;
|
|
|
|
|
|
|
|
m->info_text[0]= 0;
|
|
|
|
|
2014-06-14 19:22:41 +00:00
|
|
|
|
|
|
|
/* Here begin actions which might fail */
|
|
|
|
|
2010-05-15 18:48:10 +00:00
|
|
|
ret= Sfile_leafname(progname, leafname, 0);
|
|
|
|
if(ret<=0)
|
|
|
|
goto failure;
|
|
|
|
if(strcmp(leafname, "osirrox")==0) {
|
|
|
|
m->allow_restore= 1;
|
|
|
|
m->drives_exclusive= 0;
|
2019-09-08 10:30:52 +00:00
|
|
|
m->drives_access= 0;
|
2010-05-15 18:48:10 +00:00
|
|
|
} else if(strcmp(leafname, "xorrisofs")==0 || strcmp(leafname, "genisofs")==0 ||
|
|
|
|
strcmp(leafname, "mkisofs")==0 || strcmp(leafname, "genisoimage")==0) {
|
|
|
|
m->argument_emulation= 1;
|
|
|
|
m->pacifier_style= 1;
|
|
|
|
Xorriso_protect_stdout(*xorriso, 0);
|
|
|
|
} else if(strcmp(leafname, "xorrecord")==0 || strcmp(leafname, "wodim")==0 ||
|
|
|
|
strcmp(leafname, "cdrecord")==0 || strcmp(leafname, "cdrskin")==0) {
|
|
|
|
m->argument_emulation= 2;
|
|
|
|
m->pacifier_style= 2;
|
|
|
|
}
|
|
|
|
ret= Exclusions_new(&(m->disk_exclusions), 0);
|
2010-06-23 13:43:40 +00:00
|
|
|
if(ret<=0)
|
|
|
|
goto failure;
|
|
|
|
ret= Exclusions_new(&(m->iso_rr_hidings), 0);
|
|
|
|
if(ret<=0)
|
|
|
|
goto failure;
|
|
|
|
ret= Exclusions_new(&(m->joliet_hidings), 0);
|
2012-05-24 07:13:20 +00:00
|
|
|
if(ret<=0)
|
|
|
|
goto failure;
|
|
|
|
ret= Exclusions_new(&(m->hfsplus_hidings), 0);
|
2010-05-15 18:48:10 +00:00
|
|
|
if(ret<=0)
|
|
|
|
goto failure;
|
|
|
|
Xorriso_relax_compliance(m, "default", 0);
|
|
|
|
ret= Xorriso_lst_new(&(m->drive_greylist), "/dev", m->drive_greylist, 1);
|
|
|
|
if(ret <= 0)
|
|
|
|
goto failure;
|
2010-07-30 15:52:09 +00:00
|
|
|
Xorriso_preparer_string(m, m->preparer_id, 1); /* avoids library calls */
|
2012-09-11 09:28:05 +00:00
|
|
|
ret= pthread_mutex_init(&(m->lib_msg_queue_lock), NULL);
|
|
|
|
if(ret != 0)
|
|
|
|
goto failure;
|
|
|
|
m->lib_msg_queue_lock_ini= 1;
|
|
|
|
ret= pthread_mutex_init(&(m->result_msglists_lock), NULL);
|
|
|
|
if(ret != 0)
|
|
|
|
goto failure;
|
|
|
|
m->result_msglists_lock_ini= 1;
|
2012-09-13 13:09:54 +00:00
|
|
|
ret= pthread_mutex_init(&(m->write_to_channel_lock), NULL);
|
|
|
|
if(ret != 0)
|
|
|
|
goto failure;
|
|
|
|
m->result_msglists_lock_ini= 1;
|
|
|
|
ret= pthread_mutex_init(&(m->problem_status_lock), NULL);
|
|
|
|
if(ret != 0)
|
|
|
|
goto failure;
|
|
|
|
m->problem_status_lock_ini= 1;
|
2012-09-14 17:52:21 +00:00
|
|
|
ret= pthread_mutex_init(&(m->msg_watcher_lock), NULL);
|
|
|
|
if(ret != 0)
|
|
|
|
goto failure;
|
|
|
|
m->msg_watcher_lock_ini= 1;
|
2012-09-15 17:04:32 +00:00
|
|
|
ret= pthread_mutex_init(&(m->msgw_fetch_lock), NULL);
|
|
|
|
if(ret != 0)
|
|
|
|
goto failure;
|
|
|
|
m->msgw_fetch_lock_ini= 1;
|
2010-05-15 18:48:10 +00:00
|
|
|
|
2011-05-02 09:16:27 +00:00
|
|
|
if(leafname != NULL)
|
|
|
|
free(leafname);
|
2010-05-15 18:48:10 +00:00
|
|
|
return(1);
|
|
|
|
failure:;
|
|
|
|
Xorriso_destroy(xorriso, 0);
|
2011-05-02 09:16:27 +00:00
|
|
|
if(leafname != NULL)
|
|
|
|
free(leafname);
|
2010-05-15 18:48:10 +00:00
|
|
|
return(-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int Xorriso_destroy_re(struct XorrisO *m, int flag)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if(m->re!=NULL) {
|
|
|
|
for(i=0;i<m->re_fill;i++) {
|
|
|
|
if(m->re_constants!=NULL)
|
|
|
|
if(m->re_constants[i]!=NULL)
|
|
|
|
continue; /* ,->re[i] was never subject to regcomp() */
|
|
|
|
regfree(&(m->re[i]));
|
|
|
|
}
|
|
|
|
free((char *) m->re);
|
|
|
|
m->re= NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(m->re_constants!=NULL) {
|
|
|
|
for(i=0;i<m->re_fill;i++)
|
|
|
|
if(m->re_constants[i]!=NULL)
|
|
|
|
free(m->re_constants[i]);
|
|
|
|
free((char *) m->re_constants);
|
|
|
|
m->re_constants= NULL;
|
|
|
|
}
|
|
|
|
m->re_count= 0;
|
|
|
|
m->re_fill= 0;
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* @param flag bit0= global shutdown of libraries */
|
|
|
|
int Xorriso_destroy(struct XorrisO **xorriso, int flag)
|
|
|
|
{
|
|
|
|
struct XorrisO *m;
|
2010-11-05 14:46:34 +00:00
|
|
|
int i;
|
2010-05-15 18:48:10 +00:00
|
|
|
|
|
|
|
m= *xorriso;
|
|
|
|
if(m==NULL)
|
|
|
|
return(0);
|
2011-02-14 13:15:04 +00:00
|
|
|
|
|
|
|
/* Give up drives and image to unref all connected xorriso objects */
|
|
|
|
Xorriso_give_up_drive(m, 3);
|
|
|
|
|
2010-05-15 18:48:10 +00:00
|
|
|
if(m->in_charset!=NULL)
|
|
|
|
free(m->in_charset);
|
|
|
|
if(m->out_charset!=NULL)
|
|
|
|
free(m->out_charset);
|
2015-11-07 11:05:19 +00:00
|
|
|
Checkmediajob_destroy(&(m->check_media_default), 0);
|
|
|
|
Sectorbitmap_destroy(&(m->in_sector_map), 0);
|
2010-05-15 18:48:10 +00:00
|
|
|
Xorriso_destroy_re(m,0);
|
|
|
|
Exclusions_destroy(&(m->disk_exclusions), 0);
|
2010-06-23 13:43:40 +00:00
|
|
|
Exclusions_destroy(&(m->iso_rr_hidings), 0);
|
|
|
|
Exclusions_destroy(&(m->joliet_hidings), 0);
|
2012-05-24 07:13:20 +00:00
|
|
|
Exclusions_destroy(&(m->hfsplus_hidings), 0);
|
2010-05-15 18:48:10 +00:00
|
|
|
Xorriso_destroy_all_extf(m, 0);
|
|
|
|
Xorriso_lst_destroy_all(&(m->drive_blacklist), 0);
|
|
|
|
Xorriso_lst_destroy_all(&(m->drive_greylist), 0);
|
|
|
|
Xorriso_lst_destroy_all(&(m->drive_whitelist), 0);
|
|
|
|
Xorriso_destroy_node_array(m, 0);
|
|
|
|
Xorriso_destroy_hln_array(m, 0);
|
|
|
|
Xorriso_destroy_di_array(m, 0);
|
|
|
|
|
2010-09-29 09:24:20 +00:00
|
|
|
#ifdef Xorriso_with_libjtE
|
|
|
|
if(m->libjte_handle)
|
|
|
|
libjte_destroy(&(m->libjte_handle));
|
|
|
|
#endif
|
|
|
|
|
2010-10-01 19:02:57 +00:00
|
|
|
Xorriso_lst_destroy_all(&(m->jigdo_params), 0);
|
|
|
|
Xorriso_lst_destroy_all(&(m->jigdo_values), 0);
|
2010-11-05 14:46:34 +00:00
|
|
|
for(i= 0; i < Xorriso_max_appended_partitionS; i++)
|
|
|
|
if(m->appended_partitions[i] != NULL)
|
|
|
|
free(m->appended_partitions[i]);
|
2012-09-13 13:09:54 +00:00
|
|
|
|
|
|
|
Xorriso_detach_libraries(m, flag&1);
|
|
|
|
|
2012-09-11 09:28:05 +00:00
|
|
|
if(m->lib_msg_queue_lock_ini)
|
|
|
|
pthread_mutex_destroy(&(m->lib_msg_queue_lock));
|
|
|
|
if(m->result_msglists_lock_ini)
|
|
|
|
pthread_mutex_destroy(&(m->result_msglists_lock));
|
2012-09-13 13:09:54 +00:00
|
|
|
if(m->write_to_channel_lock_ini)
|
|
|
|
pthread_mutex_destroy(&(m->write_to_channel_lock));
|
|
|
|
if(m->problem_status_lock_ini)
|
|
|
|
pthread_mutex_destroy(&(m->problem_status_lock));
|
2012-09-14 17:52:21 +00:00
|
|
|
if(m->msg_watcher_lock_ini)
|
|
|
|
pthread_mutex_destroy(&(m->msg_watcher_lock));
|
2012-09-15 17:04:32 +00:00
|
|
|
if(m->msgw_fetch_lock_ini)
|
|
|
|
pthread_mutex_destroy(&(m->msgw_fetch_lock));
|
2012-12-06 13:22:13 +00:00
|
|
|
Xorriso_sieve_dispose(m, 0);
|
2012-09-11 09:28:05 +00:00
|
|
|
|
2010-05-15 18:48:10 +00:00
|
|
|
free((char *) m);
|
|
|
|
*xorriso= NULL;
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int Xorriso_destroy_node_array(struct XorrisO *xorriso, int flag)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if(xorriso->node_array != NULL) {
|
|
|
|
for(i= 0; i < xorriso->node_counter; i++)
|
|
|
|
iso_node_unref((IsoNode *) xorriso->node_array[i]);
|
|
|
|
free(xorriso->node_array);
|
|
|
|
}
|
|
|
|
xorriso->node_array= NULL;
|
|
|
|
xorriso->node_counter= xorriso->node_array_size= 0;
|
|
|
|
Xorriso_lst_destroy_all(&(xorriso->node_disk_prefixes), 0);
|
|
|
|
Xorriso_lst_destroy_all(&(xorriso->node_img_prefixes), 0);
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* @param flag bit0= do not destroy hln_array but only hln_targets
|
|
|
|
*/
|
|
|
|
int Xorriso_destroy_hln_array(struct XorrisO *xorriso, int flag)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
|
|
if(xorriso->hln_array != NULL && !(flag & 1)) {
|
|
|
|
for(i= 0; i < xorriso->hln_count; i++)
|
|
|
|
iso_node_unref((IsoNode *) xorriso->hln_array[i]);
|
|
|
|
free(xorriso->hln_array);
|
|
|
|
xorriso->hln_array= NULL;
|
|
|
|
xorriso->hln_count= 0;
|
|
|
|
}
|
|
|
|
if(xorriso->hln_targets != NULL) {
|
|
|
|
for(i= 0; i < xorriso->hln_count; i++)
|
|
|
|
if(xorriso->hln_targets[i] != NULL)
|
|
|
|
free(xorriso->hln_targets[i]);
|
|
|
|
free(xorriso->hln_targets);
|
|
|
|
xorriso->hln_targets= NULL;
|
|
|
|
}
|
|
|
|
xorriso->node_targets_availmem= 0;
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int Xorriso_destroy_di_array(struct XorrisO *xorriso, int flag)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if(xorriso->di_array != NULL) {
|
|
|
|
for(i= 0; i < xorriso->di_count; i++)
|
|
|
|
if(xorriso->di_array[i] != NULL)
|
|
|
|
iso_node_unref((IsoNode *) xorriso->di_array[i]);
|
|
|
|
free(xorriso->di_array);
|
|
|
|
xorriso->di_array= NULL;
|
|
|
|
}
|
|
|
|
if(xorriso->di_do_widen != NULL) {
|
|
|
|
free(xorriso->di_do_widen);
|
|
|
|
xorriso->di_do_widen= NULL;
|
|
|
|
}
|
|
|
|
Xorriso_lst_destroy_all(&(xorriso->di_disk_paths), 0);
|
|
|
|
Xorriso_lst_destroy_all(&(xorriso->di_iso_paths), 0);
|
|
|
|
xorriso->di_count= 0;
|
|
|
|
|
|
|
|
#ifdef NIX
|
|
|
|
/* <<< */
|
|
|
|
fprintf(stderr, "xorriso_DEBUG: get_di_count= %lu\n",
|
|
|
|
Xorriso_get_di_counteR);
|
|
|
|
#endif /* NIX */
|
|
|
|
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int Xorriso_new_node_array(struct XorrisO *xorriso, off_t mem_limit,
|
|
|
|
int addon_nodes, int flag)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if(xorriso->node_counter <= 0)
|
|
|
|
return(1);
|
|
|
|
|
|
|
|
xorriso->node_array= calloc(xorriso->node_counter + addon_nodes,
|
|
|
|
sizeof(IsoNode *));
|
|
|
|
if(xorriso->node_array == NULL) {
|
|
|
|
Xorriso_no_malloc_memory(xorriso, NULL, 0);
|
|
|
|
return(-1);
|
|
|
|
}
|
|
|
|
for(i= 0; i < xorriso->node_counter + addon_nodes; i++)
|
|
|
|
xorriso->node_array[i]= NULL;
|
|
|
|
xorriso->node_array_size= xorriso->node_counter + addon_nodes;
|
|
|
|
xorriso->node_counter= 0;
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* @param flag bit0= do not allocate hln_array but only hln_targets
|
|
|
|
*/
|
|
|
|
int Xorriso_new_hln_array(struct XorrisO *xorriso, off_t mem_limit, int flag)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
Xorriso_destroy_hln_array(xorriso, flag & 1);
|
|
|
|
if(xorriso->hln_count <= 0)
|
|
|
|
return(1);
|
|
|
|
|
|
|
|
if(!(flag & 1)) {
|
|
|
|
xorriso->hln_array= calloc(xorriso->hln_count, sizeof(char *));
|
|
|
|
if(xorriso->hln_array == NULL) {
|
|
|
|
Xorriso_no_malloc_memory(xorriso, NULL, 0);
|
|
|
|
return(-1);
|
|
|
|
}
|
|
|
|
for(i= 0; i < xorriso->hln_count; i++)
|
|
|
|
xorriso->hln_array[i]= NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
xorriso->hln_targets= calloc(xorriso->hln_count, sizeof(char *));
|
|
|
|
if(xorriso->hln_targets == NULL) {
|
|
|
|
if(!(flag & 1)) {
|
|
|
|
free(xorriso->hln_array);
|
|
|
|
xorriso->hln_array= NULL;
|
|
|
|
}
|
|
|
|
Xorriso_no_malloc_memory(xorriso, NULL, 0);
|
|
|
|
return(-1);
|
|
|
|
}
|
|
|
|
for(i= 0; i < xorriso->hln_count; i++)
|
|
|
|
xorriso->hln_targets[i]= NULL;
|
|
|
|
xorriso->node_targets_availmem= mem_limit
|
|
|
|
- xorriso->hln_count * sizeof(void *)
|
|
|
|
- xorriso->hln_count * sizeof(char *);
|
|
|
|
if(xorriso->node_targets_availmem < 0)
|
|
|
|
xorriso->node_targets_availmem= 0;
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int Xorriso__preset_signal_behavior(int behavior, int flag)
|
|
|
|
{
|
2011-04-23 15:23:35 +00:00
|
|
|
if(behavior < 0 || behavior > 3)
|
2010-05-15 18:48:10 +00:00
|
|
|
return(0);
|
|
|
|
Xorriso_signal_behavioR= behavior;
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int Xorriso__get_signal_behavior(int flag)
|
|
|
|
{
|
|
|
|
return(Xorriso_signal_behavioR);
|
|
|
|
}
|
|
|
|
|