New flag bits 8 to 15 in API call iso_node_zf_by_magic()

This commit is contained in:
Thomas Schmitt 2020-10-27 12:17:26 +01:00
parent d5ffecf2f5
commit dc61e7d298
2 changed files with 13 additions and 7 deletions

View File

@ -8191,9 +8191,9 @@ int iso_zisofs_get_params(struct iso_zisofs_ctrl *params, int flag);
* Use this if you insert the compressed results of program mkzftree from disk
* into the image.
* @param node
* The node which shall be checked and eventually marked.
* The node which shall be checked and, if appropriate, be marked.
* @param flag
* Bitfield for control purposes, unused yet, submit 0
* Bitfield for control purposes
* bit0= prepare for a run with iso_write_opts_set_appendable(,1).
* Take into account that files from the imported image
* do not get their content filtered.
@ -8202,6 +8202,7 @@ int iso_zisofs_get_params(struct iso_zisofs_ctrl *params, int flag);
* create xinfo with parameters which indicate no zisofs
* bit3= no tree recursion if node is a directory
* bit4= skip files which stem from the imported image
* bit8-bit15= maximum zisofs version to be recognized (0 means 1)
* @return
* 0= no zisofs data found
* 1= zf xinfo added

View File

@ -2440,13 +2440,14 @@ int zisofs_zf_xinfo_cloner(void *old_data, void **new_data, int flag)
* bit1= permission to overwrite existing zisofs_zf_info
* bit2= if no zisofs header is found:
* create xinfo with parameters which indicate no zisofs
* bit8-bit15= maximum zisofs version to be recognized (0 means 1)
* @return 1= zf xinfo added, 0= no zisofs data found ,
* 2= found existing zf xinfo and flag bit1 was not set
* <0 means error
*/
int iso_file_zf_by_magic(IsoFile *file, int flag)
{
int ret, stream_type, header_size_div4, block_size_log2;
int ret, stream_type, header_size_div4, block_size_log2, version;
uint64_t uncompressed_size;
IsoStream *stream, *input_stream;
struct zisofs_zf_info *zf = NULL;
@ -2474,12 +2475,16 @@ int iso_file_zf_by_magic(IsoFile *file, int flag)
break;
stream = input_stream;
}
version = ((flag >> 8) & 0xff);
algo[0] = algo[1] = 0;
ret = ziso_is_zisofs_stream(stream, &stream_type, algo, &header_size_div4,
&block_size_log2, &uncompressed_size, 7);
&block_size_log2, &uncompressed_size, 3);
if (ret < 0)
return ret;
if (version < 2 && ret > 0 && (algo[0] != 'p' || algo[1] != 'z'))
ret = 0;
if (ret != 1 || stream_type != 2) {
if (flag & 4)
if (!(flag & 4))
return 0;
algo[0] = algo[1] = 0;
header_size_div4 = 0;
@ -2508,7 +2513,7 @@ int iso_node_zf_by_magic(IsoNode *node, int flag)
IsoDir *dir;
if (node->type == LIBISO_FILE)
return iso_file_zf_by_magic((IsoFile *) node, flag);
return iso_file_zf_by_magic((IsoFile *) node, flag & 0xff06);
if (node->type != LIBISO_DIR || (flag & 8))
return 0;
@ -2529,7 +2534,7 @@ int iso_node_zf_by_magic(IsoNode *node, int flag)
return 0; /* Will not be zisofs format */
}
}
hflag = flag & ~6;
hflag = flag & 0xff06;
if ((flag & 1) && file->from_old_session)
hflag |= 1;
ret = iso_file_zf_by_magic(file, hflag);