"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xorriso/filters.c" between
xorriso-1.5.2.tar.gz and xorriso-1.5.4.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.

filters.c  (xorriso-1.5.2):filters.c  (xorriso-1.5.4)
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
Copyright 2007-2014 Thomas Schmitt, <scdbackup@gmx.net> Copyright 2007-2020 Thomas Schmitt, <scdbackup@gmx.net>
Provided under GPL version 2 or later. Provided under GPL version 2 or later.
This file contains functions which operate on data filter objects. This file contains functions which operate on data filter objects.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "../config.h" #include "../config.h"
#endif #endif
skipping to change at line 374 skipping to change at line 374
goto ex; goto ex;
} }
} }
ret= iso_file_remove_filter(file, 0); ret= iso_file_remove_filter(file, 0);
if(ret != 1) if(ret != 1)
break; break;
} }
filter_ret= 1; filter_ret= 1;
} else if (internal_filter == 1 || internal_filter == 2) { } else if (internal_filter == 1 || internal_filter == 2) {
filter_ret = iso_file_add_zisofs_filter(file, 1 | (internal_filter & 2)); filter_ret = iso_file_add_zisofs_filter(file, 1 | (internal_filter & 2));
if(filter_ret == (int) ISO_ZISOFS_TOO_MANY_PTR) {
/* Remove all buffered currently unused block pointers and try again */
ret= Xorriso_get_volume(xorriso, &volume, 0);
if(ret < 0)
goto ex;
if(ret > 0) {
Xorriso_msgs_submit(xorriso, 0,
"Overflow of zisofs block pointers happened.",
0, "WARNING", 0);
Xorriso_msgs_submit(xorriso, 0,
"zisofs falling back to mode which needs 3 input read runs.",
0, "WARNING", 0);
ret = iso_image_zisofs_discard_bpt(volume, 0);
if(ret <= 0)
goto ex;
filter_ret = iso_file_add_zisofs_filter(file,
1 | (internal_filter & 2));
}
}
if(filter_ret < 0) { if(filter_ret < 0) {
Xorriso_process_msg_queues(xorriso,0); Xorriso_process_msg_queues(xorriso,0);
if(!(internal_filter == 2 && filter_ret == (int) ISO_ZISOFS_WRONG_INPUT)) if(!(internal_filter == 2 && filter_ret == (int) ISO_ZISOFS_WRONG_INPUT))
Xorriso_report_iso_error(xorriso, "", filter_ret, Xorriso_report_iso_error(xorriso, "", filter_ret,
"Error when setting filter to ISO node", 0, "FAILURE", 1); "Error when setting filter to ISO node", 0, "FAILURE", 1);
} }
} else if (internal_filter == 3 || internal_filter == 4) { } else if (internal_filter == 3 || internal_filter == 4) {
filter_ret = iso_file_add_gzip_filter(file, filter_ret = iso_file_add_gzip_filter(file,
1 | ((internal_filter == 4) << 1)); 1 | ((internal_filter == 4) << 1));
if(filter_ret < 0) { if(filter_ret < 0) {
skipping to change at line 648 skipping to change at line 667
strcat(line, " --\n"); strcat(line, " --\n");
Xorriso_status_result(xorriso, filter, fp, flag&2); Xorriso_status_result(xorriso, filter, fp, flag&2);
} }
if(xorriso->filter_list_closed) { if(xorriso->filter_list_closed) {
strcpy(line, "-close_filter_list\n"); strcpy(line, "-close_filter_list\n");
Xorriso_status_result(xorriso, filter, fp, flag&2); Xorriso_status_result(xorriso, filter, fp, flag&2);
} }
return(1); return(1);
} }
/* @param flag bit0= iso_zisofs_set_params
bit1= iso_zisofs_ctrl_susp_z2
*/
int Xorriso_set_zisofs_params(struct XorrisO *xorriso, int flag) int Xorriso_set_zisofs_params(struct XorrisO *xorriso, int flag)
{ {
int ret; int ret, i;
struct iso_zisofs_ctrl ctrl; struct iso_zisofs_ctrl ctrl;
ctrl.version= 0; if(flag & 2) {
iso_zisofs_ctrl_susp_z2(!!xorriso->zisofs_susp_z2);
}
if(!(flag & 1))
return(1);
memset(&ctrl, 0, sizeof(ctrl));
ctrl.version= 1;
ret= iso_zisofs_get_params(&ctrl, 0);
if(ret < 0) {
Xorriso_report_iso_error(xorriso, "", ret,
"Error when inquiring zisofs parameters before setting some",
0, "FAILURE", 1);
return(0);
}
ctrl.compression_level= xorriso->zlib_level; ctrl.compression_level= xorriso->zlib_level;
if(xorriso->zisofs_block_size == (1 << 16)) if(xorriso->zisofs_block_size == (1 << 16))
ctrl.block_size_log2= 16; ctrl.block_size_log2= 16;
else if(xorriso->zisofs_block_size == (1 << 17)) else if(xorriso->zisofs_block_size == (1 << 17))
ctrl.block_size_log2= 17; ctrl.block_size_log2= 17;
else else
ctrl.block_size_log2= 15; ctrl.block_size_log2= 15;
ctrl.v2_enabled= xorriso->zisofs_v2_enabled;
ctrl.max_total_blocks= xorriso->zisofs_max_total_blocks;
ctrl.max_file_blocks= xorriso->zisofs_max_file_blocks;
ctrl.v2_block_size_log2= 17;
for(i= 15; i <= 20; i++)
if(xorriso->zisofs_v2_block_size == (1 << i))
ctrl.v2_block_size_log2= i;
ctrl.block_number_target= xorriso->zisofs_block_number_target;
ctrl.bpt_discard_free_ratio= xorriso->zisofs_bpt_discard_free_ratio;
ret= iso_zisofs_set_params(&ctrl, 0); ret= iso_zisofs_set_params(&ctrl, 0);
Xorriso_process_msg_queues(xorriso,0); Xorriso_process_msg_queues(xorriso,0);
if(ret < 0) { if(ret < 0) {
Xorriso_report_iso_error(xorriso, "", ret, Xorriso_report_iso_error(xorriso, "", ret,
"Error when setting zisofs parameters", 0, "FAILURE", 1); "Error when setting zisofs parameters", 0, "FAILURE", 1);
return(0); return(0);
} }
return(1); return(1);
} }
uint64_t Xorriso_zisofs_current_blocks(struct XorrisO *xorriso, int flag)
{
int ret;
struct iso_zisofs_ctrl ctrl;
memset(&ctrl, 0, sizeof(ctrl));
ctrl.version= 1;
ret = iso_zisofs_get_params(&ctrl, 0);
if(ret != 1)
return(0);
return(ctrl.current_total_blocks);
}
int Xorriso_status_zisofs(struct XorrisO *xorriso, char *filter, FILE *fp, int Xorriso_status_zisofs(struct XorrisO *xorriso, char *filter, FILE *fp,
int flag) int flag)
/* /*
bit0= do only report non-default settings bit0= only report non-default settings
bit1= do only report to fp bit1= only report to fp
*/ */
{ {
off_t ziso_count= 0, osiz_count= 0; off_t ziso_count= 0, osiz_count= 0;
off_t gzip_count= 0, gunzip_count= 0; off_t gzip_count= 0, gunzip_count= 0;
uint64_t used_blocks;
int always= 0;
iso_zisofs_get_refcounts(&ziso_count, &osiz_count, 0); iso_zisofs_get_refcounts(&ziso_count, &osiz_count, 0);
iso_gzip_get_refcounts(&gzip_count, &gunzip_count, 0); iso_gzip_get_refcounts(&gzip_count, &gunzip_count, 0);
if((flag & 1) && xorriso->zlib_level == xorriso->zlib_level_default && if(!(flag & 1)) {
xorriso->zisofs_block_size == xorriso->zisofs_block_size_default && always= 1;
xorriso->zisofs_by_magic == 0 && } else if(filter != NULL) {
if(filter[0] != 0)
always= 1;
}
if(always || !(
xorriso->zlib_level == xorriso->zlib_level_default &&
xorriso->zisofs_block_size == xorriso->zisofs_block_size_default &&
xorriso->zisofs_by_magic == 0)) {
sprintf(xorriso->result_line,
"-zisofs level=%d:block_size=%dk:by_magic=%s\n",
xorriso->zlib_level, xorriso->zisofs_block_size / 1024,
xorriso->zisofs_by_magic == 1 ? "on" :
xorriso->zisofs_by_magic == 2 ? "v2" : "off");
Xorriso_status_result(xorriso, filter, fp, flag & 2);
}
if(always || !(
xorriso->zisofs_v2_enabled == 0 &&
xorriso->zisofs_v2_block_size == xorriso->zisofs_v2_block_size_default
&& xorriso->zisofs_block_number_target == -1)){
sprintf(xorriso->result_line,
"-zisofs version_2=%s:block_size_v2=%dk:susp_z2=%s:bpt_target=%.f\n",
xorriso->zisofs_v2_enabled ? xorriso->zisofs_v2_enabled == 1 ?
"as_needed" : "on" : "off",
xorriso->zisofs_v2_block_size / 1024,
xorriso->zisofs_susp_z2 ? "on" : "off",
(double) xorriso->zisofs_block_number_target);
Xorriso_status_result(xorriso, filter, fp, flag & 2);
}
used_blocks= Xorriso_zisofs_current_blocks(xorriso, 0);
if(always || !(
xorriso->zisofs_max_total_blocks ==
xorriso->zisofs_max_total_blocks_default &&
xorriso->zisofs_max_file_blocks ==
xorriso->zisofs_max_file_blocks_default &&
xorriso->zisofs_bpt_discard_free_ratio ==
xorriso->zisofs_bpt_discard_free_ratio_default)) {
sprintf(xorriso->result_line,
"-zisofs max_bpt=%.f:max_bpt_f=%.f:bpt_free_ratio=%.3f\n",
(double) xorriso->zisofs_max_total_blocks * 8.0,
(double) xorriso->zisofs_max_file_blocks * 8.0,
xorriso->zisofs_bpt_discard_free_ratio);
Xorriso_status_result(xorriso, filter, fp, flag & 2);
}
if(always || !(used_blocks == 0)) {
sprintf(xorriso->result_line,
"-zisofs bpt_used=%.f:bpt_ratio_used=%.3f\n",
(double) used_blocks * 8.0,
((double) used_blocks) / (double) xorriso->zisofs_max_total_blocks);
Xorriso_status_result(xorriso, filter, fp, flag & 2);
}
if(always || !(
ziso_count == 0 && osiz_count == 0 && ziso_count == 0 && osiz_count == 0 &&
gzip_count == 0 && gunzip_count == 0) { gzip_count == 0 && gunzip_count == 0)) {
if(filter == NULL) sprintf(xorriso->result_line,
return(2); "-zisofs ziso_used=%.f:osiz_used=%.f:gzip_used=%.f:gunzip_used=%.f\n",
if(filter[0] == 0) (double) ziso_count, (double) osiz_count,
return 2;
}
sprintf(xorriso->result_line,
"-zisofs level=%d:block_size=%dk:by_magic=%s:ziso_used=%.f:osiz_used=%.f",
xorriso->zlib_level, xorriso->zisofs_block_size / 1024,
xorriso->zisofs_by_magic ? "on" : "off",
(double) ziso_count, (double) osiz_count);
sprintf(xorriso->result_line + strlen(xorriso->result_line),
":gzip_used=%.f:gunzip_used=%.f\n",
(double) gzip_count, (double) gunzip_count); (double) gzip_count, (double) gunzip_count);
Xorriso_status_result(xorriso, filter, fp, flag&2); Xorriso_status_result(xorriso, filter, fp, flag & 2);
}
return(1); return(1);
} }
 End of changes. 12 change blocks. 
22 lines changed or deleted 128 lines changed or added

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