New API call iso_zisofs_ctrl_susp_z2()
This commit is contained in:
parent
46186e5f06
commit
9605bbe748
@ -112,6 +112,11 @@ static double ziso_keep_blocks_free_ratio = ISO_ZISOFS_KBF_RATIO;
|
||||
*/
|
||||
static int ziso_early_bpt_discard = 0;
|
||||
|
||||
/* 1 = produce Z2 entries for zisofs2 , 0 = produce ZF for zisofs2
|
||||
* This is used as extern variable in rockridge.c
|
||||
*/
|
||||
int iso_zisofs2_enable_susp_z2 = 0;
|
||||
|
||||
|
||||
static
|
||||
int ziso_decide_v2_usage(off_t orig_size)
|
||||
@ -1796,3 +1801,12 @@ int iso_stream_zisofs_discard_bpt(IsoStream *stream, int flag)
|
||||
#endif /* ! Libisofs_with_zliB */
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* API */
|
||||
int iso_zisofs_ctrl_susp_z2(int enable)
|
||||
{
|
||||
if (enable == 0 || enable == 1)
|
||||
iso_zisofs2_enable_susp_z2 = enable;
|
||||
return iso_zisofs2_enable_susp_z2;
|
||||
}
|
||||
|
@ -1596,7 +1596,8 @@ int iso_file_source_new_ifs(IsoImageFilesystem *fs, IsoFileSource *parent,
|
||||
while ((ret = susp_iter_next(iter, &sue, 0)) > 0) {
|
||||
|
||||
/* ignore entries from different version */
|
||||
if (sue->version[0] != 1 && !(SUSP_SIG(sue, 'Z', 'F')))
|
||||
if (sue->version[0] != 1 &&
|
||||
!(SUSP_SIG(sue, 'Z', 'F') || SUSP_SIG(sue, 'Z', '2')))
|
||||
continue;
|
||||
|
||||
if (SUSP_SIG(sue, 'P', 'X')) {
|
||||
@ -1803,7 +1804,7 @@ if (name != NULL && !namecont) {
|
||||
|
||||
#ifdef Libisofs_with_zliB
|
||||
|
||||
} else if (SUSP_SIG(sue, 'Z', 'F')) {
|
||||
} else if (SUSP_SIG(sue, 'Z', 'F') || SUSP_SIG(sue, 'Z', '2')) {
|
||||
|
||||
ret = read_zisofs_ZF(sue, zisofs_alg, &zisofs_hs4,
|
||||
&zisofs_bsl2, &zisofs_usize, 0);
|
||||
@ -1811,7 +1812,9 @@ if (name != NULL && !namecont) {
|
||||
invalid_zf:
|
||||
/* notify and continue */
|
||||
ret = iso_rr_msg_submit(fsdata, 13, ISO_WRONG_RR_WARN, ret,
|
||||
"Invalid ZF entry");
|
||||
SUSP_SIG(sue, 'Z', 'F') ?
|
||||
"Invalid ZF entry" :
|
||||
"Invalid Z2 entry");
|
||||
zisofs_hs4 = 0;
|
||||
continue;
|
||||
}
|
||||
|
@ -8182,6 +8182,21 @@ int iso_zisofs_set_params(struct iso_zisofs_ctrl *params, int flag);
|
||||
int iso_zisofs_get_params(struct iso_zisofs_ctrl *params, int flag);
|
||||
|
||||
|
||||
/**
|
||||
* Enable or disable the production and recognition of "Z2" SUSP entries
|
||||
* instead of "ZF" entries for zisofs2 compressed files.
|
||||
* "ZF" with zisofs2 causes unaware Linux kernels to complian like:
|
||||
* isofs: Unknown ZF compression algorithm: PZ
|
||||
* "Z2" is silently ignored by unaware Linux kernels.
|
||||
* @param enable
|
||||
* 1 = produce and recognize "Z2" , 0 = only "ZF" , -1 = do not change
|
||||
* @return
|
||||
* 1 = enabled , 0 = not enabled
|
||||
* @since 1.5.4
|
||||
*/
|
||||
int iso_zisofs_ctrl_susp_z2(int enable);
|
||||
|
||||
|
||||
/**
|
||||
* Check for the given node or for its subtree whether the data file content
|
||||
* effectively bears zisofs file headers and eventually mark the outcome
|
||||
|
@ -370,6 +370,7 @@ iso_write_opts_set_system_area;
|
||||
iso_write_opts_set_tail_blocks;
|
||||
iso_write_opts_set_untranslated_name_len;
|
||||
iso_write_opts_set_will_cancel;
|
||||
iso_zisofs_ctrl_susp_z2;
|
||||
iso_zisofs_get_params;
|
||||
iso_zisofs_get_refcounts;
|
||||
iso_zisofs_set_params;
|
||||
|
@ -961,16 +961,22 @@ int zisofs_add_ZF(Ecma119Image *t, struct susp_info *susp, int to_ce,
|
||||
{
|
||||
unsigned char *ZF = malloc(16);
|
||||
|
||||
/* Intimate friendship with this variable in filters/zisofs.c */
|
||||
extern int iso_zisofs2_enable_susp_z2;
|
||||
|
||||
if (ZF == NULL) {
|
||||
return ISO_OUT_OF_MEM;
|
||||
}
|
||||
ZF[0] = 'Z';
|
||||
ZF[1] = 'F';
|
||||
ZF[2] = (unsigned char) 16;
|
||||
if (algo[0] == 'p' && algo[1] == 'z')
|
||||
if (algo[0] == 'p' && algo[1] == 'z') {
|
||||
ZF[3] = (unsigned char) 1;
|
||||
else
|
||||
} else {
|
||||
ZF[3] = (unsigned char) 2;
|
||||
if (iso_zisofs2_enable_susp_z2)
|
||||
ZF[1] = '2';
|
||||
}
|
||||
ZF[4] = (unsigned char) algo[0];
|
||||
ZF[5] = (unsigned char) algo[1];
|
||||
ZF[6] = (unsigned char) header_size_div4;
|
||||
|
@ -629,9 +629,9 @@ int read_zisofs_ZF(struct susp_sys_user_entry *zf, uint8_t algorithm[2],
|
||||
if (zf == NULL) {
|
||||
return ISO_NULL_POINTER;
|
||||
}
|
||||
if (zf->sig[0] != 'Z' || zf->sig[1] != 'F') {
|
||||
if ((zf->sig[0] != 'Z' || zf->sig[1] != 'F') &&
|
||||
(zf->sig[0] != 'Z' || zf->sig[1] != '2'))
|
||||
return ISO_WRONG_ARG_VALUE;
|
||||
}
|
||||
if (zf->len_sue[0] != 16) {
|
||||
return ISO_WRONG_RR;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user