Compare commits

...

11 Commits

12 changed files with 481 additions and 56 deletions

View File

@@ -1,9 +1,28 @@
git clone git@dev.lovelyhq.com:libburnia/libisofs.git libisofs-1.5.4.tar.gz Sun Feb 07 2021
(to become libisofs-1.5.4 or higher)
=============================================================================== ===============================================================================
- no novelties yet - * Bug fix: Large amounts of AAIP data or many long file names could cause with
zisofs an unreadable filesystem after the warning "Calculated and
written ECMA-119 tree end differ"
* Bug fix: Big-Endian MIPS Volume Header boot file size was rounded up to
full 2048. Thanks René Rebe.
* Bug fix: El Torito production failed if no catalog path is given and the
first boot image path contains no slash
* Bug fix: zisofs production was wrong on big-endian machines
* Bug fix: Apple Partition Map entries wrote uninitialized data
* Bug fix: Appended APM partitions without HFS+ production had start and size 1
* Switched to usage of libjte-2.0.0
* Implemented production and reading of zisofs2 for files larger than 4 GiB - 1.
* New struct iso_zisofs_ctrl version 2
* New API call iso_stream_get_zisofs_par()
* New API call iso_stream_zisofs_discard_bpt()
* New API call iso_image_zisofs_discard_bpt()
* New flag bits 8 to 15 in API call iso_node_zf_by_magic()
* New API call iso_zisofs_ctrl_susp_z2()
* New API call iso_read_opts_set_joliet_map(), new default joliet_map=stripped
* New API calls iso_read_image_features_tree_loaded() and
iso_read_image_features_rr_loaded()
libisofs-1.5.0.tar.gz Sat Oct 26 2019 libisofs-1.5.2.tar.gz Sat Oct 26 2019
=============================================================================== ===============================================================================
* New API calls iso_write_opts_set_part_type_guid(), * New API calls iso_write_opts_set_part_type_guid(),
iso_write_opts_set_iso_type_guid() iso_write_opts_set_iso_type_guid()

View File

@@ -1,4 +1,4 @@
AC_INIT([libisofs], [1.5.3], [http://libburnia-project.org]) AC_INIT([libisofs], [1.5.4], [http://libburnia-project.org])
AC_PREREQ([2.50]) AC_PREREQ([2.50])
dnl AC_CONFIG_HEADER([config.h]) dnl AC_CONFIG_HEADER([config.h])
@@ -41,7 +41,7 @@ dnl If LIBISOFS_*_VERSION changes, be sure to change AC_INIT above to match.
dnl dnl
LIBISOFS_MAJOR_VERSION=1 LIBISOFS_MAJOR_VERSION=1
LIBISOFS_MINOR_VERSION=5 LIBISOFS_MINOR_VERSION=5
LIBISOFS_MICRO_VERSION=3 LIBISOFS_MICRO_VERSION=4
LIBISOFS_VERSION=$LIBISOFS_MAJOR_VERSION.$LIBISOFS_MINOR_VERSION.$LIBISOFS_MICRO_VERSION LIBISOFS_VERSION=$LIBISOFS_MAJOR_VERSION.$LIBISOFS_MINOR_VERSION.$LIBISOFS_MICRO_VERSION
AC_SUBST(LIBISOFS_MAJOR_VERSION) AC_SUBST(LIBISOFS_MAJOR_VERSION)
@@ -51,10 +51,10 @@ AC_SUBST(LIBISOFS_VERSION)
dnl Libtool versioning dnl Libtool versioning
LT_RELEASE=$LIBISOFS_MAJOR_VERSION.$LIBISOFS_MINOR_VERSION LT_RELEASE=$LIBISOFS_MAJOR_VERSION.$LIBISOFS_MINOR_VERSION
dnl 2019.11.23 development jump has happened dnl 2021.01.30 development jump has not yet happened
dnl SONAME = 95 - 89 = 6 . Library name = libisofs.6.89.0 dnl SONAME = 97 - 91 = 6 . Library name = libisofs.6.91.0
LT_CURRENT=95 LT_CURRENT=97
LT_AGE=89 LT_AGE=91
LT_REVISION=0 LT_REVISION=0
LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE` LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`

View File

@@ -505,11 +505,282 @@ configure.ac
libisofs/libisofs.h libisofs/libisofs.h
Version leap to 1.5.3 Version leap to 1.5.3
27 Oct 2019 [] 27 Oct 2019 [560c116]
ChangeLog ChangeLog
libisofs/changelog.txt libisofs/changelog.txt
Updated change log Updated change log
28 Oct 2019 [dc3d82c]
libisofs/libisofs.h
libisofs/node.h
libisofs/node.c
libisofs/builder.h
libisofs/tree.c
libisofs/find.c
libisofs/image.h
libisofs/fs_local.c
libisofs/fs_image.c
libisofs/ecma119.h
libisofs/ecma119.c
libisofs/joliet.c
libisofs/iso1999.c
libisofs/eltorito.c
libisofs/rockridge.h
libisofs/rockridge.c
libisofs/ecma119_tree.c
libisofs/util_rbtree.c
libisofs/system_area.h
libisofs/system_area.c
libisofs/make_isohybrid_mbr.c
libisofs/buffer.h
libisofs/buffer.c
libisofs/md5.c
libisofs/stream.h
libisofs/util.h
libisofs/util.c
libisofs/libiso_msgs.h
libisofs/messages.c
libisofs/aaip_0_2.h
libisofs/aaip_0_2.c
libisofs/aaip-os-linux.c
libisofs/aaip-os-freebsd.c
doc/susp_aaip_2_0.txt
doc/checksums.txt
doc/boot_sectors.txt
Fixed spelling errors found by fossies.org with codespell
30 Oct 2019 [773be79]
libisofs/libisofs.h
libisofs/system_area.c
libisofs/buffer.c
libisofs/ecma119.h
Fixed more spelling errors found by fossies.org with codespell
24 Nov 2019 [c1d9639]
configure.ac
libisofs/libisofs.h
Switched to usage of libjte-2.0.0
26 Nov 2019 [ac24887]
configure.ac
Re-enabled variable LT_RELEASE in configure.ac. Disabling was unintentional.
13 Jun 2020 [c84f6ae]
libisofs/libisofs.h
Removed a germanism from description of iso_image_get_session_md5
13 Jun 2020 [6ca841e]
libisofs/fs_local.c
libisofs/fs_image.c
Reacted on compiler warnings of Debian Sid
13 Jun 2020 [69e332d]
libisofs/libisofs.h
libisofs/messages.c
libisofs/hfsplus.c
New error code ISO_HFSPLUS_TOO_MANY_FILES instead of ISO_MANGLE_TOO_MUCH_FILES
07 Jul 2020 [gitlab 2384800] [gitea b0230b6]
libisofs/system_area.c
Changed strncpy() to memcpy() in order to please static analyzers
07 Jul 2020 [gitlab 30a2e85] [gitea f962d0d]
libisofs/system_area.c
Bug fix: Big-Endian MIPS Volume Header boot file size was rounded up to full 2048. Thanks René Rebe.
21 Sep 2020 [d297ce3]
libisofs/util.c
Prevented time rollover outside year intervals 1900-2155 and 1-9999
14 Oct 2020 [b107443]
libisofs/libisofs.h
libisofs/libisofs.ver
libisofs/fs_image.c
libisofs/messages.c
libisofs/node.h
libisofs/node.c
libisofs/rockridge.h
libisofs/rockridge.c
libisofs/rockridge_read.c
libisofs/stream.h
libisofs/stream.c
libisofs/util.h
libisofs/util.c
libisofs/filters/zisofs.c
+ doc/zisofs2_format.txt
Implemented production and reading of zisofs2 for files larger than 4 GiB - 1.
New API call iso_stream_get_zisofs_par(). New struct iso_zisofs_ctrl version 2.
15 Oct 2020 [f291e37]
libisofs/filters/zisofs.c
Fixed wrong start block pointer of zisofs2 compression
17 Oct 2020 [2ca3b29]
libisofs/libisofs.h
libisofs/messages.c
libisofs/filters/zisofs.c
New iso_zisofs_ctrl parameter .block_number_target
18 Oct 2020 [239ba69]
libisofs/filters/zisofs.c
libisofs/fs_image.c
Accepting zisofs2 algorithms 2 to 5 for ZF by magic, but not for decompression
22 Oct 2020 [cc2e0e3]
libisofs/libisofs.h
libisofs/filters/zisofs.c
New iso_zisofs_ctrl parameters bpt_discard_file_blocks , bpt_discard_free_ratio
25 Oct 2020 [80449f0]
libisofs/libisofs.h
libisofs/libisofs.ver
libisofs/filters/zisofs.c
libisofs/image.c
New API calls iso_stream_zisofs_discard_bpt() and iso_image_zisofs_discard_bpt()
26 Oct 2020 [d5ffecf]
libisofs/filters/zisofs.c
Silenced a compiler warning if zlib is not enabled
27 Oct 2020 [dc61e7d]
libisofs/libisofs.h
libisofs/node.c
New flag bits 8 to 15 in API call iso_node_zf_by_magic()
29 Oct 2020 [2ac62f0]
libisofs/filters/zisofs.c
Fixed header size of ZF entries made for zisofs2 files compressed by libisofs
29 Oct 2020 [46186e5]
doc/zisofs2_format.txt
Added Z2 System Use Entry Format to zisofs2 specs
29 Oct 2020 [9605bbe]
libisofs/libisofs.h
libisofs/libisofs.ver
libisofs/rockridge.c
libisofs/fs_image.c
libisofs/rockridge_read.c
libisofs/filters/zisofs.c
New API call iso_zisofs_ctrl_susp_z2()
29 Oct 2020 [8d70c75]
Makefile.am
libisofs/rockridge.c
libisofs/rockridge_read.c
Added doc/zisofs2_format.txt to EXTRA_DIST
29 Oct 2020 [b7a90c5]
libisofs/libisofs.h
Corrected description of new call iso_zisofs_ctrl_susp_z2()
31 Oct 2020 [5a98a4c]
libisofs/fs_image.c
Corrected declaration of ziso_add_osiz_filter(). (Lapse in commit b107443)
07 Nov 2020 [b068764]
libisofs/eltorito.c
Bug fix: El Torito production failed if no catalog name was given and the
boot image path contains no slash
07 Nov 2020 [ac9d553]
libisofs/eltorito.c
Fixed a new bug introduced with previous commit
13 Nov 2020 [1d5566f]
README
Changed Public contact from libburn-hackers@pykix.org to bug-xorriso@gnu.org
13 Nov 2020 [7e3b01b]
libisofs/system_area.c
Bug fix: Apple Partition Map entries wrote uninitialized data
13 Nov 2020 [daaee5e]
libisofs/hfsplus.c
Fixed access to packed members of struct hfsplus_volheader.
Thanks Felipe Franciosi.
13 Nov 2020 [92af0c9]
libisofs/system_area.c
Adjusted fix 7e3b01b after learning that the bug stems from b0230b6 (unreleased)
14 Nov 2020 [29cc5c8]
libisofs/system_area.c
Prevented writing of undesired bytes in make_sun_disk_label() (commit b0230b6)
15 Nov 2020 [cece6fb]
libisofs/ecma119.c
libisofs/hfsplus.h
libisofs/hfsplus.c
libisofs/system_area.c
Bug fix: Appended APM partitions without HFS+ production had start and size 1
22 Nov 2020 [c068a19]
libisofs/libisofs.h
libisofs/libisofs.ver
libisofs/fs_image.c
New API call iso_read_opts_set_joliet_map(), new default joliet_map=stripped
26 Nov 2020 [8f3ff65]
libisofs/ecma119.c
libisofs/system_area.h
libisofs/system_area.c
Corrected size of GPT protective MBR partition with multi-session emulation
07 Dec 2020 [6241141]
libisofs/libisofs.h
libisofs/libisofs.ver
libisofs/fs_image.c
New API calls iso_read_image_features_tree_loaded() and
iso_read_image_features_rr_loaded()
07 Dec 2020 [2a20e93]
libisofs/fs_image.c
Small correction to commit 6241141
30 Jan 2021 [4219bf4]
configure.ac
libisofs/libisofs.h
Version leap to 1.5.4.
30 Jan 2021 []
ChangeLog
libisofs/changelog.txt
Updated change log
07 Feb 2021 [release-1.5.4.branch: 408eb3f]
libisofs/rockridge.c
Bug fix: Large amounts of AAIP data or many long file names could cause with
zisofs an unreadable filesystem after the warning "Calculated and written
ECMA-119 tree end differ"
07 Feb 2021 [release-1.5.4.branch: ]
ChangeLog
libisofs/changelog.txt
Updated change log
------------------------------------ release - libisofs-1.5.4 - 07 Feb 2021
* Bug fix: Large amounts of AAIP data or many long file names could cause with
zisofs an unreadable filesystem after the warning "Calculated and
written ECMA-119 tree end differ"
* Bug fix: Big-Endian MIPS Volume Header boot file size was rounded up to
full 2048. Thanks René Rebe.
* Bug fix: El Torito production failed if no catalog path is given and the
first boot image path contains no slash
* Bug fix: zisofs production was wrong on big-endian machines
* Bug fix: Appended APM partitions without HFS+ production had start and size 1
* Switched to usage of libjte-2.0.0
* Implemented production and reading of zisofs2 for files larger than 4 GiB - 1.
* New struct iso_zisofs_ctrl version 2
* New API call iso_stream_get_zisofs_par()
* New API call iso_stream_zisofs_discard_bpt()
* New API call iso_image_zisofs_discard_bpt()
* New flag bits 8 to 15 in API call iso_node_zf_by_magic()
* New API call iso_zisofs_ctrl_susp_z2()
* New API call iso_read_opts_set_joliet_map(), new default joliet_map=stripped
* New API calls iso_read_image_features_tree_loaded() and
iso_read_image_features_rr_loaded()
------------------------------------ release - libisofs- - ------------------------------------ release - libisofs- -

View File

@@ -1374,6 +1374,8 @@ ex:
/* @param flag bit0= initialize system area by target->opts_overwrite /* @param flag bit0= initialize system area by target->opts_overwrite
bit1= fifo is not yet draining. Inquire write_count from fifo. bit1= fifo is not yet draining. Inquire write_count from fifo.
bit2= target->opts->ms_block is not counted in
target->total_size
*/ */
static static
int write_head_part1(Ecma119Image *target, int *write_count, int flag) int write_head_part1(Ecma119Image *target, int *write_count, int flag)
@@ -1396,7 +1398,7 @@ int write_head_part1(Ecma119Image *target, int *write_count, int flag)
/* Write System Area (ECMA-119, 6.2.1) */ /* Write System Area (ECMA-119, 6.2.1) */
if ((flag & 1) && target->opts_overwrite != NULL) if ((flag & 1) && target->opts_overwrite != NULL)
memcpy(sa, target->opts_overwrite, 16 * BLOCK_SIZE); memcpy(sa, target->opts_overwrite, 16 * BLOCK_SIZE);
res = iso_write_system_area(target, sa); res = iso_write_system_area(target, sa, (flag & 4) >> 2);
if (res < 0) if (res < 0)
goto write_error; goto write_error;
res = iso_write(target, sa, 16 * BLOCK_SIZE); res = iso_write(target, sa, 16 * BLOCK_SIZE);
@@ -1500,7 +1502,7 @@ int write_head_part(Ecma119Image *target, int flag)
int res, write_count = 0; int res, write_count = 0;
/* System area and volume descriptors */ /* System area and volume descriptors */
res = write_head_part1(target, &write_count, 0); res = write_head_part1(target, &write_count, 4);
if (res < 0) if (res < 0)
return res; return res;
@@ -2705,6 +2707,7 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *in_opts, Ecma119Image **img)
target->hfsp_cat_node_size = 0; target->hfsp_cat_node_size = 0;
target->hfsp_iso_block_fac = 0; target->hfsp_iso_block_fac = 0;
target->hfsp_collision_count = 0; target->hfsp_collision_count = 0;
iso_setup_hfsplus_block_size(target);
target->apm_req_count = 0; target->apm_req_count = 0;
target->apm_req_flags = 0; target->apm_req_flags = 0;
for (i = 0; i < ISO_APM_ENTRIES_MAX; i++) for (i = 0; i < ISO_APM_ENTRIES_MAX; i++)

View File

@@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2007 Vreixo Formoso * Copyright (c) 2007 Vreixo Formoso
* Copyright (c) 2009 - 2018 Thomas Schmitt * Copyright (c) 2009 - 2020 Thomas Schmitt
* *
* This file is part of the libisofs project; you can redistribute it and/or * This file is part of the libisofs project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2 * modify it under the terms of the GNU General Public License version 2
@@ -103,13 +103,21 @@ struct iso_read_opts
* If neither Rock Ridge nor Joliet is used, the ECMA-119 names are mapped * If neither Rock Ridge nor Joliet is used, the ECMA-119 names are mapped
* according to one of these rules * according to one of these rules
* 0 = unmapped: show name as recorded in ECMA-119 directory record * 0 = unmapped: show name as recorded in ECMA-119 directory record
* (not suitable for writing them to a new ISO filesystem) * (not suitable for writing it to a new ISO filesystem)
* 1 = stripped: like unmapped, but strip off trailing ";1" or ".;1" * 1 = stripped: like unmapped, but strip off trailing ";1" or ".;1"
* 2 = uppercase: like stripped, but {a-z} mapped to {A-Z} * 2 = uppercase: like stripped, but {a-z} mapped to {A-Z}
* 3 = lowercase: like stripped, but {A-Z} mapped to {a-z} * 3 = lowercase: like stripped, but {A-Z} mapped to {a-z}
*/ */
unsigned int ecma119_map : 2; unsigned int ecma119_map : 2;
/**
* If Joliet is used, apply one of these mapping rules:
* 0 = unmapped: show name as recorded in Joliet directory record
* (not suitable for writing it to a new ISO filesystem)
* 1 = stripped: strip off trailing ";1" or ".;1"
*/
unsigned int joliet_map : 1;
uid_t uid; /**< Default uid when no RR */ uid_t uid; /**< Default uid when no RR */
gid_t gid; /**< Default uid when no RR */ gid_t gid; /**< Default uid when no RR */
mode_t dir_mode; /**< Default mode when no RR (only permissions) */ mode_t dir_mode; /**< Default mode when no RR (only permissions) */
@@ -179,6 +187,16 @@ struct iso_read_image_features
/** It will be set to 1 if El-Torito boot record is present, to 0 if not.*/ /** It will be set to 1 if El-Torito boot record is present, to 0 if not.*/
unsigned int hasElTorito :1; unsigned int hasElTorito :1;
/**
* Which tree was loaded:
* 0= ISO 9660 + Rock Ridge , 1= Joliet , 2= ISO 9660:1999
*/
int tree_loaded;
/** Whether Rock Ridge info was used while loading: 0= no, 1= yes */
int rr_loaded;
}; };
static int ifs_fs_open(IsoImageFilesystem *fs); static int ifs_fs_open(IsoImageFilesystem *fs);
@@ -309,6 +327,7 @@ typedef struct
int truncate_mode; int truncate_mode;
int truncate_length; int truncate_length;
unsigned int ecma119_map : 2; unsigned int ecma119_map : 2;
unsigned int joliet_map : 1;
/** Whether AAIP info shall be loaded if it is present. /** Whether AAIP info shall be loaded if it is present.
* 1 = yes , 0 = no * 1 = yes , 0 = no
@@ -1960,9 +1979,10 @@ invalid_zf:
/* remove trailing version number */ /* remove trailing version number */
len = strlen(name); len = strlen(name);
ecma119_map = fsdata->ecma119_map;
if (fsdata->iso_root_block == fsdata->svd_root_block) if (fsdata->iso_root_block == fsdata->svd_root_block)
ecma119_map = 0; ecma119_map = fsdata->joliet_map;
else
ecma119_map = fsdata->ecma119_map;
if (ecma119_map >= 1 && ecma119_map <= 3 && if (ecma119_map >= 1 && ecma119_map <= 3 &&
len > 2 && name[len-2] == ';' && name[len-1] == '1') { len > 2 && name[len-2] == ';' && name[len-1] == '1') {
if (len > 3 && name[len-3] == '.') { if (len > 3 && name[len-3] == '.') {
@@ -2888,6 +2908,7 @@ int iso_image_filesystem_new(IsoDataSource *src, struct iso_read_opts *opts,
free(data); free(data);
{ret = ISO_OUT_OF_MEM; goto ex;} {ret = ISO_OUT_OF_MEM; goto ex;}
} }
data->rr = RR_EXT_NO;
/* get our ref to IsoDataSource */ /* get our ref to IsoDataSource */
data->src = src; data->src = src;
@@ -3058,16 +3079,11 @@ int iso_image_filesystem_new(IsoDataSource *src, struct iso_read_opts *opts,
} while (buffer[0] != 255); } while (buffer[0] != 255);
/* 4. check if RR extensions are being used */ /* 4. check if RR extensions are being used */
if (opts->norock) { ret = read_root_susp_entries(data, data->pvd_root_block);
/* user doesn't want to read RR extensions */ if (ret < 0)
data->rr = RR_EXT_NO; goto fs_cleanup;
} else { if (!opts->norock)
ret = read_root_susp_entries(data, data->pvd_root_block);
if (ret < 0) {
goto fs_cleanup;
}
data->rr = data->rr_version; data->rr = data->rr_version;
}
/* select what tree to read */ /* select what tree to read */
if (data->rr) { if (data->rr) {
@@ -3107,6 +3123,7 @@ int iso_image_filesystem_new(IsoDataSource *src, struct iso_read_opts *opts,
data->truncate_mode = opts->truncate_mode; data->truncate_mode = opts->truncate_mode;
data->truncate_length = opts->truncate_length; data->truncate_length = opts->truncate_length;
data->ecma119_map = opts->ecma119_map; data->ecma119_map = opts->ecma119_map;
data->joliet_map = opts->joliet_map;
if (data->input_charset == NULL) { if (data->input_charset == NULL) {
if (opts->input_charset != NULL) { if (opts->input_charset != NULL) {
@@ -6088,6 +6105,13 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
(*features)->hasIso1999 = data->iso1999; (*features)->hasIso1999 = data->iso1999;
(*features)->hasElTorito = data->eltorito; (*features)->hasElTorito = data->eltorito;
(*features)->size = data->nblocks; (*features)->size = data->nblocks;
(*features)->tree_loaded = 0;
if (data->iso_root_block == data->svd_root_block)
(*features)->tree_loaded = 1;
else if (data->iso_root_block == data->evd_root_block &&
data->iso_root_block != data->pvd_root_block)
(*features)->tree_loaded = 2;
(*features)->rr_loaded = (data->rr != RR_EXT_NO);
} }
if (data->md5_load) { if (data->md5_load) {
@@ -6273,6 +6297,7 @@ int iso_read_opts_new(IsoReadOpts **opts, int profile)
ropts->dir_mode = 0555; ropts->dir_mode = 0555;
ropts->noaaip = 1; ropts->noaaip = 1;
ropts->ecma119_map = 1; ropts->ecma119_map = 1;
ropts->joliet_map = 1;
ropts->nomd5 = 1; ropts->nomd5 = 1;
ropts->load_system_area = 0; ropts->load_system_area = 0;
ropts->keep_import_src = 0; ropts->keep_import_src = 0;
@@ -6377,6 +6402,16 @@ int iso_read_opts_set_ecma119_map(IsoReadOpts *opts, int ecma119_map)
return ISO_SUCCESS; return ISO_SUCCESS;
} }
int iso_read_opts_set_joliet_map(IsoReadOpts *opts, int joliet_map)
{
if (opts == NULL)
return ISO_NULL_POINTER;
if (joliet_map < 0 || joliet_map > 1)
return 0;
opts->joliet_map = joliet_map;
return ISO_SUCCESS;
}
int iso_read_opts_set_default_uid(IsoReadOpts *opts, uid_t uid) int iso_read_opts_set_default_uid(IsoReadOpts *opts, uid_t uid)
{ {
if (opts == NULL) { if (opts == NULL) {
@@ -6493,6 +6528,22 @@ int iso_read_image_features_has_eltorito(IsoReadImageFeatures *f)
return f->hasElTorito; return f->hasElTorito;
} }
/**
* Tells what directory tree was loaded:
* 0= ISO 9660 , 1 = Joliet , 2 = ISO 9660:1999
*/
int iso_read_image_features_tree_loaded(IsoReadImageFeatures *f)
{
return f->tree_loaded;
}
/**
* Tells whether Rock Ridge information was used while loading the tree.
*/
int iso_read_image_features_rr_loaded(IsoReadImageFeatures *f)
{
return f->rr_loaded;
}
/** /**
* Get the start addresses and the sizes of the data extents of a file node * Get the start addresses and the sizes of the data extents of a file node

View File

@@ -1579,6 +1579,14 @@ int mangle_leafs(Ecma119Image *target, int flag)
return ISO_SUCCESS; return ISO_SUCCESS;
} }
void iso_setup_hfsplus_block_size(Ecma119Image *target)
{
if (target->opts->hfsp_block_size == 0)
target->opts->hfsp_block_size = HFSPLUS_DEFAULT_BLOCK_SIZE;
target->hfsp_cat_node_size = 2 * target->opts->hfsp_block_size;
target->hfsp_iso_block_fac = 2048 / target->opts->hfsp_block_size;
}
int hfsplus_writer_create(Ecma119Image *target) int hfsplus_writer_create(Ecma119Image *target)
{ {
int ret; int ret;
@@ -1599,10 +1607,7 @@ int hfsplus_writer_create(Ecma119Image *target)
make_hfsplus_decompose_pages(); make_hfsplus_decompose_pages();
make_hfsplus_class_pages(); make_hfsplus_class_pages();
if (target->opts->hfsp_block_size == 0) iso_setup_hfsplus_block_size(target);
target->opts->hfsp_block_size = HFSPLUS_DEFAULT_BLOCK_SIZE;
target->hfsp_cat_node_size = 2 * target->opts->hfsp_block_size;
target->hfsp_iso_block_fac = 2048 / target->opts->hfsp_block_size;
cat_node_size = target->hfsp_cat_node_size; cat_node_size = target->hfsp_cat_node_size;
writer->compute_data_blocks = hfsplus_writer_compute_data_blocks; writer->compute_data_blocks = hfsplus_writer_compute_data_blocks;

View File

@@ -197,5 +197,6 @@ extern const uint16_t hfsplus_casefold[];
int iso_get_hfsplus_name(char *input_charset, int imgid, char *name, int iso_get_hfsplus_name(char *input_charset, int imgid, char *name,
uint16_t **result, uint32_t *result_len, uint16_t **cmp_name); uint16_t **result, uint32_t *result_len, uint16_t **cmp_name);
void iso_setup_hfsplus_block_size(Ecma119Image *target);
#endif /* LIBISO_HFSPLUS_H */ #endif /* LIBISO_HFSPLUS_H */

View File

@@ -4,7 +4,7 @@
/* /*
* Copyright (c) 2007-2008 Vreixo Formoso, Mario Danic * Copyright (c) 2007-2008 Vreixo Formoso, Mario Danic
* Copyright (c) 2009-2020 Thomas Schmitt * Copyright (c) 2009-2021 Thomas Schmitt
* *
* This file is part of the libisofs project; you can redistribute it and/or * This file is part of the libisofs project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2 * modify it under the terms of the GNU General Public License version 2
@@ -94,7 +94,7 @@ extern "C" {
*/ */
#define iso_lib_header_version_major 1 #define iso_lib_header_version_major 1
#define iso_lib_header_version_minor 5 #define iso_lib_header_version_minor 5
#define iso_lib_header_version_micro 3 #define iso_lib_header_version_micro 4
/** /**
* Get version of the libisofs library at runtime. * Get version of the libisofs library at runtime.
@@ -3074,7 +3074,7 @@ int iso_read_opts_set_preferjoliet(IsoReadOpts *opts, int preferjoliet);
* @param ecma119_map * @param ecma119_map
* The conversion mode to apply: * The conversion mode to apply:
* 0 = unmapped: Take name as recorded in ECMA-119 directory record * 0 = unmapped: Take name as recorded in ECMA-119 directory record
* (not suitable for writing them to a new ISO filesystem) * (not suitable for writing it to a new ISO filesystem)
* 1 = stripped: Like unmapped, but strip off trailing ";1" or ".;1" * 1 = stripped: Like unmapped, but strip off trailing ";1" or ".;1"
* 2 = uppercase: Like stripped, but map {a-z} to {A-Z} * 2 = uppercase: Like stripped, but map {a-z} to {A-Z}
* 3 = lowercase: Like stripped, but map {A-Z} to {a-z} * 3 = lowercase: Like stripped, but map {A-Z} to {a-z}
@@ -3087,6 +3087,25 @@ int iso_read_opts_set_preferjoliet(IsoReadOpts *opts, int preferjoliet);
*/ */
int iso_read_opts_set_ecma119_map(IsoReadOpts *opts, int ecma119_map); int iso_read_opts_set_ecma119_map(IsoReadOpts *opts, int ecma119_map);
/**
* How to convert Joliet file names.
*
* @param opts
* The option set to be manipulated
* @param ecma119_map
* The conversion mode to apply:
* 0 = unmapped: Take name as recorded in Joliet directory record
* (not suitable for writing it to a new ISO filesystem)
* 1 = stripped: Strip off trailing ";1" or ".;1"
* @return
* ISO_SUCCESS if joliet_map was accepted
* 0 if the value was out of range
* < 0 if other error
*
* @since 1.5.4
*/
int iso_read_opts_set_joliet_map(IsoReadOpts *opts, int joliet_map);
/** /**
* Set default uid for files when RR extensions are not present. * Set default uid for files when RR extensions are not present.
* *
@@ -3258,6 +3277,22 @@ int iso_read_image_features_has_iso1999(IsoReadImageFeatures *f);
*/ */
int iso_read_image_features_has_eltorito(IsoReadImageFeatures *f); int iso_read_image_features_has_eltorito(IsoReadImageFeatures *f);
/**
* Tells what directory tree was loaded:
* 0= ISO 9660 , 1 = Joliet , 2 = ISO 9660:1999
*
* @since 1.5.4
*/
int iso_read_image_features_tree_loaded(IsoReadImageFeatures *f);
/**
* Tells whether Rock Ridge information was used while loading the tree:
* 1= yes, 0= no
*
* @since 1.5.4
*/
int iso_read_image_features_rr_loaded(IsoReadImageFeatures *f);
/** /**
* Increments the reference counting of the given image. * Increments the reference counting of the given image.
* *

View File

@@ -235,6 +235,8 @@ iso_read_image_features_has_eltorito;
iso_read_image_features_has_iso1999; iso_read_image_features_has_iso1999;
iso_read_image_features_has_joliet; iso_read_image_features_has_joliet;
iso_read_image_features_has_rockridge; iso_read_image_features_has_rockridge;
iso_read_image_features_rr_loaded;
iso_read_image_features_tree_loaded;
iso_read_opts_auto_input_charset; iso_read_opts_auto_input_charset;
iso_read_opts_free; iso_read_opts_free;
iso_read_opts_keep_import_src; iso_read_opts_keep_import_src;
@@ -245,6 +247,7 @@ iso_read_opts_set_default_permissions;
iso_read_opts_set_default_uid; iso_read_opts_set_default_uid;
iso_read_opts_set_ecma119_map; iso_read_opts_set_ecma119_map;
iso_read_opts_set_input_charset; iso_read_opts_set_input_charset;
iso_read_opts_set_joliet_map;
iso_read_opts_set_new_inos; iso_read_opts_set_new_inos;
iso_read_opts_set_no_aaip; iso_read_opts_set_no_aaip;
iso_read_opts_set_no_iso1999; iso_read_opts_set_no_iso1999;

View File

@@ -1166,7 +1166,7 @@ int susp_calc_nm_sl_al(Ecma119Image *t, Ecma119Node *n, size_t space,
size_t *su_size, size_t *ce, size_t base_ce, int flag) size_t *su_size, size_t *ce, size_t base_ce, int flag)
{ {
char *name; char *name;
size_t namelen, su_mem, ce_mem; size_t namelen, su_mem, ce_mem, ce_prepad = 0;
void *xipt; void *xipt;
size_t num_aapt = 0, sua_free = 0; size_t num_aapt = 0, sua_free = 0;
int ret; int ret;
@@ -1197,7 +1197,7 @@ int susp_calc_nm_sl_al(Ecma119Image *t, Ecma119Node *n, size_t space,
#endif /* Libisofs_ce_calc_debuG */ #endif /* Libisofs_ce_calc_debuG */
*ce += BLOCK_SIZE - (base_ce % BLOCK_SIZE); ce_prepad = BLOCK_SIZE - (base_ce % BLOCK_SIZE);
} }
} }
@@ -1210,8 +1210,10 @@ int susp_calc_nm_sl_al(Ecma119Image *t, Ecma119Node *n, size_t space,
if (flag & 1) { if (flag & 1) {
/* Account for 28 bytes of CE field */ /* Account for 28 bytes of CE field */
if (*su_size + 28 > space) if (*su_size + 28 > space) {
*ce += ce_prepad;
return -1; return -1;
}
*su_size += 28; *su_size += 28;
} }
@@ -1242,8 +1244,10 @@ int susp_calc_nm_sl_al(Ecma119Image *t, Ecma119Node *n, size_t space,
int cew = (*ce != 0); /* are we writing to CA ? */ int cew = (*ce != 0); /* are we writing to CA ? */
dest = get_rr_fname(t, ((IsoSymlink*)n->node)->dest); dest = get_rr_fname(t, ((IsoSymlink*)n->node)->dest);
if (dest == NULL) if (dest == NULL) {
*ce += ce_prepad;
return -2; return -2;
}
prev = dest; prev = dest;
cur = strchr(prev, '/'); cur = strchr(prev, '/');
while (1) { while (1) {
@@ -1353,6 +1357,9 @@ int susp_calc_nm_sl_al(Ecma119Image *t, Ecma119Node *n, size_t space,
if (*ce > 0 && !(flag & 1)) if (*ce > 0 && !(flag & 1))
goto unannounced_ca; goto unannounced_ca;
*ce += ce_prepad;
ce_prepad = 0;
/* obtain num_aapt from node */ /* obtain num_aapt from node */
xipt = NULL; xipt = NULL;
num_aapt = 0; num_aapt = 0;
@@ -1405,6 +1412,7 @@ int susp_calc_nm_sl_al(Ecma119Image *t, Ecma119Node *n, size_t space,
} }
} }
*ce += ce_prepad;
return 1; return 1;
unannounced_ca:; unannounced_ca:;

View File

@@ -789,18 +789,21 @@ static int write_sun_partition_entry(int partition_number,
*/ */
static int make_sun_disk_label(Ecma119Image *t, uint8_t *buf, int flag) static int make_sun_disk_label(Ecma119Image *t, uint8_t *buf, int flag)
{ {
int ret, i; int ret, i, l;
uint64_t blk; uint64_t blk;
/* Bytes 512 to 32767 may come from image or external file */ /* Bytes 512 to 32767 may come from image or external file */
memset(buf, 0, 512); memset(buf, 0, 512);
/* 0 - 127 | label | ASCII Label */ /* 0 - 127 | label | ASCII Label */
if (t->opts->ascii_disc_label[0]) if (t->opts->ascii_disc_label[0]) {
memcpy((char *) buf, t->opts->ascii_disc_label, 128); for (l = 0; l < 128 && t->opts->ascii_disc_label[l] != 0; l++);
else if (l > 0)
memcpy((char *) buf, t->opts->ascii_disc_label, l);
} else {
strcpy((char *) buf, strcpy((char *) buf,
"CD-ROM Disc with Sun sparc boot created by libisofs"); "CD-ROM Disc with Sun sparc boot created by libisofs");
}
/* 128 - 131 | 1 | Layout version */ /* 128 - 131 | 1 | Layout version */
iso_msb(buf + 128, 1, 4); iso_msb(buf + 128, 1, 4);
@@ -1043,12 +1046,12 @@ int iso_quick_apm_entry(struct iso_apm_partition_request **req_array,
return ISO_OUT_OF_MEM; return ISO_OUT_OF_MEM;
entry->start_block = start_block; entry->start_block = start_block;
entry->block_count = block_count; entry->block_count = block_count;
memset((char *) entry->name, 0, 32);
for (l = 0; l < 32 && name[l] != 0; l++); for (l = 0; l < 32 && name[l] != 0; l++);
memcpy((char *) entry->name, name, l); if (l > 0)
memset((char *) entry->type, 0, 32); memcpy((char *) entry->name, name, l);
for (l = 0; l < 32 && type[l] != 0; l++); for (l = 0; l < 32 && type[l] != 0; l++);
memcpy((char *) entry->type, type, l); if (l > 0)
memcpy((char *) entry->type, type, l);
entry->req_status = 0; entry->req_status = 0;
ret = iso_register_apm_entry(req_array, apm_req_count, entry, 0); ret = iso_register_apm_entry(req_array, apm_req_count, entry, 0);
free(entry); free(entry);
@@ -1400,8 +1403,13 @@ static int iso_write_apm(Ecma119Image *t, uint32_t img_blocks, uint8_t *buf,
/* Adjust last partition to img_size. This size was not known when the /* Adjust last partition to img_size. This size was not known when the
number of APM partitions was determined. number of APM partitions was determined.
*/ */
t->apm_req[t->apm_req_count - 1]->block_count = if (img_blocks * block_fac <
img_blocks * block_fac - t->apm_req[t->apm_req_count - 1]->start_block; t->apm_req[t->apm_req_count - 1]->start_block)
t->apm_req[t->apm_req_count - 1]->block_count = 0;
else
t->apm_req[t->apm_req_count - 1]->block_count =
img_blocks * block_fac -
t->apm_req[t->apm_req_count - 1]->start_block;
/* If it is still empty, remove it */ /* If it is still empty, remove it */
if(t->apm_req[t->apm_req_count - 1]->block_count == 0) { if(t->apm_req[t->apm_req_count - 1]->block_count == 0) {
free(t->apm_req[t->apm_req_count - 1]); free(t->apm_req[t->apm_req_count - 1]);
@@ -1867,7 +1875,10 @@ static void iso_dummy_mbr_partition(uint8_t *buf, int mode)
} }
int iso_write_system_area(Ecma119Image *t, uint8_t *buf) /* @param flag
bit0= t->opts->ms_block is not counted in t->total_size
*/
int iso_write_system_area(Ecma119Image *t, uint8_t *buf, int flag)
{ {
int ret, int_img_blocks, sa_type, i, will_append = 0, do_isohybrid = 0; int ret, int_img_blocks, sa_type, i, will_append = 0, do_isohybrid = 0;
int first_partition = 1, last_partition = 4, apm_flag, part_type = 0; int first_partition = 1, last_partition = 4, apm_flag, part_type = 0;
@@ -1976,7 +1987,8 @@ int iso_write_system_area(Ecma119Image *t, uint8_t *buf)
} }
if (t->gpt_backup_outside) if (t->gpt_backup_outside)
gpt_blocks = t->total_size / BLOCK_SIZE + t->opts->ms_block; gpt_blocks = t->total_size / BLOCK_SIZE +
(flag & 1) * t->opts->ms_block;
else else
gpt_blocks = img_blocks; gpt_blocks = img_blocks;
ret = iso_write_gpt(t, gpt_blocks, buf); ret = iso_write_gpt(t, gpt_blocks, buf);
@@ -2138,7 +2150,8 @@ int iso_write_system_area(Ecma119Image *t, uint8_t *buf)
#endif #endif
if (part_type == 0xee && t->gpt_req_count > 0) { if (part_type == 0xee && t->gpt_req_count > 0) {
mbrp1_blocks = t->total_size / BLOCK_SIZE + t->opts->ms_block; mbrp1_blocks = t->total_size / BLOCK_SIZE +
(flag & 1) * t->opts->ms_block;
offset_flag |= 2 | 1; /* protective MBR, no other partitions */ offset_flag |= 2 | 1; /* protective MBR, no other partitions */
} else { } else {
mbrp1_blocks = img_blocks; mbrp1_blocks = img_blocks;
@@ -2155,7 +2168,8 @@ int iso_write_system_area(Ecma119Image *t, uint8_t *buf)
/* This possibly overwrites the non-mbr_req partition table entries /* This possibly overwrites the non-mbr_req partition table entries
made so far. Overwriting those from t->mbr_req is not allowed. made so far. Overwriting those from t->mbr_req is not allowed.
*/ */
if (sa_type == 3 || !t->opts->appended_as_gpt) { if (sa_type == 3 ||
!(t->opts->appended_as_gpt || t->opts->appended_as_apm)) {
for (i = first_partition - 1; i <= last_partition - 1; i++) { for (i = first_partition - 1; i <= last_partition - 1; i++) {
if (t->opts->appended_partitions[i] == NULL) if (t->opts->appended_partitions[i] == NULL)
continue; continue;
@@ -2637,9 +2651,14 @@ int assess_appended_gpt(Ecma119Image *t, int flag)
0x28, 0x73, 0x2a, 0xc1, 0x1f, 0xf8, 0xd2, 0x11, 0x28, 0x73, 0x2a, 0xc1, 0x1f, 0xf8, 0xd2, 0x11,
0xba, 0x4b, 0x00, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b 0xba, 0x4b, 0x00, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b
}; };
static uint8_t hfs_plus_uuid[16] = {
0x00, 0x53, 0x46, 0x48, 0x00, 0x00, 0xaa, 0x11,
0xaa, 0x11, 0x00, 0x30, 0x65, 0x43, 0xec, 0xac
};
static uint8_t zero_uuid[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; static uint8_t zero_uuid[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int i, ret, do_apm = 0, do_gpt = 0, index, already_in_gpt = 0; int i, ret, do_apm = 0, do_gpt = 0, index, already_in_gpt = 0;
uint8_t gpt_name[72], *type_uuid; uint8_t gpt_name[72], *type_uuid;
char apm_type[33];
#ifndef Libisofs_appended_partitions_inlinE #ifndef Libisofs_appended_partitions_inlinE
if (!t->gpt_backup_outside) if (!t->gpt_backup_outside)
@@ -2663,10 +2682,16 @@ int assess_appended_gpt(Ecma119Image *t, int flag)
if (do_apm) { if (do_apm) {
memset(gpt_name, 0, 32); memset(gpt_name, 0, 32);
sprintf((char *) gpt_name, "Appended%d", i + 1); sprintf((char *) gpt_name, "Appended%d", i + 1);
strcpy(apm_type, "Data");
if (t->opts->appended_part_gpt_flags[i] & 1) {
if (memcmp(t->opts->appended_part_type_guids[i], hfs_plus_uuid,
16) == 0)
strcpy(apm_type, "Apple_HFS");
}
ret = iso_quick_apm_entry(t->apm_req, &(t->apm_req_count), ret = iso_quick_apm_entry(t->apm_req, &(t->apm_req_count),
t->appended_part_start[i] * t->hfsp_iso_block_fac, t->appended_part_start[i] * t->hfsp_iso_block_fac,
t->appended_part_size[i] * t->hfsp_iso_block_fac, t->appended_part_size[i] * t->hfsp_iso_block_fac,
(char *) gpt_name, "Data"); (char *) gpt_name, apm_type);
if (ret < 0) if (ret < 0)
return ret; return ret;
} }
@@ -2749,6 +2774,11 @@ static int precompute_gpt(Ecma119Image *t)
do not adjust final APM partition size */ do not adjust final APM partition size */
} }
/* Assess impact of appended partitions on GPT */
ret = assess_appended_gpt(t, 0);
if (ret < 0)
return ret;
/* Rectify APM requests early in order to learn the size of GPT. /* Rectify APM requests early in order to learn the size of GPT.
iso_write_apm() relies on this being already done here. iso_write_apm() relies on this being already done here.
So perform even if no GPT is required. So perform even if no GPT is required.
@@ -2757,9 +2787,6 @@ static int precompute_gpt(Ecma119Image *t)
if (ret < 0) if (ret < 0)
return ret; return ret;
/* Assess impact of appended partitions on GPT */
ret = assess_appended_gpt(t, 0);
#ifdef NIX #ifdef NIX
/* Disabled */ /* Disabled */

View File

@@ -42,10 +42,12 @@ int make_isohybrid_mbr(int bin_lba, int *img_blocks, char *mbr, int flag);
* *
* @param buf * @param buf
* A buffer with at least 32 K allocated * A buffer with at least 32 K allocated
* @param flag
* bit0= t->opts->ms_block is not counted in t->total_size
* @return * @return
* 1 if success, < 0 on error * 1 if success, < 0 on error
*/ */
int iso_write_system_area(Ecma119Image *t, uint8_t *buf); int iso_write_system_area(Ecma119Image *t, uint8_t *buf, int flag);
/** /**
* Adjust t->tail_blocks to the eventual alignment needs of isohybrid booting. * Adjust t->tail_blocks to the eventual alignment needs of isohybrid booting.