Compare commits
31 Commits
release-0.
...
release-0.
Author | SHA1 | Date | |
---|---|---|---|
14171bdd3a | |||
d37eba5344 | |||
3b616dae38 | |||
a2758b27e6 | |||
d5c4af7378 | |||
90f37b8183 | |||
1d4f26f325 | |||
08e442a2ab | |||
017dcb39f2 | |||
95121e2f9f | |||
ba11413a6f | |||
e1888df5ab | |||
dceef03633 | |||
443c5d41db | |||
e60171986b | |||
fe45249e9e | |||
b01f017a6d | |||
73bc3ae512 | |||
b6427d3b2b | |||
438024d11b | |||
1d6fdf51dc | |||
281462802f | |||
2b2a86ea2e | |||
c0963596e5 | |||
9be5b241e2 | |||
fcde936670 | |||
73c6bc49c6 | |||
5ed507da83 | |||
ae626b9570 | |||
3528493b92 | |||
9cf460a3b1 |
195
ChangeLog
195
ChangeLog
@ -1 +1,196 @@
|
|||||||
|
libisofs-0.6.34.tar.gz Tue Jun 29 2010
|
||||||
|
===============================================================================
|
||||||
|
* New API call iso_image_set_boot_catalog_hidden()
|
||||||
|
* New API call iso_node_get_hidden()
|
||||||
|
* New IsoHideNodeFlag bit LIBISO_HIDE_BUT_WRITE
|
||||||
|
* New error code ISO_BOOT_NO_CATALOG
|
||||||
|
* Opportunity to reduce compile line length by including "config.h"
|
||||||
|
|
||||||
|
libisofs-0.6.32.tar.gz Mon May 03 2010
|
||||||
|
===============================================================================
|
||||||
|
* New API call iso_image_set_boot_catalog_weight()
|
||||||
|
* New API call iso_image_add_boot_image()
|
||||||
|
* New API calls el_torito_set_boot_platform_id(), el_torito_set_id_string(),
|
||||||
|
el_torito_set_selection_crit()
|
||||||
|
* New API calls iso_image_get_all_boot_imgs(), el_torito_get_boot_platform_id(),
|
||||||
|
el_torito_get_load_seg(), el_torito_get_load_size(), el_torito_get_bootable(),
|
||||||
|
el_torito_get_id_string(), el_torito_get_selection_crit(),
|
||||||
|
el_torito_get_isolinux_options(), el_torito_get_boot_media_type()
|
||||||
|
* New API call el_torito_seems_boot_info_table()
|
||||||
|
|
||||||
|
libisofs-0.6.30.tar.gz Sat Apr 17 2010
|
||||||
|
===============================================================================
|
||||||
|
* New API call iso_write_opts_set_system_area() acts like mkisofs option -G.
|
||||||
|
* New API call iso_write_opts_set_pvd_times().
|
||||||
|
* Now able to produce a bootable System Area from an ISOLINUX mbr/isohdp
|
||||||
|
[fp]x*.bin file and an ISOLINUX El Torito bootable image (isolinux.bin).
|
||||||
|
* Now able to produce the same Joliet names as mkisofs.
|
||||||
|
* New API calls iso_read_opts_load_system_area() and
|
||||||
|
iso_image_get_system_area() for multi-session handling of MBRs.
|
||||||
|
|
||||||
|
libisofs-0.6.28.tar.gz Wed Feb 10 2010
|
||||||
|
===============================================================================
|
||||||
|
* Bug fix: Random checksum index could sneak in via boot catalog node
|
||||||
|
and cause a SIGSEGV.
|
||||||
|
* Improved compilability out of the box on FreeBSD.
|
||||||
|
|
||||||
|
libisofs-0.6.26.tar.gz Wed Jan 20 2010
|
||||||
|
===============================================================================
|
||||||
|
* Bug fix: Invalid old checksum tags were preserved with
|
||||||
|
iso_write_opts_set_overwrite_buf(), if the new session produced no checksums.
|
||||||
|
* The checksum buffer for the emerging image gets now marked as invalid if
|
||||||
|
image generation is canceled.
|
||||||
|
* More graceful reaction on filesystems where ACL are not enabled but
|
||||||
|
nevertheless requested by the application.
|
||||||
|
* Adaptions to problems reported by Debian buildd.
|
||||||
|
|
||||||
|
libisofs-0.6.24.tar.gz Thu Oct 08 2009
|
||||||
|
===============================================================================
|
||||||
|
* Bug fix: Short Rock Ridge names got stripped of trailing blanks when loaded
|
||||||
|
and written again to a follow-up session. Long names could lose inner blanks.
|
||||||
|
* Bug fix: Avoided to return NULL or single blanks as content of id strings by
|
||||||
|
API calls iso_image_get_volset_id() ... iso_image_get_biblio_file_id().
|
||||||
|
* New API call iso_write_opts_set_scdbackup_tag().
|
||||||
|
|
||||||
|
libisofs-0.6.22.tar.gz Tue Aug 25 2009
|
||||||
|
===============================================================================
|
||||||
|
* New API call iso_write_opts_set_record_md5() for writing MD5 sums.
|
||||||
|
* New API call iso_read_opts_set_no_md5() for importing MD5 sums.
|
||||||
|
* New API calls iso_image_get_session_md5() and iso_file_get_md5().
|
||||||
|
* New API calls iso_md5_start(), iso_md5_compute(), iso_md5_clone(),
|
||||||
|
iso_md5_end(), iso_md5_match() for own MD5 computations.
|
||||||
|
* New API call iso_util_decode_md5_tag() to recognize and parse checksum tags.
|
||||||
|
* New API call iso_file_make_md5() to equip old file nodes with MD5.
|
||||||
|
* Improvements with ./configure and its help text.
|
||||||
|
|
||||||
|
libisofs-0.6.20.tar.gz Sun May 30 2009
|
||||||
|
===============================================================================
|
||||||
|
* Optional automatic detection and recording of hard link
|
||||||
|
relations between files.
|
||||||
|
* Support for restoring hard link relations by the app.
|
||||||
|
|
||||||
|
libisofs-0.6.18.tar.gz Fri Apr 17 2009
|
||||||
|
===============================================================================
|
||||||
|
* Opportunity to set the input charset automatically from an eventual xattr
|
||||||
|
"isofs.cs" of the image root node.
|
||||||
|
* New general filter API to inquire and remove filters.
|
||||||
|
* Specialized APIs for installing filters which are based on external processes
|
||||||
|
or based on zlib.
|
||||||
|
* New API call to inquire the original source path of a data file in an
|
||||||
|
emerging image.
|
||||||
|
|
||||||
|
libisofs-0.6.16.tar.gz Wed Mar 11
|
||||||
|
===============================================================================
|
||||||
|
* Bug fix: The ".." directory record pointed to the same data block as the "."
|
||||||
|
entry.
|
||||||
|
* Bug fix: The use of iso_write_opts_set_rrip_version_1_10() caused a wrong
|
||||||
|
size announcement in the CE entry which points to the ER signature
|
||||||
|
of the image root.
|
||||||
|
* New API call iso_write_opts_get_data_start() inquires the start address of
|
||||||
|
the data section of an emerging ISO image.
|
||||||
|
* ISO image generation does not absolutely depend on the availability of
|
||||||
|
character set "WCHAR_T" with iconv_open(3) any more.
|
||||||
|
|
||||||
|
libisofs-0.6.14.tar.gz Sat Feb 28 2009
|
||||||
|
===============================================================================
|
||||||
|
* New API calls iso_image_set_ignore_aclea(), iso_read_opts_set_no_aaip()
|
||||||
|
control import of ACL and xattr.
|
||||||
|
* New API calls iso_write_opts_set_aaip(), iso_write_opts_set_aaip_susp_1_10()
|
||||||
|
control output of ACL and xattr into generated ISO image.
|
||||||
|
* New API call iso_file_source_get_aa_string(), new function member
|
||||||
|
get_aa_string() in IsoFileSource_Iface allow to access opaquely encoded ACL
|
||||||
|
and xattr. New function handle aaip_xinfo_func attaches aa_strings to
|
||||||
|
IsoNode objects.
|
||||||
|
* New API calls iso_node_get_acl_text(), iso_node_set_acl_text(),
|
||||||
|
iso_node_get_perms_wo_acl() allow inquiry and manipulation of ACLs in
|
||||||
|
IsoNode objects.
|
||||||
|
* New API calls iso_node_get_attrs(), iso_node_set_attrs() allow inquiry and
|
||||||
|
manipulation of xattr in IsoNode objects.
|
||||||
|
|
||||||
|
libisofs-0.6.12.tar.gz Wed Nov 26 2008
|
||||||
|
===============================================================================
|
||||||
|
* New API calls iso_set_local_charset() and iso_get_local_charset()
|
||||||
|
* New API calls iso_write_opts_set_rrip_version_1_10() and
|
||||||
|
iso_write_opts_set_dir_rec_mtime()
|
||||||
|
* New API call el_torito_set_isolinux_options() allows to patch ISOLINUX boot
|
||||||
|
images and to generate a isohybrid MBR on the fly. Such an MBR makes the ISO
|
||||||
|
image bootable from disk-like hardware, e.g. from USB stick. The ISOLINUX
|
||||||
|
boot image has to be of syslinux 3.72 or later to allow MBR generation.
|
||||||
|
* Old API call el_torito_patch_isolinux_image() is deprecated now.
|
||||||
|
|
||||||
|
libisofs-0.6.10.pl01.tar.gz Wed Nov 19 2008
|
||||||
|
===============================================================================
|
||||||
|
* Bug fix: If images generated by mkisofs were loaded then files of size 0
|
||||||
|
could share their size information with files that contain data. Ticket #144.
|
||||||
|
* Bug fix: ISOLINUX boot images were patched suitable for El Torito but not for
|
||||||
|
an eventual MBR added by SYSLINUX script isohybrid.
|
||||||
|
|
||||||
|
libisofs 0.6.10 Mon Oct 6 2008:
|
||||||
|
===============================================================================
|
||||||
|
* Bug fix: Patching of existing ISOLINUX boot images led to a SIGSEGV.
|
||||||
|
* Bug fix: Adding a new ISOLINUX boot image or patching of an existing one
|
||||||
|
caused a read operation although writing had already begun.
|
||||||
|
|
||||||
|
libisofs-0.6.8.tar.gz Thu Sep 18 2008
|
||||||
|
===============================================================================
|
||||||
|
* Support for very large data files in the ISO 9660 image
|
||||||
|
(Level 3, multi-extent)
|
||||||
|
* Bug fix: it was assumed that isolinux images were always a multiple of 4
|
||||||
|
bytes
|
||||||
|
* New API call iso_image_update_sizes() to refresh recorded file sizes
|
||||||
|
immediately before image generation begins
|
||||||
|
|
||||||
|
libisofs-0.6.6.tar.gz Sun Jun 1 2008
|
||||||
|
===============================================================================
|
||||||
|
* Bug fix: major,minor numbers of device files were not read properly from
|
||||||
|
existing images
|
||||||
|
* Bug fix: iso_tree_path_to_node() returned 1 if a directory path component was
|
||||||
|
a non-directory file
|
||||||
|
* New API call iso_special_get_dev() retrieves major, minor numbers of device
|
||||||
|
files
|
||||||
|
|
||||||
|
libisofs-0.6.4.tar.gz Sun Apr 27 2008
|
||||||
|
===============================================================================
|
||||||
|
* Extended information: iso_node_add_xinfo()
|
||||||
|
* New node iteration: iso_dir_find_children()
|
||||||
|
* Custom image file content via iso_tree_add_new_file()
|
||||||
|
* Missing feature added to map a disk file to an arbitrary image file path via
|
||||||
|
iso_tree_add_new_node()
|
||||||
|
* Obtain image path of a node object via iso_tree_get_node_path()
|
||||||
|
* Various bugfixes
|
||||||
|
|
||||||
|
libisofs-0.6.2.1.tar.gz Thu Feb 14 2008
|
||||||
|
===============================================================================
|
||||||
|
* FIX: missing buffer.h preventing build from succeeding
|
||||||
|
|
||||||
|
Libisofs 0.6.2
|
||||||
|
===============================================================================
|
||||||
|
* Initial release of new generation libisofs
|
||||||
|
* Completely new API
|
||||||
|
* Long term commitment to ABI libisofs.so.6
|
||||||
|
|
||||||
|
libisofs-0.2.8.tar.gz Tue Jul 31 2007
|
||||||
|
===============================================================================
|
||||||
|
* Support for hidden files
|
||||||
|
* Eltorito support
|
||||||
|
* Charset support
|
||||||
|
* Support for inode caching
|
||||||
|
* Ordering files on image
|
||||||
|
* Unit tests
|
||||||
|
* A lot of other features and bugfixes
|
||||||
|
* Note: ABI has been broken.
|
||||||
|
|
||||||
|
libisofs-0.2.5.tar.gz Tue Jul 31 2007
|
||||||
|
===============================================================================
|
||||||
|
* Bugfix release. Fixed the ECMA-related problem with iso tree generation.
|
||||||
|
There is newer release 0.2.8 with a lot of new features.
|
||||||
|
|
||||||
|
libisofs-0.2.4.tar.gz Jan 03 2007
|
||||||
|
===============================================================================
|
||||||
|
* Bugfix release. Fixes lots of problems people have encountered, including but
|
||||||
|
not limited to broken docs generation.
|
||||||
|
|
||||||
|
libisofs-0.2.3.tar.gz Sat Dec 02 2006
|
||||||
|
===============================================================================
|
||||||
|
* Bugfix release, with some improvements for freebsd support.
|
||||||
|
* Requires libburn to compile.
|
@ -42,7 +42,6 @@ libisofs_libisofs_la_SOURCES = \
|
|||||||
libisofs/stream.c \
|
libisofs/stream.c \
|
||||||
libisofs/filter.h \
|
libisofs/filter.h \
|
||||||
libisofs/filter.c \
|
libisofs/filter.c \
|
||||||
libisofs/filters/xor_encrypt.c \
|
|
||||||
libisofs/filters/external.c \
|
libisofs/filters/external.c \
|
||||||
libisofs/filters/zisofs.c \
|
libisofs/filters/zisofs.c \
|
||||||
libisofs/filters/gzip.c \
|
libisofs/filters/gzip.c \
|
||||||
@ -81,6 +80,7 @@ libisofs_libisofs_la_LIBADD= \
|
|||||||
libinclude_HEADERS = \
|
libinclude_HEADERS = \
|
||||||
libisofs/libisofs.h
|
libisofs/libisofs.h
|
||||||
|
|
||||||
|
|
||||||
## ========================================================================= ##
|
## ========================================================================= ##
|
||||||
|
|
||||||
## Build demo applications
|
## Build demo applications
|
||||||
@ -262,6 +262,7 @@ EXTRA_DIST = \
|
|||||||
doc/susp_aaip_isofs_names.txt \
|
doc/susp_aaip_isofs_names.txt \
|
||||||
doc/zisofs_format.txt \
|
doc/zisofs_format.txt \
|
||||||
doc/checksums.txt \
|
doc/checksums.txt \
|
||||||
|
libisofs/libisofs.ver \
|
||||||
libisofs/aaip-os-dummy.c \
|
libisofs/aaip-os-dummy.c \
|
||||||
libisofs/aaip-os-linux.c \
|
libisofs/aaip-os-linux.c \
|
||||||
libisofs/aaip-os-freebsd.c
|
libisofs/aaip-os-freebsd.c
|
||||||
|
15
acinclude.m4
15
acinclude.m4
@ -131,6 +131,21 @@ iconv_close(cd);
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
dnl LIBISOFS_ASSERT_VERS_LIBS is by Thomas Schmitt, libburnia project
|
||||||
|
dnl It tests whether -Wl,--version-script=... works with the compiler
|
||||||
|
AC_DEFUN([LIBISOFS_ASSERT_VERS_LIBS],
|
||||||
|
[
|
||||||
|
libburnia_save_LDFLAGS="$LDFLAGS"
|
||||||
|
LDFLAGS="$LDFLAGS -Wl,--version-script=libisofs/libisofs.ver"
|
||||||
|
AC_TRY_LINK([#include <stdio.h>], [printf("Hello\n");],
|
||||||
|
[vers_libs_test="yes"], [vers_libs_test="no"])
|
||||||
|
if test x$vers_libs_test = xno
|
||||||
|
then
|
||||||
|
LDFLAGS="$libburnia_save_LDFLAGS"
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
dnl LIBBURNIA_SET_PKGCONFIG determines the install directory for the *.pc file.
|
dnl LIBBURNIA_SET_PKGCONFIG determines the install directory for the *.pc file.
|
||||||
dnl Important: Must be performed _after_ TARGET_SHIZZLE
|
dnl Important: Must be performed _after_ TARGET_SHIZZLE
|
||||||
dnl
|
dnl
|
||||||
|
37
configure.ac
37
configure.ac
@ -1,4 +1,4 @@
|
|||||||
AC_INIT([libisofs], [0.6.32], [http://libburnia-project.org])
|
AC_INIT([libisofs], [0.6.36], [http://libburnia-project.org])
|
||||||
AC_PREREQ([2.50])
|
AC_PREREQ([2.50])
|
||||||
dnl AC_CONFIG_HEADER([config.h])
|
dnl AC_CONFIG_HEADER([config.h])
|
||||||
|
|
||||||
@ -9,12 +9,6 @@ LIBBURNIA_SET_FLAGS
|
|||||||
|
|
||||||
AM_INIT_AUTOMAKE([subdir-objects])
|
AM_INIT_AUTOMAKE([subdir-objects])
|
||||||
|
|
||||||
dnl A61101 This breaks Linux build (makes 32 bit off_t)
|
|
||||||
dnl http://sourceware.org/autobook/autobook/autobook_96.html says
|
|
||||||
dnl one must include some config.h and this was a pitfall.
|
|
||||||
dnl So why dig the pit at all ?
|
|
||||||
dnl AM_CONFIG_HEADER(config.h)
|
|
||||||
|
|
||||||
dnl
|
dnl
|
||||||
dnl if MAJOR or MINOR version changes, be sure to change AC_INIT above to match
|
dnl if MAJOR or MINOR version changes, be sure to change AC_INIT above to match
|
||||||
dnl
|
dnl
|
||||||
@ -46,7 +40,7 @@ dnl If LIBISOFS_*_VERSION changes, be sure to change AC_INIT above to match.
|
|||||||
dnl
|
dnl
|
||||||
LIBISOFS_MAJOR_VERSION=0
|
LIBISOFS_MAJOR_VERSION=0
|
||||||
LIBISOFS_MINOR_VERSION=6
|
LIBISOFS_MINOR_VERSION=6
|
||||||
LIBISOFS_MICRO_VERSION=32
|
LIBISOFS_MICRO_VERSION=36
|
||||||
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)
|
||||||
@ -56,10 +50,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
|
||||||
# 2010.05.03 development jump has not yet happened
|
# 2010.09.15 development jump has not yet happened
|
||||||
# SONAME = 34 - 28 = 6 . Library name = libisofs.6.28.0
|
# SONAME = 38 - 32 = 6 . Library name = libisofs.6.32.0
|
||||||
LT_CURRENT=34
|
LT_CURRENT=38
|
||||||
LT_AGE=28
|
LT_AGE=32
|
||||||
LT_REVISION=0
|
LT_REVISION=0
|
||||||
LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
|
LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
|
||||||
|
|
||||||
@ -211,6 +205,25 @@ else
|
|||||||
fi
|
fi
|
||||||
AC_SUBST(ZLIB_DEF)
|
AC_SUBST(ZLIB_DEF)
|
||||||
|
|
||||||
|
# Library versioning normally serves a complex purpose.
|
||||||
|
# Since libisofs obeys strict ABI backward compatibility, it needs only the
|
||||||
|
# simple feature to declare function names "global:" or "local:". Only the
|
||||||
|
# global ones are visible to applications at library load time.
|
||||||
|
AC_ARG_ENABLE(versioned-libs,
|
||||||
|
[ --enable-versioned-libs Enable strict symbol encapsulation , default=yes],
|
||||||
|
, enable_versioned_libs=yes)
|
||||||
|
if test x$enable_versioned_libs = xyes; then
|
||||||
|
vers_libs_test=no
|
||||||
|
LIBISOFS_ASSERT_VERS_LIBS
|
||||||
|
if test x$vers_libs_test = xno
|
||||||
|
then
|
||||||
|
echo "disabled strict symbol encapsulation (test failed)"
|
||||||
|
else
|
||||||
|
echo "enabled strict symbol encapsulation"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "disabled strict symbol encapsulation"
|
||||||
|
fi
|
||||||
|
|
||||||
AC_CONFIG_FILES([
|
AC_CONFIG_FILES([
|
||||||
Makefile
|
Makefile
|
||||||
|
126
demo/demo.c
126
demo/demo.c
@ -52,19 +52,6 @@ static char helptext[][80] = {
|
|||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define LIBISOFS_WITHOUT_LIBBURN yes
|
|
||||||
#include "libisofs.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <err.h>
|
|
||||||
|
|
||||||
#ifndef PATH_MAX
|
#ifndef PATH_MAX
|
||||||
#define PATH_MAX Libisofs_default_path_maX
|
#define PATH_MAX Libisofs_default_path_maX
|
||||||
#endif
|
#endif
|
||||||
@ -98,7 +85,9 @@ tree_print_dir(IsoDir *dir, int level)
|
|||||||
int i;
|
int i;
|
||||||
IsoDirIter *iter;
|
IsoDirIter *iter;
|
||||||
IsoNode *node;
|
IsoNode *node;
|
||||||
char *sp = alloca(level * 2 + 1);
|
char *sp;
|
||||||
|
|
||||||
|
sp = calloc(1, level * 2 + 1);
|
||||||
|
|
||||||
for (i = 0; i < level * 2; i += 2) {
|
for (i = 0; i < level * 2; i += 2) {
|
||||||
sp[i] = '|';
|
sp[i] = '|';
|
||||||
@ -132,6 +121,7 @@ tree_print_dir(IsoDir *dir, int level)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
iso_dir_iter_free(iter);
|
iso_dir_iter_free(iter);
|
||||||
|
free(sp);
|
||||||
}
|
}
|
||||||
|
|
||||||
int gesture_tree(int argc, char **argv)
|
int gesture_tree(int argc, char **argv)
|
||||||
@ -270,7 +260,7 @@ int gesture_iso(int argc, char **argv)
|
|||||||
IsoImage *image;
|
IsoImage *image;
|
||||||
struct burn_source *burn_src;
|
struct burn_source *burn_src;
|
||||||
unsigned char buf[2048];
|
unsigned char buf[2048];
|
||||||
FILE *fd;
|
FILE *fp = NULL;
|
||||||
IsoWriteOpts *opts;
|
IsoWriteOpts *opts;
|
||||||
char *volid = "VOLID";
|
char *volid = "VOLID";
|
||||||
char *boot_img = NULL;
|
char *boot_img = NULL;
|
||||||
@ -281,7 +271,7 @@ int gesture_iso(int argc, char **argv)
|
|||||||
case 'h':
|
case 'h':
|
||||||
iso_usage(argv);
|
iso_usage(argv);
|
||||||
iso_help();
|
iso_help();
|
||||||
exit(0);
|
goto ex;
|
||||||
break;
|
break;
|
||||||
case 'J':
|
case 'J':
|
||||||
j = 1;
|
j = 1;
|
||||||
@ -303,7 +293,7 @@ int gesture_iso(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
iso_usage(argv);
|
iso_usage(argv);
|
||||||
exit(1);
|
goto ex;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -311,30 +301,31 @@ int gesture_iso(int argc, char **argv)
|
|||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
printf ("Please pass directory from which to build ISO\n");
|
printf ("Please pass directory from which to build ISO\n");
|
||||||
iso_usage(argv);
|
iso_usage(argv);
|
||||||
return 1;
|
goto ex;
|
||||||
}
|
}
|
||||||
if (argc < 3) {
|
if (argc < 3) {
|
||||||
printf ("Please supply output file\n");
|
printf ("Please supply output file\n");
|
||||||
iso_usage(argv);
|
iso_usage(argv);
|
||||||
return 1;
|
goto ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = fopen(argv[optind+1], "w");
|
fp = fopen(argv[optind+1], "w");
|
||||||
if (!fd) {
|
if (fp == NULL) {
|
||||||
err(1, "error opening output file");
|
err(1, "error opening output file");
|
||||||
|
goto ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = iso_init();
|
result = iso_init();
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
printf ("Can't initialize libisofs\n");
|
printf ("Can't initialize libisofs\n");
|
||||||
return 1;
|
goto ex;
|
||||||
}
|
}
|
||||||
iso_set_msgs_severities("NEVER", "ALL", "");
|
iso_set_msgs_severities("NEVER", "ALL", "");
|
||||||
|
|
||||||
result = iso_image_new(volid, &image);
|
result = iso_image_new(volid, &image);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
printf ("Error creating image\n");
|
printf ("Error creating image\n");
|
||||||
return 1;
|
goto ex;
|
||||||
}
|
}
|
||||||
iso_tree_set_follow_symlinks(image, 0);
|
iso_tree_set_follow_symlinks(image, 0);
|
||||||
iso_tree_set_ignore_hidden(image, 0);
|
iso_tree_set_ignore_hidden(image, 0);
|
||||||
@ -346,7 +337,7 @@ int gesture_iso(int argc, char **argv)
|
|||||||
argv[optind]);
|
argv[optind]);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
printf ("Error adding directory %d\n", result);
|
printf ("Error adding directory %d\n", result);
|
||||||
return 1;
|
goto ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (boot_img) {
|
if (boot_img) {
|
||||||
@ -356,7 +347,7 @@ int gesture_iso(int argc, char **argv)
|
|||||||
"/isolinux/boot.cat", &bootimg);
|
"/isolinux/boot.cat", &bootimg);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
printf ("Error adding boot image %d\n", result);
|
printf ("Error adding boot image %d\n", result);
|
||||||
return 1;
|
goto ex;
|
||||||
}
|
}
|
||||||
el_torito_set_load_size(bootimg, 4);
|
el_torito_set_load_size(bootimg, 4);
|
||||||
el_torito_patch_isolinux_image(bootimg);
|
el_torito_patch_isolinux_image(bootimg);
|
||||||
@ -365,7 +356,7 @@ int gesture_iso(int argc, char **argv)
|
|||||||
result = iso_write_opts_new(&opts, 0);
|
result = iso_write_opts_new(&opts, 0);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
printf ("Cant create write opts, error %d\n", result);
|
printf ("Cant create write opts, error %d\n", result);
|
||||||
return 1;
|
goto ex;
|
||||||
}
|
}
|
||||||
iso_write_opts_set_iso_level(opts, level);
|
iso_write_opts_set_iso_level(opts, level);
|
||||||
iso_write_opts_set_rockridge(opts, rr);
|
iso_write_opts_set_rockridge(opts, rr);
|
||||||
@ -375,21 +366,25 @@ int gesture_iso(int argc, char **argv)
|
|||||||
result = iso_image_create_burn_source(image, opts, &burn_src);
|
result = iso_image_create_burn_source(image, opts, &burn_src);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
printf ("Cant create image, error %d\n", result);
|
printf ("Cant create image, error %d\n", result);
|
||||||
return 1;
|
goto ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
iso_write_opts_free(opts);
|
iso_write_opts_free(opts);
|
||||||
|
|
||||||
while (burn_src->read_xt(burn_src, buf, 2048) == 2048) {
|
while (burn_src->read_xt(burn_src, buf, 2048) == 2048) {
|
||||||
fwrite(buf, 1, 2048, fd);
|
fwrite(buf, 1, 2048, fp);
|
||||||
}
|
}
|
||||||
fclose(fd);
|
fclose(fp);
|
||||||
burn_src->free_data(burn_src);
|
burn_src->free_data(burn_src);
|
||||||
free(burn_src);
|
free(burn_src);
|
||||||
|
|
||||||
iso_image_unref(image);
|
iso_image_unref(image);
|
||||||
iso_finish();
|
iso_finish();
|
||||||
return 0;
|
return 0;
|
||||||
|
ex:;
|
||||||
|
if (fp != NULL)
|
||||||
|
fclose(fp);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -436,7 +431,9 @@ iso_read_print_dir(IsoFileSource *dir, int level)
|
|||||||
int ret, i;
|
int ret, i;
|
||||||
IsoFileSource *file;
|
IsoFileSource *file;
|
||||||
struct stat info;
|
struct stat info;
|
||||||
char *sp = alloca(level * 2 + 1);
|
char *sp;
|
||||||
|
|
||||||
|
sp = calloc(1, level * 2 + 1);
|
||||||
|
|
||||||
for (i = 0; i < level * 2; i += 2) {
|
for (i = 0; i < level * 2; i += 2) {
|
||||||
sp[i] = '|';
|
sp[i] = '|';
|
||||||
@ -466,6 +463,7 @@ iso_read_print_dir(IsoFileSource *dir, int level)
|
|||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
printf ("Can't print dir\n");
|
printf ("Can't print dir\n");
|
||||||
}
|
}
|
||||||
|
free(sp);
|
||||||
}
|
}
|
||||||
|
|
||||||
int gesture_iso_read(int argc, char **argv)
|
int gesture_iso_read(int argc, char **argv)
|
||||||
@ -630,18 +628,19 @@ int gesture_iso_modify(int argc, char **argv)
|
|||||||
IsoDataSource *src;
|
IsoDataSource *src;
|
||||||
struct burn_source *burn_src;
|
struct burn_source *burn_src;
|
||||||
unsigned char buf[2048];
|
unsigned char buf[2048];
|
||||||
FILE *fd;
|
FILE *fp = NULL;
|
||||||
IsoWriteOpts *opts;
|
IsoWriteOpts *opts;
|
||||||
IsoReadOpts *ropts;
|
IsoReadOpts *ropts;
|
||||||
|
|
||||||
if (argc < 4) {
|
if (argc < 4) {
|
||||||
iso_modify_usage(argv);
|
iso_modify_usage(argv);
|
||||||
return 1;
|
goto ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = fopen(argv[3], "w");
|
fp = fopen(argv[3], "w");
|
||||||
if (!fd) {
|
if (fp == NULL) {
|
||||||
err(1, "error opening output file");
|
err(1, "error opening output file");
|
||||||
|
goto ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
iso_init();
|
iso_init();
|
||||||
@ -651,14 +650,14 @@ int gesture_iso_modify(int argc, char **argv)
|
|||||||
result = iso_data_source_new_from_file(argv[1], &src);
|
result = iso_data_source_new_from_file(argv[1], &src);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
printf ("Error creating data source\n");
|
printf ("Error creating data source\n");
|
||||||
return 1;
|
goto ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create the image context */
|
/* create the image context */
|
||||||
result = iso_image_new("volume_id", &image);
|
result = iso_image_new("volume_id", &image);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
printf ("Error creating image\n");
|
printf ("Error creating image\n");
|
||||||
return 1;
|
goto ex;
|
||||||
}
|
}
|
||||||
iso_tree_set_follow_symlinks(image, 0);
|
iso_tree_set_follow_symlinks(image, 0);
|
||||||
iso_tree_set_ignore_hidden(image, 0);
|
iso_tree_set_ignore_hidden(image, 0);
|
||||||
@ -667,49 +666,53 @@ int gesture_iso_modify(int argc, char **argv)
|
|||||||
result = iso_read_opts_new(&ropts, 0);
|
result = iso_read_opts_new(&ropts, 0);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
fprintf(stderr, "Error creating read options\n");
|
fprintf(stderr, "Error creating read options\n");
|
||||||
return 1;
|
goto ex;
|
||||||
}
|
}
|
||||||
result = iso_image_import(image, src, ropts, NULL);
|
result = iso_image_import(image, src, ropts, NULL);
|
||||||
iso_read_opts_free(ropts);
|
iso_read_opts_free(ropts);
|
||||||
iso_data_source_unref(src);
|
iso_data_source_unref(src);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
printf ("Error importing previous session %d\n", result);
|
printf ("Error importing previous session %d\n", result);
|
||||||
return 1;
|
goto ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add new dir */
|
/* add new dir */
|
||||||
result = iso_tree_add_dir_rec(image, iso_image_get_root(image), argv[2]);
|
result = iso_tree_add_dir_rec(image, iso_image_get_root(image), argv[2]);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
printf ("Error adding directory %d\n", result);
|
printf ("Error adding directory %d\n", result);
|
||||||
return 1;
|
goto ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* generate a new image with both previous and added contents */
|
/* generate a new image with both previous and added contents */
|
||||||
result = iso_write_opts_new(&opts, 1);
|
result = iso_write_opts_new(&opts, 1);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
printf("Cant create write opts, error %d\n", result);
|
printf("Cant create write opts, error %d\n", result);
|
||||||
return 1;
|
goto ex;
|
||||||
}
|
}
|
||||||
/* for isolinux: iso_write_opts_set_allow_full_ascii(opts, 1); */
|
/* for isolinux: iso_write_opts_set_allow_full_ascii(opts, 1); */
|
||||||
|
|
||||||
result = iso_image_create_burn_source(image, opts, &burn_src);
|
result = iso_image_create_burn_source(image, opts, &burn_src);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
printf ("Cant create image, error %d\n", result);
|
printf ("Cant create image, error %d\n", result);
|
||||||
return 1;
|
goto ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
iso_write_opts_free(opts);
|
iso_write_opts_free(opts);
|
||||||
|
|
||||||
while (burn_src->read_xt(burn_src, buf, 2048) == 2048) {
|
while (burn_src->read_xt(burn_src, buf, 2048) == 2048) {
|
||||||
fwrite(buf, 1, 2048, fd);
|
fwrite(buf, 1, 2048, fp);
|
||||||
}
|
}
|
||||||
fclose(fd);
|
fclose(fp);
|
||||||
burn_src->free_data(burn_src);
|
burn_src->free_data(burn_src);
|
||||||
free(burn_src);
|
free(burn_src);
|
||||||
|
|
||||||
iso_image_unref(image);
|
iso_image_unref(image);
|
||||||
iso_finish();
|
iso_finish();
|
||||||
return 0;
|
return 0;
|
||||||
|
ex:
|
||||||
|
if (fp != NULL)
|
||||||
|
fclose(fp);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -728,25 +731,26 @@ int gesture_iso_ms(int argc, char **argv)
|
|||||||
IsoDataSource *src;
|
IsoDataSource *src;
|
||||||
struct burn_source *burn_src;
|
struct burn_source *burn_src;
|
||||||
unsigned char buf[2048];
|
unsigned char buf[2048];
|
||||||
FILE *fd;
|
FILE *fp = NULL;
|
||||||
IsoWriteOpts *opts;
|
IsoWriteOpts *opts;
|
||||||
IsoReadOpts *ropts;
|
IsoReadOpts *ropts;
|
||||||
uint32_t ms_block;
|
uint32_t ms_block;
|
||||||
|
|
||||||
if (argc < 6) {
|
if (argc < 6) {
|
||||||
iso_ms_usage(argv);
|
iso_ms_usage(argv);
|
||||||
return 1;
|
goto ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(argv[3], argv[5]) == 0) {
|
if (strcmp(argv[3], argv[5]) == 0) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"image_file and output_file must not be the same file.\n");
|
"image_file and output_file must not be the same file.\n");
|
||||||
return 1;
|
goto ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = fopen(argv[5], "w");
|
fp = fopen(argv[5], "w");
|
||||||
if (!fd) {
|
if (!fp) {
|
||||||
err(1, "error opening output file");
|
err(1, "error opening output file");
|
||||||
|
goto ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
iso_init();
|
iso_init();
|
||||||
@ -756,14 +760,14 @@ int gesture_iso_ms(int argc, char **argv)
|
|||||||
result = iso_data_source_new_from_file(argv[3], &src);
|
result = iso_data_source_new_from_file(argv[3], &src);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
printf ("Error creating data source\n");
|
printf ("Error creating data source\n");
|
||||||
return 1;
|
goto ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create the image context */
|
/* create the image context */
|
||||||
result = iso_image_new("volume_id", &image);
|
result = iso_image_new("volume_id", &image);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
printf ("Error creating image\n");
|
printf ("Error creating image\n");
|
||||||
return 1;
|
goto ex;
|
||||||
}
|
}
|
||||||
iso_tree_set_follow_symlinks(image, 0);
|
iso_tree_set_follow_symlinks(image, 0);
|
||||||
iso_tree_set_ignore_hidden(image, 0);
|
iso_tree_set_ignore_hidden(image, 0);
|
||||||
@ -772,7 +776,7 @@ int gesture_iso_ms(int argc, char **argv)
|
|||||||
result = iso_read_opts_new(&ropts, 0);
|
result = iso_read_opts_new(&ropts, 0);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
fprintf(stderr, "Error creating read options\n");
|
fprintf(stderr, "Error creating read options\n");
|
||||||
return 1;
|
goto ex;
|
||||||
}
|
}
|
||||||
iso_read_opts_set_start_block(ropts, atoi(argv[1]));
|
iso_read_opts_set_start_block(ropts, atoi(argv[1]));
|
||||||
result = iso_image_import(image, src, ropts, NULL);
|
result = iso_image_import(image, src, ropts, NULL);
|
||||||
@ -780,21 +784,21 @@ int gesture_iso_ms(int argc, char **argv)
|
|||||||
iso_data_source_unref(src);
|
iso_data_source_unref(src);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
printf ("Error importing previous session %d\n", result);
|
printf ("Error importing previous session %d\n", result);
|
||||||
return 1;
|
goto ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add new dir */
|
/* add new dir */
|
||||||
result = iso_tree_add_dir_rec(image, iso_image_get_root(image), argv[4]);
|
result = iso_tree_add_dir_rec(image, iso_image_get_root(image), argv[4]);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
printf ("Error adding directory %d\n", result);
|
printf ("Error adding directory %d\n", result);
|
||||||
return 1;
|
goto ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* generate a multisession image with new contents */
|
/* generate a multisession image with new contents */
|
||||||
result = iso_write_opts_new(&opts, 1);
|
result = iso_write_opts_new(&opts, 1);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
printf("Cant create write opts, error %d\n", result);
|
printf("Cant create write opts, error %d\n", result);
|
||||||
return 1;
|
goto ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* round up to 32kb aligment = 16 block */
|
/* round up to 32kb aligment = 16 block */
|
||||||
@ -805,20 +809,24 @@ int gesture_iso_ms(int argc, char **argv)
|
|||||||
result = iso_image_create_burn_source(image, opts, &burn_src);
|
result = iso_image_create_burn_source(image, opts, &burn_src);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
printf ("Cant create image, error %d\n", result);
|
printf ("Cant create image, error %d\n", result);
|
||||||
return 1;
|
goto ex;
|
||||||
}
|
}
|
||||||
iso_write_opts_free(opts);
|
iso_write_opts_free(opts);
|
||||||
|
|
||||||
while (burn_src->read_xt(burn_src, buf, 2048) == 2048) {
|
while (burn_src->read_xt(burn_src, buf, 2048) == 2048) {
|
||||||
fwrite(buf, 1, 2048, fd);
|
fwrite(buf, 1, 2048, fp);
|
||||||
}
|
}
|
||||||
fclose(fd);
|
fclose(fp);
|
||||||
burn_src->free_data(burn_src);
|
burn_src->free_data(burn_src);
|
||||||
free(burn_src);
|
free(burn_src);
|
||||||
|
|
||||||
iso_image_unref(image);
|
iso_image_unref(image);
|
||||||
iso_finish();
|
iso_finish();
|
||||||
return 0;
|
return 0;
|
||||||
|
ex:;
|
||||||
|
if (fp != NULL)
|
||||||
|
fclose(fp);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -154,13 +154,6 @@ QT_AUTOBRIEF = NO
|
|||||||
|
|
||||||
MULTILINE_CPP_IS_BRIEF = YES
|
MULTILINE_CPP_IS_BRIEF = YES
|
||||||
|
|
||||||
# If the DETAILS_AT_TOP tag is set to YES then Doxygen
|
|
||||||
# will output the detailed description near the top, like JavaDoc.
|
|
||||||
# If set to NO, the detailed description appears after the member
|
|
||||||
# documentation.
|
|
||||||
|
|
||||||
DETAILS_AT_TOP = YES
|
|
||||||
|
|
||||||
# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
|
# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
|
||||||
# member inherits the documentation from any documented member that it
|
# member inherits the documentation from any documented member that it
|
||||||
# re-implements.
|
# re-implements.
|
||||||
|
@ -15,6 +15,10 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -11,6 +11,10 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -11,6 +11,10 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -11,6 +11,10 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -17,6 +17,10 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Use the copy of the struct burn_source definition in libisofs.h
|
Use the copy of the struct burn_source definition in libisofs.h
|
||||||
*/
|
*/
|
||||||
@ -289,7 +293,51 @@ unsigned int iso_ring_buffer_get_times_empty(IsoRingBuffer *buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/** Internal via buffer.h
|
||||||
|
*
|
||||||
|
* Get the status of a ring buffer.
|
||||||
|
*
|
||||||
|
* @param buf
|
||||||
|
* The ring buffer object to inquire
|
||||||
|
* @param size
|
||||||
|
* Will be filled with the total size of the buffer, in bytes
|
||||||
|
* @param free_bytes
|
||||||
|
* Will be filled with the bytes currently available in buffer
|
||||||
|
* @return
|
||||||
|
* < 0 error, > 0 state:
|
||||||
|
* 1="active" : input and consumption are active
|
||||||
|
* 2="ending" : input has ended without error
|
||||||
|
* 3="failing" : input had error and ended,
|
||||||
|
* 5="abandoned" : consumption has ended prematurely
|
||||||
|
* 6="ended" : consumption has ended without input error
|
||||||
|
* 7="aborted" : consumption has ended after input error
|
||||||
|
*/
|
||||||
|
int iso_ring_buffer_get_buf_status(IsoRingBuffer *buf, size_t *size,
|
||||||
|
size_t *free_bytes)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (buf == NULL) {
|
||||||
|
return ISO_NULL_POINTER;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get mutex */
|
||||||
|
pthread_mutex_lock(&buf->mutex);
|
||||||
|
if (size) {
|
||||||
|
*size = buf->cap;
|
||||||
|
}
|
||||||
|
if (free_bytes) {
|
||||||
|
*free_bytes = buf->cap - buf->size;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = (buf->rend ? 4 : 0) + (buf->wend + 1);
|
||||||
|
|
||||||
|
pthread_mutex_unlock(&buf->mutex);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** API via libisofs.h
|
||||||
|
*
|
||||||
* Get the status of the buffer used by a burn_source.
|
* Get the status of the buffer used by a burn_source.
|
||||||
*
|
*
|
||||||
* @param b
|
* @param b
|
||||||
@ -317,18 +365,7 @@ int iso_ring_buffer_get_status(struct burn_source *b, size_t *size,
|
|||||||
return ISO_NULL_POINTER;
|
return ISO_NULL_POINTER;
|
||||||
}
|
}
|
||||||
buf = ((Ecma119Image*)(b->data))->buffer;
|
buf = ((Ecma119Image*)(b->data))->buffer;
|
||||||
|
ret = iso_ring_buffer_get_buf_status(buf, size, free_bytes);
|
||||||
/* get mutex */
|
|
||||||
pthread_mutex_lock(&buf->mutex);
|
|
||||||
if (size) {
|
|
||||||
*size = buf->cap;
|
|
||||||
}
|
|
||||||
if (free_bytes) {
|
|
||||||
*free_bytes = buf->cap - buf->size;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = (buf->rend ? 4 : 0) + (buf->wend + 1);
|
|
||||||
|
|
||||||
pthread_mutex_unlock(&buf->mutex);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,6 +63,28 @@ int iso_ring_buffer_write(IsoRingBuffer *buf, uint8_t *data, size_t count);
|
|||||||
*/
|
*/
|
||||||
int iso_ring_buffer_read(IsoRingBuffer *buf, uint8_t *dest, size_t count);
|
int iso_ring_buffer_read(IsoRingBuffer *buf, uint8_t *dest, size_t count);
|
||||||
|
|
||||||
|
/** Backend of API call iso_ring_buffer_get_status()
|
||||||
|
*
|
||||||
|
* Get the status of a ring buffer.
|
||||||
|
*
|
||||||
|
* @param buf
|
||||||
|
* The ring buffer object to inquire
|
||||||
|
* @param size
|
||||||
|
* Will be filled with the total size of the buffer, in bytes
|
||||||
|
* @param free_bytes
|
||||||
|
* Will be filled with the bytes currently available in buffer
|
||||||
|
* @return
|
||||||
|
* < 0 error, > 0 state:
|
||||||
|
* 1="active" : input and consumption are active
|
||||||
|
* 2="ending" : input has ended without error
|
||||||
|
* 3="failing" : input had error and ended,
|
||||||
|
* 5="abandoned" : consumption has ended prematurely
|
||||||
|
* 6="ended" : consumption has ended without input error
|
||||||
|
* 7="aborted" : consumption has ended after input error
|
||||||
|
*/
|
||||||
|
int iso_ring_buffer_get_buf_status(IsoRingBuffer *buf, size_t *size,
|
||||||
|
size_t *free_bytes);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close the buffer (to be called by the writer).
|
* Close the buffer (to be called by the writer).
|
||||||
* You have to explicity close the buffer when you don't have more data to
|
* You have to explicity close the buffer when you don't have more data to
|
||||||
|
@ -8,6 +8,10 @@
|
|||||||
* See COPYING file for details.
|
* See COPYING file for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* libisofs.h defines aaip_xinfo_func */
|
/* libisofs.h defines aaip_xinfo_func */
|
||||||
#include "libisofs.h"
|
#include "libisofs.h"
|
||||||
|
|
||||||
|
@ -7,6 +7,10 @@
|
|||||||
* See COPYING file for details.
|
* See COPYING file for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "libisofs.h"
|
#include "libisofs.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
@ -9,6 +9,10 @@
|
|||||||
* See COPYING file for details.
|
* See COPYING file for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Use the copy of the struct burn_source definition in libisofs.h
|
Use the copy of the struct burn_source definition in libisofs.h
|
||||||
*/
|
*/
|
||||||
@ -27,10 +31,7 @@
|
|||||||
#include "rockridge.h"
|
#include "rockridge.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "system_area.h"
|
#include "system_area.h"
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
#include "md5.h"
|
#include "md5.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -76,18 +77,17 @@ void ecma119_image_free(Ecma119Image *t)
|
|||||||
free(t->bootsrc);
|
free(t->bootsrc);
|
||||||
if (t->system_area_data != NULL)
|
if (t->system_area_data != NULL)
|
||||||
free(t->system_area_data);
|
free(t->system_area_data);
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
if (t->checksum_ctx != NULL) { /* dispose checksum context */
|
if (t->checksum_ctx != NULL) { /* dispose checksum context */
|
||||||
char md5[16];
|
char md5[16];
|
||||||
iso_md5_end(&(t->checksum_ctx), md5);
|
iso_md5_end(&(t->checksum_ctx), md5);
|
||||||
}
|
}
|
||||||
if (t->checksum_buffer != NULL)
|
if (t->checksum_buffer != NULL)
|
||||||
free(t->checksum_buffer);
|
free(t->checksum_buffer);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (t->writers != NULL)
|
if (t->writers != NULL)
|
||||||
free(t->writers);
|
free(t->writers);
|
||||||
|
if (t->partition_root != NULL)
|
||||||
|
ecma119_node_free(t->partition_root);
|
||||||
|
t->partition_root = NULL;
|
||||||
free(t);
|
free(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,6 +234,7 @@ int ecma119_writer_compute_data_blocks(IsoImageWriter *writer)
|
|||||||
{
|
{
|
||||||
Ecma119Image *target;
|
Ecma119Image *target;
|
||||||
uint32_t path_table_size;
|
uint32_t path_table_size;
|
||||||
|
size_t ndirs;
|
||||||
|
|
||||||
if (writer == NULL) {
|
if (writer == NULL) {
|
||||||
return ISO_ASSERT_FAILURE;
|
return ISO_ASSERT_FAILURE;
|
||||||
@ -257,16 +258,33 @@ int ecma119_writer_compute_data_blocks(IsoImageWriter *writer)
|
|||||||
target->curblock += DIV_UP(path_table_size, BLOCK_SIZE);
|
target->curblock += DIV_UP(path_table_size, BLOCK_SIZE);
|
||||||
target->path_table_size = path_table_size;
|
target->path_table_size = path_table_size;
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
if (target->md5_session_checksum) {
|
if (target->md5_session_checksum) {
|
||||||
/* Account for tree checksum tag */
|
/* Account for first tree checksum tag */
|
||||||
target->checksum_tree_tag_pos = target->curblock;
|
target->checksum_tree_tag_pos = target->curblock;
|
||||||
target->curblock++;
|
target->curblock++;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
if (target->partition_offset > 0) {
|
||||||
|
/* Take into respect the second directory tree */
|
||||||
|
ndirs = target->ndirs;
|
||||||
|
target->ndirs = 0;
|
||||||
|
calc_dir_pos(target, target->partition_root);
|
||||||
|
if (target->ndirs != ndirs) {
|
||||||
|
iso_msg_submit(target->image->id, ISO_ASSERT_FAILURE, 0,
|
||||||
|
"Number of directories differs in ECMA-119 partiton_tree");
|
||||||
|
return ISO_ASSERT_FAILURE;
|
||||||
|
}
|
||||||
|
/* Take into respect the second set of path tables */
|
||||||
|
path_table_size = calc_path_table_size(target->partition_root);
|
||||||
|
target->partition_l_table_pos = target->curblock;
|
||||||
|
target->curblock += DIV_UP(path_table_size, BLOCK_SIZE);
|
||||||
|
target->partition_m_table_pos = target->curblock;
|
||||||
|
target->curblock += DIV_UP(path_table_size, BLOCK_SIZE);
|
||||||
|
|
||||||
|
/* >>> TWINTREE: >>> For now, checksum tags are only for the
|
||||||
|
image start and not for the partition */;
|
||||||
|
|
||||||
|
}
|
||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,7 +350,7 @@ void write_one_dir_record(Ecma119Image *t, Ecma119Node *node, int file_id,
|
|||||||
node = node->parent;
|
node = node->parent;
|
||||||
|
|
||||||
rec->len_dr[0] = len_dr + (info != NULL ? info->suf_len : 0);
|
rec->len_dr[0] = len_dr + (info != NULL ? info->suf_len : 0);
|
||||||
iso_bb(rec->block, block, 4);
|
iso_bb(rec->block, block - t->eff_partition_offset, 4);
|
||||||
iso_bb(rec->length, len, 4);
|
iso_bb(rec->length, len, 4);
|
||||||
if (t->dir_rec_mtime) {
|
if (t->dir_rec_mtime) {
|
||||||
iso= node->node;
|
iso= node->node;
|
||||||
@ -420,15 +438,26 @@ int ecma119_writer_write_vol_desc(IsoImageWriter *writer)
|
|||||||
vol.vol_desc_version[0] = 1;
|
vol.vol_desc_version[0] = 1;
|
||||||
strncpy_pad((char*)vol.system_id, system_id, 32);
|
strncpy_pad((char*)vol.system_id, system_id, 32);
|
||||||
strncpy_pad((char*)vol.volume_id, vol_id, 32);
|
strncpy_pad((char*)vol.volume_id, vol_id, 32);
|
||||||
iso_bb(vol.vol_space_size, t->vol_space_size, 4);
|
iso_bb(vol.vol_space_size, t->vol_space_size - t->eff_partition_offset,
|
||||||
|
4);
|
||||||
iso_bb(vol.vol_set_size, (uint32_t) 1, 2);
|
iso_bb(vol.vol_set_size, (uint32_t) 1, 2);
|
||||||
iso_bb(vol.vol_seq_number, (uint32_t) 1, 2);
|
iso_bb(vol.vol_seq_number, (uint32_t) 1, 2);
|
||||||
iso_bb(vol.block_size, (uint32_t) BLOCK_SIZE, 2);
|
iso_bb(vol.block_size, (uint32_t) BLOCK_SIZE, 2);
|
||||||
iso_bb(vol.path_table_size, t->path_table_size, 4);
|
iso_bb(vol.path_table_size, t->path_table_size, 4);
|
||||||
iso_lsb(vol.l_path_table_pos, t->l_path_table_pos, 4);
|
|
||||||
iso_msb(vol.m_path_table_pos, t->m_path_table_pos, 4);
|
|
||||||
|
|
||||||
write_one_dir_record(t, t->root, 0, vol.root_dir_record, 1, NULL, 0);
|
if (t->eff_partition_offset > 0) {
|
||||||
|
/* Point to second tables and second root */
|
||||||
|
iso_lsb(vol.l_path_table_pos,
|
||||||
|
t->partition_l_table_pos - t->eff_partition_offset, 4);
|
||||||
|
iso_msb(vol.m_path_table_pos,
|
||||||
|
t->partition_m_table_pos - t->eff_partition_offset, 4);
|
||||||
|
write_one_dir_record(t, t->partition_root, 0,
|
||||||
|
vol.root_dir_record, 1, NULL, 0);
|
||||||
|
} else {
|
||||||
|
iso_lsb(vol.l_path_table_pos, t->l_path_table_pos, 4);
|
||||||
|
iso_msb(vol.m_path_table_pos, t->m_path_table_pos, 4);
|
||||||
|
write_one_dir_record(t, t->root, 0, vol.root_dir_record, 1, NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
strncpy_pad((char*)vol.vol_set_id, volset_id, 128);
|
strncpy_pad((char*)vol.vol_set_id, volset_id, 128);
|
||||||
strncpy_pad((char*)vol.publisher_id, pub_id, 128);
|
strncpy_pad((char*)vol.publisher_id, pub_id, 128);
|
||||||
@ -646,7 +675,8 @@ int write_path_table(Ecma119Image *t, Ecma119Node **pathlist, int l_type)
|
|||||||
rec = (struct ecma119_path_table_record*) buf;
|
rec = (struct ecma119_path_table_record*) buf;
|
||||||
rec->len_di[0] = dir->parent ? (uint8_t) strlen(dir->iso_name) : 1;
|
rec->len_di[0] = dir->parent ? (uint8_t) strlen(dir->iso_name) : 1;
|
||||||
rec->len_xa[0] = 0;
|
rec->len_xa[0] = 0;
|
||||||
write_int(rec->block, dir->info.dir->block, 4);
|
write_int(rec->block, dir->info.dir->block - t->eff_partition_offset,
|
||||||
|
4);
|
||||||
write_int(rec->parent, parent + 1, 2);
|
write_int(rec->parent, parent + 1, 2);
|
||||||
if (dir->parent) {
|
if (dir->parent) {
|
||||||
memcpy(rec->dir_id, dir->iso_name, rec->len_di[0]);
|
memcpy(rec->dir_id, dir->iso_name, rec->len_di[0]);
|
||||||
@ -685,7 +715,12 @@ int write_path_tables(Ecma119Image *t)
|
|||||||
if (pathlist == NULL) {
|
if (pathlist == NULL) {
|
||||||
return ISO_OUT_OF_MEM;
|
return ISO_OUT_OF_MEM;
|
||||||
}
|
}
|
||||||
pathlist[0] = t->root;
|
|
||||||
|
if (t->eff_partition_offset > 0) {
|
||||||
|
pathlist[0] = t->partition_root;
|
||||||
|
} else {
|
||||||
|
pathlist[0] = t->root;
|
||||||
|
}
|
||||||
cur = 1;
|
cur = 1;
|
||||||
|
|
||||||
for (i = 0; i < t->ndirs; i++) {
|
for (i = 0; i < t->ndirs; i++) {
|
||||||
@ -712,11 +747,82 @@ int write_path_tables(Ecma119Image *t)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write both the directory structure (ECMA-119, 6.8) and the L and M
|
* Write the directory structure (ECMA-119, 6.8) and the L and M
|
||||||
* Path Tables (ECMA-119, 6.9).
|
* Path Tables (ECMA-119, 6.9).
|
||||||
*/
|
*/
|
||||||
static
|
static
|
||||||
|
int ecma119_writer_write_dirs(IsoImageWriter *writer)
|
||||||
|
{
|
||||||
|
int ret, isofs_ca_changed = 0;
|
||||||
|
Ecma119Image *t;
|
||||||
|
Ecma119Node *root;
|
||||||
|
char *value = NULL;
|
||||||
|
size_t value_length;
|
||||||
|
|
||||||
|
t = writer->target;
|
||||||
|
|
||||||
|
/* first of all, we write the directory structure */
|
||||||
|
if (t->eff_partition_offset > 0) {
|
||||||
|
root = t->partition_root;
|
||||||
|
|
||||||
|
if ((t->md5_file_checksums & 1) || t->md5_session_checksum) {
|
||||||
|
/* Take into respect the address offset in "isofs.ca" */
|
||||||
|
ret = iso_node_lookup_attr((IsoNode *) t->image->root, "isofs.ca",
|
||||||
|
&value_length, &value, 0);
|
||||||
|
if (value != NULL)
|
||||||
|
free(value);
|
||||||
|
if (ret == 1 && value_length == 20) {
|
||||||
|
/* "isofs.ca" does really exist and has the expected length */
|
||||||
|
ret = iso_root_set_isofsca((IsoNode *) t->image->root,
|
||||||
|
t->checksum_range_start - t->eff_partition_offset,
|
||||||
|
t->checksum_array_pos - t->eff_partition_offset,
|
||||||
|
t->checksum_idx_counter + 2, 16, "MD5", 0);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
isofs_ca_changed = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
root = t->root;
|
||||||
|
}
|
||||||
|
ret = write_dirs(t, root, root);
|
||||||
|
if (ret < 0) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* and write the path tables */
|
||||||
|
ret = write_path_tables(t);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
if (t->md5_session_checksum) {
|
||||||
|
/* Write tree checksum tag */
|
||||||
|
if (t->eff_partition_offset > 0) {
|
||||||
|
/* >>> TWINTREE: >>> For now, tags are only for the
|
||||||
|
image start and not for the partition */;
|
||||||
|
} else {
|
||||||
|
ret = iso_md5_write_tag(t, 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isofs_ca_changed) {
|
||||||
|
/* Restore old addresses offset in "isofs.ca" of root node */
|
||||||
|
ret = iso_root_set_isofsca((IsoNode *) t->image->root,
|
||||||
|
t->checksum_range_start,
|
||||||
|
t->checksum_array_pos,
|
||||||
|
t->checksum_idx_counter + 2, 16, "MD5", 0);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write directory structure and Path Tables of the ECMA-119 tree.
|
||||||
|
* This happens eventually a second time for the duplicates which use
|
||||||
|
* addresses with partition offset.
|
||||||
|
*/
|
||||||
|
static
|
||||||
int ecma119_writer_write_data(IsoImageWriter *writer)
|
int ecma119_writer_write_data(IsoImageWriter *writer)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@ -727,27 +833,18 @@ int ecma119_writer_write_data(IsoImageWriter *writer)
|
|||||||
}
|
}
|
||||||
t = writer->target;
|
t = writer->target;
|
||||||
|
|
||||||
/* first of all, we write the directory structure */
|
ret = ecma119_writer_write_dirs(writer);
|
||||||
ret = write_dirs(t, t->root, t->root);
|
|
||||||
if (ret < 0) {
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* and write the path tables */
|
|
||||||
ret = write_path_tables(t);
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
if (t->partition_offset > 0) {
|
||||||
|
t->eff_partition_offset = t->partition_offset;
|
||||||
if (t->md5_session_checksum) {
|
ret = ecma119_writer_write_dirs(writer);
|
||||||
/* Write tree checksum tag */
|
t->eff_partition_offset = 0;
|
||||||
ret = iso_md5_write_tag(t, 3);
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
return ISO_SUCCESS;
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
@ -783,6 +880,15 @@ int ecma119_writer_create(Ecma119Image *target)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(target->partition_offset > 0) {
|
||||||
|
/* Create second tree */
|
||||||
|
target->eff_partition_offset = target->partition_offset;
|
||||||
|
ret = ecma119_tree_create(target);
|
||||||
|
target->eff_partition_offset = 0;
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/* we need the volume descriptor */
|
/* we need the volume descriptor */
|
||||||
target->curblock++;
|
target->curblock++;
|
||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
@ -793,15 +899,16 @@ static
|
|||||||
int pad_writer_compute_data_blocks(IsoImageWriter *writer)
|
int pad_writer_compute_data_blocks(IsoImageWriter *writer)
|
||||||
{
|
{
|
||||||
Ecma119Image *target;
|
Ecma119Image *target;
|
||||||
|
uint32_t min_size;
|
||||||
|
|
||||||
if (writer == NULL) {
|
if (writer == NULL) {
|
||||||
return ISO_ASSERT_FAILURE;
|
return ISO_ASSERT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
target = writer->target;
|
target = writer->target;
|
||||||
if (target->curblock < 32) {
|
min_size = 32 + target->partition_offset;
|
||||||
target->pad_blocks = 32 - target->curblock;
|
if (target->curblock < min_size) {
|
||||||
target->curblock = 32;
|
target->pad_blocks = min_size - target->curblock;
|
||||||
|
target->curblock = min_size;
|
||||||
}
|
}
|
||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -882,12 +989,158 @@ int transplant_checksum_buffer(Ecma119Image *target, int flag)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
int write_vol_desc_terminator(Ecma119Image *target)
|
||||||
|
{
|
||||||
|
int res;
|
||||||
|
uint8_t buf[BLOCK_SIZE];
|
||||||
|
struct ecma119_vol_desc_terminator *vol;
|
||||||
|
|
||||||
|
vol = (struct ecma119_vol_desc_terminator *) buf;
|
||||||
|
|
||||||
|
vol->vol_desc_type[0] = 255;
|
||||||
|
memcpy(vol->std_identifier, "CD001", 5);
|
||||||
|
vol->vol_desc_version[0] = 1;
|
||||||
|
|
||||||
|
res = iso_write(target, buf, BLOCK_SIZE);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* @param flag bit0= initialize system area by target->opts_overwrite
|
||||||
|
bit1= fifo is not yet draining. Inquire write_count from fifo.
|
||||||
|
*/
|
||||||
|
static
|
||||||
|
int write_head_part1(Ecma119Image *target, int *write_count, int flag)
|
||||||
|
{
|
||||||
|
int res, i;
|
||||||
|
uint8_t sa[16 * BLOCK_SIZE];
|
||||||
|
IsoImageWriter *writer;
|
||||||
|
size_t buffer_size = 0, buffer_free = 0, buffer_start_free = 0;
|
||||||
|
|
||||||
|
iso_ring_buffer_get_buf_status(target->buffer, &buffer_size,
|
||||||
|
&buffer_start_free);
|
||||||
|
*write_count = 0;
|
||||||
|
/* Write System Area (ECMA-119, 6.2.1) */
|
||||||
|
if ((flag & 1) && target->opts_overwrite != NULL)
|
||||||
|
memcpy(sa, target->opts_overwrite, 16 * BLOCK_SIZE);
|
||||||
|
res = iso_write_system_area(target, sa);
|
||||||
|
if (res < 0)
|
||||||
|
goto write_error;
|
||||||
|
res = iso_write(target, sa, 16 * BLOCK_SIZE);
|
||||||
|
if (res < 0)
|
||||||
|
goto write_error;
|
||||||
|
*write_count = 16;
|
||||||
|
|
||||||
|
/* write volume descriptors, one per writer */
|
||||||
|
iso_msg_debug(target->image->id, "Write volume descriptors");
|
||||||
|
for (i = 0; i < target->nwriters; ++i) {
|
||||||
|
writer = target->writers[i];
|
||||||
|
res = writer->write_vol_desc(writer);
|
||||||
|
if (res < 0)
|
||||||
|
goto write_error;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* write Volume Descriptor Set Terminator (ECMA-119, 8.3) */
|
||||||
|
res = write_vol_desc_terminator(target);
|
||||||
|
if (res < 0)
|
||||||
|
goto write_error;
|
||||||
|
|
||||||
|
if(flag & 2) {
|
||||||
|
iso_ring_buffer_get_buf_status(target->buffer, &buffer_size,
|
||||||
|
&buffer_free);
|
||||||
|
*write_count = ( buffer_start_free - buffer_free ) / BLOCK_SIZE;
|
||||||
|
} else {
|
||||||
|
*write_count = target->bytes_written / BLOCK_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ISO_SUCCESS;
|
||||||
|
write_error:;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
int write_head_part2(Ecma119Image *target, int *write_count, int flag)
|
||||||
|
{
|
||||||
|
int res, i;
|
||||||
|
uint8_t buf[BLOCK_SIZE];
|
||||||
|
IsoImageWriter *writer;
|
||||||
|
|
||||||
|
if (target->partition_offset <= 0)
|
||||||
|
return ISO_SUCCESS;
|
||||||
|
|
||||||
|
/* Write padding up to target->partition_offset + 16 */
|
||||||
|
memset(buf, 0, 2048);
|
||||||
|
for(; *write_count < target->partition_offset + 16; (*write_count)++) {
|
||||||
|
res = iso_write(target, buf, BLOCK_SIZE);
|
||||||
|
if (res < 0)
|
||||||
|
goto write_error;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Write volume descriptors subtracting
|
||||||
|
target->partiton_offset from any LBA pointer.
|
||||||
|
*/
|
||||||
|
target->eff_partition_offset = target->partition_offset;
|
||||||
|
for (i = 0; i < target->nwriters; ++i) {
|
||||||
|
writer = target->writers[i];
|
||||||
|
/* Not all writers have an entry in the partion volume descriptor set.
|
||||||
|
It must be guaranteed that they write exactly one block.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* >>> TWINTREE: Enhance ISO1999 writer and add it here */
|
||||||
|
|
||||||
|
if(writer->write_vol_desc != ecma119_writer_write_vol_desc &&
|
||||||
|
writer->write_vol_desc != joliet_writer_write_vol_desc)
|
||||||
|
continue;
|
||||||
|
res = writer->write_vol_desc(writer);
|
||||||
|
if (res < 0)
|
||||||
|
goto write_error;
|
||||||
|
(*write_count)++;
|
||||||
|
}
|
||||||
|
res = write_vol_desc_terminator(target);
|
||||||
|
if (res < 0)
|
||||||
|
goto write_error;
|
||||||
|
(*write_count)++;
|
||||||
|
target->eff_partition_offset = 0;
|
||||||
|
|
||||||
|
/* >>> TWINTREE: Postponed for now:
|
||||||
|
Write second superblock checksum tag */;
|
||||||
|
|
||||||
|
return ISO_SUCCESS;
|
||||||
|
write_error:;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
int write_head_part(Ecma119Image *target, int flag)
|
||||||
|
{
|
||||||
|
int res, write_count = 0;
|
||||||
|
|
||||||
|
/* System area and volume descriptors */
|
||||||
|
res = write_head_part1(target, &write_count, 0);
|
||||||
|
if (res < 0)
|
||||||
|
return res;
|
||||||
|
|
||||||
|
/* Write superblock checksum tag */
|
||||||
|
if (target->md5_session_checksum && target->checksum_ctx != NULL) {
|
||||||
|
res = iso_md5_write_tag(target, 2);
|
||||||
|
if (res < 0)
|
||||||
|
return res;
|
||||||
|
write_count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Second set of system area and volume descriptors for partition_offset */
|
||||||
|
res = write_head_part2(target, &write_count, 0);
|
||||||
|
if (res < 0)
|
||||||
|
return res;
|
||||||
|
return ISO_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
void *write_function(void *arg)
|
void *write_function(void *arg)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
size_t i;
|
size_t i;
|
||||||
uint8_t buf[BLOCK_SIZE];
|
|
||||||
IsoImageWriter *writer;
|
IsoImageWriter *writer;
|
||||||
|
|
||||||
Ecma119Image *target = (Ecma119Image*)arg;
|
Ecma119Image *target = (Ecma119Image*)arg;
|
||||||
@ -896,55 +1149,9 @@ void *write_function(void *arg)
|
|||||||
target->bytes_written = (off_t) 0;
|
target->bytes_written = (off_t) 0;
|
||||||
target->percent_written = 0;
|
target->percent_written = 0;
|
||||||
|
|
||||||
/* Write System Area (ECMA-119, 6.2.1) */
|
res = write_head_part(target, 0);
|
||||||
{
|
if (res < 0)
|
||||||
uint8_t sa[16 * BLOCK_SIZE];
|
goto write_error;
|
||||||
res = iso_write_system_area(target, sa);
|
|
||||||
if (res < 0) {
|
|
||||||
goto write_error;
|
|
||||||
}
|
|
||||||
res = iso_write(target, sa, 16 * BLOCK_SIZE);
|
|
||||||
if (res < 0) {
|
|
||||||
goto write_error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* write volume descriptors, one per writer */
|
|
||||||
iso_msg_debug(target->image->id, "Write volume descriptors");
|
|
||||||
for (i = 0; i < target->nwriters; ++i) {
|
|
||||||
writer = target->writers[i];
|
|
||||||
res = writer->write_vol_desc(writer);
|
|
||||||
if (res < 0) {
|
|
||||||
goto write_error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* write Volume Descriptor Set Terminator (ECMA-119, 8.3) */
|
|
||||||
{
|
|
||||||
struct ecma119_vol_desc_terminator *vol;
|
|
||||||
vol = (struct ecma119_vol_desc_terminator *) buf;
|
|
||||||
|
|
||||||
vol->vol_desc_type[0] = 255;
|
|
||||||
memcpy(vol->std_identifier, "CD001", 5);
|
|
||||||
vol->vol_desc_version[0] = 1;
|
|
||||||
|
|
||||||
res = iso_write(target, buf, BLOCK_SIZE);
|
|
||||||
if (res < 0) {
|
|
||||||
goto write_error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
/* Write superblock checksum tag */
|
|
||||||
if (target->md5_session_checksum && target->checksum_ctx != NULL) {
|
|
||||||
res = iso_md5_write_tag(target, 2);
|
|
||||||
if (res < 0)
|
|
||||||
goto write_error;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
|
|
||||||
/* write data for each writer */
|
/* write data for each writer */
|
||||||
for (i = 0; i < target->nwriters; ++i) {
|
for (i = 0; i < target->nwriters; ++i) {
|
||||||
@ -955,13 +1162,9 @@ void *write_function(void *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
/* Transplant checksum buffer from Ecma119Image to IsoImage */
|
/* Transplant checksum buffer from Ecma119Image to IsoImage */
|
||||||
transplant_checksum_buffer(target, 0);
|
transplant_checksum_buffer(target, 0);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
iso_ring_buffer_writer_close(target->buffer, 0);
|
iso_ring_buffer_writer_close(target->buffer, 0);
|
||||||
|
|
||||||
#ifdef Libisofs_with_pthread_exiT
|
#ifdef Libisofs_with_pthread_exiT
|
||||||
@ -971,6 +1174,7 @@ void *write_function(void *arg)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
write_error: ;
|
write_error: ;
|
||||||
|
target->eff_partition_offset = 0;
|
||||||
if (res == ISO_CANCELED) {
|
if (res == ISO_CANCELED) {
|
||||||
/* canceled */
|
/* canceled */
|
||||||
iso_msg_submit(target->image->id, ISO_IMAGE_WRITE_CANCELED, 0, NULL);
|
iso_msg_submit(target->image->id, ISO_IMAGE_WRITE_CANCELED, 0, NULL);
|
||||||
@ -981,15 +1185,11 @@ void *write_function(void *arg)
|
|||||||
}
|
}
|
||||||
iso_ring_buffer_writer_close(target->buffer, 1);
|
iso_ring_buffer_writer_close(target->buffer, 1);
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
/* Transplant checksum buffer away from Ecma119Image */
|
/* Transplant checksum buffer away from Ecma119Image */
|
||||||
transplant_checksum_buffer(target, 0);
|
transplant_checksum_buffer(target, 0);
|
||||||
/* Invalidate the transplanted checksum buffer in IsoImage */
|
/* Invalidate the transplanted checksum buffer in IsoImage */
|
||||||
iso_image_free_checksums(target->image, 0);
|
iso_image_free_checksums(target->image, 0);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef Libisofs_with_pthread_exiT
|
#ifdef Libisofs_with_pthread_exiT
|
||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
#else
|
#else
|
||||||
@ -999,9 +1199,6 @@ void *write_function(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
int checksum_prepare_image(IsoImage *src, int flag)
|
int checksum_prepare_image(IsoImage *src, int flag)
|
||||||
{
|
{
|
||||||
@ -1096,17 +1293,16 @@ int checksum_prepare_nodes(Ecma119Image *target, IsoNode *node, int flag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
||||||
{
|
{
|
||||||
int ret, i, voldesc_size, nwriters, image_checksums_mad = 0, tag_pos;
|
int ret, i, voldesc_size, nwriters, image_checksums_mad = 0, tag_pos;
|
||||||
Ecma119Image *target;
|
Ecma119Image *target;
|
||||||
|
IsoImageWriter *writer;
|
||||||
int el_torito_writer_index = -1, file_src_writer_index = -1;
|
int el_torito_writer_index = -1, file_src_writer_index = -1;
|
||||||
int system_area_options = 0;
|
int system_area_options = 0;
|
||||||
char *system_area = NULL;
|
char *system_area = NULL;
|
||||||
|
int write_count = 0, write_count_mem;
|
||||||
|
|
||||||
/* 1. Allocate target and copy opts there */
|
/* 1. Allocate target and copy opts there */
|
||||||
target = calloc(1, sizeof(Ecma119Image));
|
target = calloc(1, sizeof(Ecma119Image));
|
||||||
@ -1206,6 +1402,17 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
target->vol_effective_time = opts->vol_effective_time;
|
target->vol_effective_time = opts->vol_effective_time;
|
||||||
strcpy(target->vol_uuid, opts->vol_uuid);
|
strcpy(target->vol_uuid, opts->vol_uuid);
|
||||||
|
|
||||||
|
target->partition_offset = opts->partition_offset;
|
||||||
|
target->partition_secs_per_head = opts->partition_secs_per_head;
|
||||||
|
target->partition_heads_per_cyl = opts->partition_heads_per_cyl;
|
||||||
|
target->eff_partition_offset = 0;
|
||||||
|
target->partition_root = NULL;
|
||||||
|
target->partition_l_table_pos = 0;
|
||||||
|
target->partition_m_table_pos = 0;
|
||||||
|
target->j_part_root = NULL;
|
||||||
|
target->j_part_l_path_table_pos = 0;
|
||||||
|
target->j_part_m_path_table_pos = 0;
|
||||||
|
|
||||||
target->input_charset = strdup(iso_get_local_charset(0));
|
target->input_charset = strdup(iso_get_local_charset(0));
|
||||||
if (target->input_charset == NULL) {
|
if (target->input_charset == NULL) {
|
||||||
ret = ISO_OUT_OF_MEM;
|
ret = ISO_OUT_OF_MEM;
|
||||||
@ -1222,8 +1429,6 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
goto target_cleanup;
|
goto target_cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
target->md5_file_checksums = opts->md5_file_checksums;
|
target->md5_file_checksums = opts->md5_file_checksums;
|
||||||
target->md5_session_checksum = opts->md5_session_checksum;
|
target->md5_session_checksum = opts->md5_session_checksum;
|
||||||
strcpy(target->scdbackup_tag_parm, opts->scdbackup_tag_parm);
|
strcpy(target->scdbackup_tag_parm, opts->scdbackup_tag_parm);
|
||||||
@ -1239,9 +1444,7 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
target->checksum_array_pos = 0;
|
target->checksum_array_pos = 0;
|
||||||
target->checksum_range_start = 0;
|
target->checksum_range_start = 0;
|
||||||
target->checksum_range_size = 0;
|
target->checksum_range_size = 0;
|
||||||
target->opts_overwrite = 0;
|
target->opts_overwrite = NULL;
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 2. Based on those options, create needed writers: iso, joliet...
|
* 2. Based on those options, create needed writers: iso, joliet...
|
||||||
@ -1253,6 +1456,13 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
*/
|
*/
|
||||||
target->curblock = target->ms_block + 16;
|
target->curblock = target->ms_block + 16;
|
||||||
|
|
||||||
|
if (opts->overwrite != NULL && target->ms_block != 0 &&
|
||||||
|
target->ms_block < target->partition_offset + 32) {
|
||||||
|
/* Not enough room for superblock relocation */
|
||||||
|
ret = ISO_OVWRT_MS_TOO_SMALL;
|
||||||
|
goto target_cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
/* the number of writers is dependent of the extensions */
|
/* the number of writers is dependent of the extensions */
|
||||||
nwriters = 1 + 1 + 1; /* ECMA-119 + padding + files */
|
nwriters = 1 + 1 + 1; /* ECMA-119 + padding + files */
|
||||||
|
|
||||||
@ -1266,9 +1476,6 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
nwriters++;
|
nwriters++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
if ((target->md5_file_checksums & 1) || target->md5_session_checksum) {
|
if ((target->md5_file_checksums & 1) || target->md5_session_checksum) {
|
||||||
nwriters++;
|
nwriters++;
|
||||||
image_checksums_mad = 1; /* from here on the loaded checksums are
|
image_checksums_mad = 1; /* from here on the loaded checksums are
|
||||||
@ -1285,9 +1492,6 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
target->checksum_idx_counter = 0;
|
target->checksum_idx_counter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
|
|
||||||
target->writers = malloc(nwriters * sizeof(void*));
|
target->writers = malloc(nwriters * sizeof(void*));
|
||||||
if (target->writers == NULL) {
|
if (target->writers == NULL) {
|
||||||
ret = ISO_OUT_OF_MEM;
|
ret = ISO_OUT_OF_MEM;
|
||||||
@ -1345,17 +1549,43 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
goto target_cleanup;
|
goto target_cleanup;
|
||||||
}
|
}
|
||||||
file_src_writer_index = target->nwriters - 1;
|
file_src_writer_index = target->nwriters - 1;
|
||||||
|
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
if ((target->md5_file_checksums & 1) || target->md5_session_checksum) {
|
if ((target->md5_file_checksums & 1) || target->md5_session_checksum) {
|
||||||
ret = checksum_writer_create(target);
|
ret = checksum_writer_create(target);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto target_cleanup;
|
goto target_cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
if (target->partition_offset > 0) {
|
||||||
|
/* After volume descriptors and superblock tag are accounted for:
|
||||||
|
account for second volset
|
||||||
|
*/
|
||||||
|
if (target->ms_block + target->partition_offset + 16
|
||||||
|
< target->curblock) {
|
||||||
|
/* Overflow of partition system area */
|
||||||
|
ret = ISO_PART_OFFST_TOO_SMALL;
|
||||||
|
goto target_cleanup;
|
||||||
|
}
|
||||||
|
target->curblock = target->ms_block + target->partition_offset + 16;
|
||||||
|
|
||||||
|
/* Account for partition tree volume descriptors */
|
||||||
|
for (i = 0; i < target->nwriters; ++i) {
|
||||||
|
/* Not all writers have an entry in the partition
|
||||||
|
volume descriptor set.
|
||||||
|
*/
|
||||||
|
writer = target->writers[i];
|
||||||
|
|
||||||
|
/* >>> TWINTREE: Enhance ISO1999 writer and add it here */
|
||||||
|
|
||||||
|
if(writer->write_vol_desc != ecma119_writer_write_vol_desc &&
|
||||||
|
writer->write_vol_desc != joliet_writer_write_vol_desc)
|
||||||
|
continue;
|
||||||
|
target->curblock++;
|
||||||
|
}
|
||||||
|
target->curblock++; /* + Terminator */
|
||||||
|
|
||||||
|
/* >>> TWINTREE: eventually later : second superblock checksum tag */;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1396,21 +1626,24 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
#endif /* Libisofs_patch_ticket_145 */
|
#endif /* Libisofs_patch_ticket_145 */
|
||||||
|
|
||||||
/* create the ring buffer */
|
/* create the ring buffer */
|
||||||
|
if (opts->overwrite != NULL &&
|
||||||
|
opts->fifo_size / 2048 < 32 + target->partition_offset) {
|
||||||
|
/* The ring buffer must be large enough to take opts->overwrite
|
||||||
|
*/
|
||||||
|
ret = ISO_OVWRT_FIFO_TOO_SMALL;
|
||||||
|
}
|
||||||
ret = iso_ring_buffer_new(opts->fifo_size, &target->buffer);
|
ret = iso_ring_buffer_new(opts->fifo_size, &target->buffer);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
goto target_cleanup;
|
goto target_cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check if we need to provide a copy of volume descriptors */
|
/* check if we need to provide a copy of volume descriptors */
|
||||||
if (opts->overwrite) {
|
if (opts->overwrite != NULL) {
|
||||||
/*
|
|
||||||
* Get a copy of the volume descriptors to be written in a DVD+RW
|
/* opts->overwrite must be larger by partion_offset
|
||||||
* disc
|
This storage is provided by the application.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
uint8_t *buf;
|
|
||||||
struct ecma119_vol_desc_terminator *vol;
|
|
||||||
IsoImageWriter *writer;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* In the PVM to be written in the 16th sector of the disc, we
|
* In the PVM to be written in the 16th sector of the disc, we
|
||||||
@ -1418,46 +1651,23 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
*/
|
*/
|
||||||
target->vol_space_size = target->curblock;
|
target->vol_space_size = target->curblock;
|
||||||
|
|
||||||
/* write volume descriptor */
|
/* System area and volume descriptors */
|
||||||
for (i = 0; i < target->nwriters; ++i) {
|
target->opts_overwrite = (char *) opts->overwrite;
|
||||||
writer = target->writers[i];
|
ret = write_head_part1(target, &write_count, 1 | 2);
|
||||||
ret = writer->write_vol_desc(writer);
|
target->opts_overwrite = NULL;
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
iso_msg_debug(target->image->id,
|
|
||||||
"Error writing overwrite volume descriptors");
|
|
||||||
goto target_cleanup;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* write the system area */
|
|
||||||
ret = iso_write_system_area(target, opts->overwrite);
|
|
||||||
if (ret < 0) {
|
|
||||||
iso_msg_debug(target->image->id,
|
|
||||||
"Error writing system area to overwrite buffer");
|
|
||||||
goto target_cleanup;
|
goto target_cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
/* skip the first 16 blocks (system area) */
|
|
||||||
buf = opts->overwrite + 16 * BLOCK_SIZE;
|
|
||||||
voldesc_size *= BLOCK_SIZE;
|
|
||||||
|
|
||||||
/* copy the volume descriptors to the overwrite buffer... */
|
/* copy the volume descriptors to the overwrite buffer... */
|
||||||
ret = iso_ring_buffer_read(target->buffer, buf, voldesc_size);
|
voldesc_size *= BLOCK_SIZE;
|
||||||
|
ret = iso_ring_buffer_read(target->buffer, opts->overwrite,
|
||||||
|
write_count * BLOCK_SIZE);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
iso_msg_debug(target->image->id,
|
iso_msg_debug(target->image->id,
|
||||||
"Error reading overwrite volume descriptors");
|
"Error reading overwrite volume descriptors");
|
||||||
goto target_cleanup;
|
goto target_cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ...including the vol desc terminator */
|
|
||||||
memset(buf + voldesc_size, 0, BLOCK_SIZE);
|
|
||||||
vol = (struct ecma119_vol_desc_terminator*) (buf + voldesc_size);
|
|
||||||
vol->vol_desc_type[0] = 255;
|
|
||||||
memcpy(vol->std_identifier, "CD001", 5);
|
|
||||||
vol->vol_desc_version[0] = 1;
|
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
/* Write relocated superblock checksum tag */
|
/* Write relocated superblock checksum tag */
|
||||||
tag_pos = voldesc_size / BLOCK_SIZE + 16 + 1;
|
tag_pos = voldesc_size / BLOCK_SIZE + 16 + 1;
|
||||||
if (target->md5_session_checksum) {
|
if (target->md5_session_checksum) {
|
||||||
@ -1475,9 +1685,10 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
goto target_cleanup;
|
goto target_cleanup;
|
||||||
}
|
}
|
||||||
tag_pos++;
|
tag_pos++;
|
||||||
|
write_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clean out eventual checksum tags */
|
/* Clean out eventual obsolete checksum tags */
|
||||||
for (i = tag_pos; i < 32; i++) {
|
for (i = tag_pos; i < 32; i++) {
|
||||||
int tag_type;
|
int tag_type;
|
||||||
uint32_t pos, range_start, range_size, next_tag;
|
uint32_t pos, range_start, range_size, next_tag;
|
||||||
@ -1490,8 +1701,21 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
opts->overwrite[i * 2048] = 0;
|
opts->overwrite[i * 2048] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
/* Write second set of volume descriptors */
|
||||||
|
write_count_mem= write_count;
|
||||||
|
ret = write_head_part2(target, &write_count, 0);
|
||||||
|
if (ret < 0)
|
||||||
|
goto target_cleanup;
|
||||||
|
|
||||||
|
/* Read written data into opts->overwrite */
|
||||||
|
ret = iso_ring_buffer_read(target->buffer,
|
||||||
|
opts->overwrite + write_count_mem * BLOCK_SIZE,
|
||||||
|
(write_count - write_count_mem) * BLOCK_SIZE);
|
||||||
|
if (ret < 0) {
|
||||||
|
iso_msg_debug(target->image->id,
|
||||||
|
"Error reading overwrite volume descriptors");
|
||||||
|
goto target_cleanup;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1503,8 +1727,6 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
|
|
||||||
|
|
||||||
/* 4. Create and start writing thread */
|
/* 4. Create and start writing thread */
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
if (target->md5_session_checksum) {
|
if (target->md5_session_checksum) {
|
||||||
/* After any fake writes are done: Initialize image checksum context */
|
/* After any fake writes are done: Initialize image checksum context */
|
||||||
if (target->checksum_ctx != NULL)
|
if (target->checksum_ctx != NULL)
|
||||||
@ -1518,8 +1740,6 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
iso_image_free_checksums(target->image, 0);
|
iso_image_free_checksums(target->image, 0);
|
||||||
image_checksums_mad = 0;
|
image_checksums_mad = 0;
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
/* ensure the thread is created joinable */
|
/* ensure the thread is created joinable */
|
||||||
pthread_attr_init(&(target->th_attr));
|
pthread_attr_init(&(target->th_attr));
|
||||||
pthread_attr_setdetachstate(&(target->th_attr), PTHREAD_CREATE_JOINABLE);
|
pthread_attr_setdetachstate(&(target->th_attr), PTHREAD_CREATE_JOINABLE);
|
||||||
@ -1544,14 +1764,8 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
|
|||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
|
|
||||||
target_cleanup: ;
|
target_cleanup: ;
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
if(image_checksums_mad) /* No checksums is better than mad checksums */
|
if(image_checksums_mad) /* No checksums is better than mad checksums */
|
||||||
iso_image_free_checksums(target->image, 0);
|
iso_image_free_checksums(target->image, 0);
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
ecma119_image_free(target);
|
ecma119_image_free(target);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -1691,17 +1905,11 @@ int iso_write(Ecma119Image *target, void *buf, size_t count)
|
|||||||
/* reader cancelled */
|
/* reader cancelled */
|
||||||
return ISO_CANCELED;
|
return ISO_CANCELED;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
if (target->checksum_ctx != NULL) {
|
if (target->checksum_ctx != NULL) {
|
||||||
/* Add to image checksum */
|
/* Add to image checksum */
|
||||||
target->checksum_counter += count;
|
target->checksum_counter += count;
|
||||||
iso_md5_compute(target->checksum_ctx, (char *) buf, (int) count);
|
iso_md5_compute(target->checksum_ctx, (char *) buf, (int) count);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
/* total size is 0 when writing the overwrite buffer */
|
/* total size is 0 when writing the overwrite buffer */
|
||||||
if (ret > 0 && (target->total_size != (off_t) 0)){
|
if (ret > 0 && (target->total_size != (off_t) 0)){
|
||||||
unsigned int kbw, kbt;
|
unsigned int kbw, kbt;
|
||||||
@ -1774,7 +1982,10 @@ int iso_write_opts_new(IsoWriteOpts **opts, int profile)
|
|||||||
wopts->vol_modification_time = 0;
|
wopts->vol_modification_time = 0;
|
||||||
wopts->vol_expiration_time = 0;
|
wopts->vol_expiration_time = 0;
|
||||||
wopts->vol_effective_time = 0;
|
wopts->vol_effective_time = 0;
|
||||||
wopts->vol_uuid[0]= 0;
|
wopts->vol_uuid[0] = 0;
|
||||||
|
wopts->partition_offset = 0;
|
||||||
|
wopts->partition_secs_per_head = 0;
|
||||||
|
wopts->partition_heads_per_cyl = 0;
|
||||||
|
|
||||||
*opts = wopts;
|
*opts = wopts;
|
||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
@ -1977,14 +2188,8 @@ int iso_write_opts_set_sort_files(IsoWriteOpts *opts, int sort)
|
|||||||
|
|
||||||
int iso_write_opts_set_record_md5(IsoWriteOpts *opts, int session, int files)
|
int iso_write_opts_set_record_md5(IsoWriteOpts *opts, int session, int files)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
opts->md5_session_checksum = session & 1;
|
opts->md5_session_checksum = session & 1;
|
||||||
opts->md5_file_checksums = files & 3;
|
opts->md5_file_checksums = files & 3;
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1992,9 +2197,6 @@ int iso_write_opts_set_scdbackup_tag(IsoWriteOpts *opts,
|
|||||||
char *name, char *timestamp,
|
char *name, char *timestamp,
|
||||||
char *tag_written)
|
char *tag_written)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
char eff_name[81], eff_time[19];
|
char eff_name[81], eff_time[19];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -2020,9 +2222,6 @@ int iso_write_opts_set_scdbackup_tag(IsoWriteOpts *opts,
|
|||||||
opts->scdbackup_tag_written = tag_written;
|
opts->scdbackup_tag_written = tag_written;
|
||||||
if (tag_written != NULL)
|
if (tag_written != NULL)
|
||||||
tag_written[0] = 0;
|
tag_written[0] = 0;
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2214,3 +2413,15 @@ int iso_write_opts_set_pvd_times(IsoWriteOpts *opts,
|
|||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int iso_write_opts_set_part_offset(IsoWriteOpts *opts,
|
||||||
|
uint32_t block_offset_2k,
|
||||||
|
int secs_512_per_head, int heads_per_cyl)
|
||||||
|
{
|
||||||
|
if (block_offset_2k > 0 && block_offset_2k < 16)
|
||||||
|
return ISO_PART_OFFST_TOO_SMALL;
|
||||||
|
opts->partition_offset = block_offset_2k;
|
||||||
|
opts->partition_secs_per_head = secs_512_per_head;
|
||||||
|
opts->partition_heads_per_cyl = heads_per_cyl;
|
||||||
|
return ISO_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -152,8 +152,6 @@ struct iso_write_opts {
|
|||||||
*/
|
*/
|
||||||
unsigned int dir_rec_mtime :1;
|
unsigned int dir_rec_mtime :1;
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute MD5 checksum for the whole session and record it as index 0 of
|
* Compute MD5 checksum for the whole session and record it as index 0 of
|
||||||
* the checksum blocks after the data area of the session. The layout and
|
* the checksum blocks after the data area of the session. The layout and
|
||||||
@ -174,8 +172,6 @@ struct iso_write_opts {
|
|||||||
*/
|
*/
|
||||||
unsigned int md5_file_checksums :2;
|
unsigned int md5_file_checksums :2;
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
/** If files should be sorted based on their weight. */
|
/** If files should be sorted based on their weight. */
|
||||||
unsigned int sort_files :1;
|
unsigned int sort_files :1;
|
||||||
|
|
||||||
@ -318,6 +314,16 @@ struct iso_write_opts {
|
|||||||
*/
|
*/
|
||||||
char vol_uuid[17];
|
char vol_uuid[17];
|
||||||
|
|
||||||
|
/* The number of unclaimed 2K blocks before start of partition 1 as of
|
||||||
|
the MBR in system area.
|
||||||
|
Must be 0 or >= 16. (Actually >= number of voldescr + checksum tag)
|
||||||
|
*/
|
||||||
|
uint32_t partition_offset;
|
||||||
|
/* Partition table parameter: 1 to 63, 0= disabled/default */
|
||||||
|
int partition_secs_per_head;
|
||||||
|
/* 1 to 255, 0= disabled/default */
|
||||||
|
int partition_heads_per_cyl;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct ecma119_image Ecma119Image;
|
typedef struct ecma119_image Ecma119Image;
|
||||||
@ -373,13 +379,9 @@ struct ecma119_image
|
|||||||
/* Store in ECMA-119 timestamp mtime of source */
|
/* Store in ECMA-119 timestamp mtime of source */
|
||||||
unsigned int dir_rec_mtime :1;
|
unsigned int dir_rec_mtime :1;
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
unsigned int md5_session_checksum :1;
|
unsigned int md5_session_checksum :1;
|
||||||
unsigned int md5_file_checksums :2;
|
unsigned int md5_file_checksums :2;
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mode replace. If one of these flags is set, the correspodent values are
|
* Mode replace. If one of these flags is set, the correspodent values are
|
||||||
* replaced with values below.
|
* replaced with values below.
|
||||||
@ -412,8 +414,9 @@ struct ecma119_image
|
|||||||
off_t total_size;
|
off_t total_size;
|
||||||
uint32_t vol_space_size;
|
uint32_t vol_space_size;
|
||||||
|
|
||||||
/* Bytes already written, just for progress notification */
|
/* Bytes already written to image output */
|
||||||
off_t bytes_written;
|
off_t bytes_written;
|
||||||
|
/* just for progress notification */
|
||||||
int percent_written;
|
int percent_written;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -498,8 +501,6 @@ struct ecma119_image
|
|||||||
/* tree of files sources */
|
/* tree of files sources */
|
||||||
IsoRBTree *files;
|
IsoRBTree *files;
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
unsigned int checksum_idx_counter;
|
unsigned int checksum_idx_counter;
|
||||||
void *checksum_ctx;
|
void *checksum_ctx;
|
||||||
off_t checksum_counter;
|
off_t checksum_counter;
|
||||||
@ -525,8 +526,6 @@ struct ecma119_image
|
|||||||
char scdbackup_tag_parm[100];
|
char scdbackup_tag_parm[100];
|
||||||
char *scdbackup_tag_written;
|
char *scdbackup_tag_written;
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
/* Buffer for communication between burn_source and writer thread */
|
/* Buffer for communication between burn_source and writer thread */
|
||||||
IsoRingBuffer *buffer;
|
IsoRingBuffer *buffer;
|
||||||
|
|
||||||
@ -543,6 +542,31 @@ struct ecma119_image
|
|||||||
* by unconverted string with timezone 0
|
* by unconverted string with timezone 0
|
||||||
*/
|
*/
|
||||||
char vol_uuid[17];
|
char vol_uuid[17];
|
||||||
|
|
||||||
|
/* The number of unclaimed 2K blocks before
|
||||||
|
start of partition 1 as of the MBR in system area. */
|
||||||
|
uint32_t partition_offset;
|
||||||
|
/* Partition table parameter: 1 to 63, 0= disabled/default */
|
||||||
|
int partition_secs_per_head;
|
||||||
|
/* 1 to 255, 0= disabled/default */
|
||||||
|
int partition_heads_per_cyl;
|
||||||
|
|
||||||
|
/* The currently applicable LBA offset. To be subtracted from any LBA
|
||||||
|
* that is mentioned in volume descriptors, trees, path tables,
|
||||||
|
* Either 0 or .partition_offset
|
||||||
|
*/
|
||||||
|
uint32_t eff_partition_offset;
|
||||||
|
|
||||||
|
/* The second ECMA-119 directory tree and path tables */
|
||||||
|
Ecma119Node *partition_root;
|
||||||
|
uint32_t partition_l_table_pos;
|
||||||
|
uint32_t partition_m_table_pos;
|
||||||
|
|
||||||
|
/* The second Joliet directory tree and path tables */
|
||||||
|
JolietNode *j_part_root;
|
||||||
|
uint32_t j_part_l_path_table_pos;
|
||||||
|
uint32_t j_part_m_path_table_pos;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define BP(a,b) [(b) - (a) + 1]
|
#define BP(a,b) [(b) - (a) + 1]
|
||||||
|
@ -8,6 +8,10 @@
|
|||||||
* See COPYING file for details.
|
* See COPYING file for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "ecma119_tree.h"
|
#include "ecma119_tree.h"
|
||||||
#include "ecma119.h"
|
#include "ecma119.h"
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
@ -146,15 +150,11 @@ int create_dir(Ecma119Image *img, IsoDir *iso, Ecma119Node **node)
|
|||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new ECMA-119 node representing a regular file from a iso file
|
|
||||||
* node.
|
|
||||||
*/
|
|
||||||
static
|
static
|
||||||
int create_file(Ecma119Image *img, IsoFile *iso, Ecma119Node **node)
|
int create_file_src(Ecma119Image *img, IsoFile *iso, IsoFileSrc **src)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
IsoFileSrc *src;
|
|
||||||
off_t size;
|
off_t size;
|
||||||
|
|
||||||
size = iso_stream_get_size(iso->stream);
|
size = iso_stream_get_size(iso->stream);
|
||||||
@ -166,8 +166,25 @@ int create_file(Ecma119Image *img, IsoFile *iso, Ecma119Node **node)
|
|||||||
free(ipath);
|
free(ipath);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
ret = iso_file_src_create(img, iso, src);
|
||||||
|
if (ret < 0) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
ret = iso_file_src_create(img, iso, &src);
|
|
||||||
|
/**
|
||||||
|
* Create a new ECMA-119 node representing a regular file from a iso file
|
||||||
|
* node.
|
||||||
|
*/
|
||||||
|
static
|
||||||
|
int create_file(Ecma119Image *img, IsoFile *iso, Ecma119Node **node)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
IsoFileSrc *src;
|
||||||
|
|
||||||
|
ret = create_file_src(img, iso, &src);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -267,58 +284,78 @@ void ecma119_node_free(Ecma119Node *node)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @param flag
|
||||||
|
* bit0= iso is in a hidden directory. Thus hide it.
|
||||||
* @return
|
* @return
|
||||||
* 1 success, 0 node ignored, < 0 error
|
* 1 success, 0 node ignored, < 0 error
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static
|
static
|
||||||
int create_tree(Ecma119Image *image, IsoNode *iso, Ecma119Node **tree,
|
int create_tree(Ecma119Image *image, IsoNode *iso, Ecma119Node **tree,
|
||||||
int depth, int pathlen)
|
int depth, int pathlen, int flag)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret, hidden;
|
||||||
Ecma119Node *node;
|
Ecma119Node *node = NULL;
|
||||||
int max_path;
|
int max_path;
|
||||||
char *iso_name= NULL;
|
char *iso_name= NULL, *ipath = NULL;
|
||||||
|
IsoFileSrc *src = NULL;
|
||||||
|
|
||||||
if (image == NULL || iso == NULL || tree == NULL) {
|
if (image == NULL || iso == NULL || tree == NULL) {
|
||||||
return ISO_NULL_POINTER;
|
return ISO_NULL_POINTER;
|
||||||
}
|
}
|
||||||
|
*tree = NULL;
|
||||||
|
|
||||||
|
hidden = flag & 1;
|
||||||
if (iso->hidden & LIBISO_HIDE_ON_RR) {
|
if (iso->hidden & LIBISO_HIDE_ON_RR) {
|
||||||
/* file will be ignored */
|
hidden = 1;
|
||||||
return 0;
|
if (!((iso->hidden & LIBISO_HIDE_BUT_WRITE) ||
|
||||||
|
iso->type == LIBISO_BOOT)) {
|
||||||
|
return 0; /* file will be ignored */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ret = get_iso_name(image, iso, &iso_name);
|
|
||||||
if (ret < 0) {
|
if (hidden) {
|
||||||
return ret;
|
max_path= pathlen;
|
||||||
}
|
} else {
|
||||||
max_path = pathlen + 1 + (iso_name ? strlen(iso_name) : 0);
|
ret = get_iso_name(image, iso, &iso_name);
|
||||||
if (!image->rockridge) {
|
if (ret < 0) {
|
||||||
if ((iso->type == LIBISO_DIR && depth > 8) && !image->allow_deep_paths) {
|
iso_name = NULL; /* invalid, do not free */
|
||||||
char *ipath = iso_tree_get_node_path(iso);
|
goto ex;
|
||||||
return iso_msg_submit(image->image->id, ISO_FILE_IMGPATH_WRONG, 0,
|
}
|
||||||
"File \"%s\" can't be added, because directory depth "
|
max_path = pathlen + 1 + (iso_name ? strlen(iso_name) : 0);
|
||||||
"is greater than 8.", ipath);
|
if (!image->rockridge) {
|
||||||
free(iso_name);
|
if ((iso->type == LIBISO_DIR && depth > 8) &&
|
||||||
free(ipath);
|
!image->allow_deep_paths) {
|
||||||
return ret;
|
ipath = iso_tree_get_node_path(iso);
|
||||||
} else if (max_path > 255 && !image->allow_longer_paths) {
|
ret = iso_msg_submit(image->image->id, ISO_FILE_IMGPATH_WRONG,
|
||||||
char *ipath = iso_tree_get_node_path(iso);
|
0, "File \"%s\" can't be added, "
|
||||||
ret = iso_msg_submit(image->image->id, ISO_FILE_IMGPATH_WRONG, 0,
|
"because directory depth "
|
||||||
"File \"%s\" can't be added, because path length "
|
"is greater than 8.", ipath);
|
||||||
"is greater than 255 characters", ipath);
|
goto ex;
|
||||||
free(iso_name);
|
} else if (max_path > 255 && !image->allow_longer_paths) {
|
||||||
free(ipath);
|
ipath = iso_tree_get_node_path(iso);
|
||||||
return ret;
|
ret = iso_msg_submit(image->image->id, ISO_FILE_IMGPATH_WRONG,
|
||||||
|
0, "File \"%s\" can't be added, "
|
||||||
|
"because path length "
|
||||||
|
"is greater than 255 characters", ipath);
|
||||||
|
goto ex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (iso->type) {
|
switch (iso->type) {
|
||||||
case LIBISO_FILE:
|
case LIBISO_FILE:
|
||||||
ret = create_file(image, (IsoFile*)iso, &node);
|
if (hidden) {
|
||||||
|
ret = create_file_src(image, (IsoFile *) iso, &src);
|
||||||
|
} else {
|
||||||
|
ret = create_file(image, (IsoFile*)iso, &node);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case LIBISO_SYMLINK:
|
case LIBISO_SYMLINK:
|
||||||
|
if (hidden) {
|
||||||
|
ret = 0; /* Hidden means non-existing */
|
||||||
|
goto ex;
|
||||||
|
}
|
||||||
if (image->rockridge) {
|
if (image->rockridge) {
|
||||||
ret = create_symlink(image, (IsoSymlink*)iso, &node);
|
ret = create_symlink(image, (IsoSymlink*)iso, &node);
|
||||||
} else {
|
} else {
|
||||||
@ -331,6 +368,10 @@ int create_tree(Ecma119Image *image, IsoNode *iso, Ecma119Node **tree,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LIBISO_SPECIAL:
|
case LIBISO_SPECIAL:
|
||||||
|
if (hidden) {
|
||||||
|
ret = 0; /* Hidden means non-existing */
|
||||||
|
goto ex;
|
||||||
|
}
|
||||||
if (image->rockridge) {
|
if (image->rockridge) {
|
||||||
ret = create_special(image, (IsoSpecial*)iso, &node);
|
ret = create_special(image, (IsoSpecial*)iso, &node);
|
||||||
} else {
|
} else {
|
||||||
@ -344,7 +385,11 @@ int create_tree(Ecma119Image *image, IsoNode *iso, Ecma119Node **tree,
|
|||||||
break;
|
break;
|
||||||
case LIBISO_BOOT:
|
case LIBISO_BOOT:
|
||||||
if (image->eltorito) {
|
if (image->eltorito) {
|
||||||
ret = create_boot_cat(image, (IsoBoot*)iso, &node);
|
if (hidden) {
|
||||||
|
ret = el_torito_catalog_file_src_create(image, &src);
|
||||||
|
} else {
|
||||||
|
ret = create_boot_cat(image, (IsoBoot*)iso, &node);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* log and ignore */
|
/* log and ignore */
|
||||||
ret = iso_msg_submit(image->image->id, ISO_FILE_IGNORED, 0,
|
ret = iso_msg_submit(image->image->id, ISO_FILE_IGNORED, 0,
|
||||||
@ -355,21 +400,27 @@ int create_tree(Ecma119Image *image, IsoNode *iso, Ecma119Node **tree,
|
|||||||
{
|
{
|
||||||
IsoNode *pos;
|
IsoNode *pos;
|
||||||
IsoDir *dir = (IsoDir*)iso;
|
IsoDir *dir = (IsoDir*)iso;
|
||||||
ret = create_dir(image, dir, &node);
|
|
||||||
if (ret < 0) {
|
if (!hidden) {
|
||||||
return ret;
|
ret = create_dir(image, dir, &node);
|
||||||
|
if (ret < 0) {
|
||||||
|
goto ex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
ret = ISO_SUCCESS;
|
||||||
pos = dir->children;
|
pos = dir->children;
|
||||||
while (pos) {
|
while (pos) {
|
||||||
int cret;
|
int cret;
|
||||||
Ecma119Node *child;
|
Ecma119Node *child;
|
||||||
cret = create_tree(image, pos, &child, depth + 1, max_path);
|
cret = create_tree(image, pos, &child, depth + 1, max_path,
|
||||||
|
!!hidden);
|
||||||
if (cret < 0) {
|
if (cret < 0) {
|
||||||
/* error */
|
/* error */
|
||||||
ecma119_node_free(node);
|
if (!hidden)
|
||||||
|
ecma119_node_free(node);
|
||||||
ret = cret;
|
ret = cret;
|
||||||
break;
|
break;
|
||||||
} else if (cret == ISO_SUCCESS) {
|
} else if (cret == ISO_SUCCESS && !hidden) {
|
||||||
/* add child to this node */
|
/* add child to this node */
|
||||||
int nchildren = node->info.dir->nchildren++;
|
int nchildren = node->info.dir->nchildren++;
|
||||||
node->info.dir->children[nchildren] = child;
|
node->info.dir->children[nchildren] = child;
|
||||||
@ -381,15 +432,30 @@ int create_tree(Ecma119Image *image, IsoNode *iso, Ecma119Node **tree,
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* should never happen */
|
/* should never happen */
|
||||||
return ISO_ASSERT_FAILURE;
|
ret = ISO_ASSERT_FAILURE;
|
||||||
|
goto ex;
|
||||||
}
|
}
|
||||||
if (ret <= 0) {
|
if (ret <= 0) {
|
||||||
free(iso_name);
|
goto ex;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
node->iso_name = iso_name;
|
if (!hidden) {
|
||||||
*tree = node;
|
node->iso_name = iso_name;
|
||||||
return ISO_SUCCESS;
|
iso_name = NULL; /* now owned by node, do not free */
|
||||||
|
*tree = node;
|
||||||
|
node = NULL; /* now owned by caller, do not free */
|
||||||
|
}
|
||||||
|
ret = ISO_SUCCESS;
|
||||||
|
ex:
|
||||||
|
if (iso_name != NULL)
|
||||||
|
free(iso_name);
|
||||||
|
if (ipath != NULL)
|
||||||
|
free(ipath);
|
||||||
|
if (node != NULL)
|
||||||
|
ecma119_node_free(node);
|
||||||
|
if (hidden && ret == ISO_SUCCESS)
|
||||||
|
ret = 0;
|
||||||
|
/* The sources of hidden files are now owned by the rb-tree */
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -648,6 +714,7 @@ static
|
|||||||
int mangle_tree(Ecma119Image *img, int recurse)
|
int mangle_tree(Ecma119Image *img, int recurse)
|
||||||
{
|
{
|
||||||
int max_file, max_dir;
|
int max_file, max_dir;
|
||||||
|
Ecma119Node *root;
|
||||||
|
|
||||||
if (img->max_37_char_filenames) {
|
if (img->max_37_char_filenames) {
|
||||||
max_file = max_dir = 37;
|
max_file = max_dir = 37;
|
||||||
@ -657,10 +724,15 @@ int mangle_tree(Ecma119Image *img, int recurse)
|
|||||||
} else {
|
} else {
|
||||||
max_file = max_dir = 31;
|
max_file = max_dir = 31;
|
||||||
}
|
}
|
||||||
if (recurse) {
|
if (img->eff_partition_offset > 0) {
|
||||||
return mangle_dir(img, img->root, max_file, max_dir);
|
root = img->partition_root;
|
||||||
} else {
|
} else {
|
||||||
return mangle_single_dir(img, img->root, max_file, max_dir);
|
root = img->root;
|
||||||
|
}
|
||||||
|
if (recurse) {
|
||||||
|
return mangle_dir(img, root, max_file, max_dir);
|
||||||
|
} else {
|
||||||
|
return mangle_single_dir(img, root, max_file, max_dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -778,11 +850,17 @@ int reorder_tree(Ecma119Image *img, Ecma119Node *dir, int level, int pathlen)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
size_t max_path;
|
size_t max_path;
|
||||||
|
Ecma119Node *root;
|
||||||
|
|
||||||
max_path = pathlen + 1 + max_child_name_len(dir);
|
max_path = pathlen + 1 + max_child_name_len(dir);
|
||||||
|
|
||||||
if (level > 8 || max_path > 255) {
|
if (level > 8 || max_path > 255) {
|
||||||
ret = reparent(dir, img->root);
|
if (img->eff_partition_offset > 0) {
|
||||||
|
root = img->partition_root;
|
||||||
|
} else {
|
||||||
|
root = img->root;
|
||||||
|
}
|
||||||
|
ret = reparent(dir, root);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -981,7 +1059,7 @@ int ecma119_tree_create(Ecma119Image *img)
|
|||||||
int ret;
|
int ret;
|
||||||
Ecma119Node *root;
|
Ecma119Node *root;
|
||||||
|
|
||||||
ret = create_tree(img, (IsoNode*)img->image->root, &root, 1, 0);
|
ret = create_tree(img, (IsoNode*)img->image->root, &root, 1, 0, 0);
|
||||||
if (ret <= 0) {
|
if (ret <= 0) {
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
/* unexpected error, root ignored!! This can't happen */
|
/* unexpected error, root ignored!! This can't happen */
|
||||||
@ -989,10 +1067,14 @@ int ecma119_tree_create(Ecma119Image *img)
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
img->root = root;
|
if (img->eff_partition_offset > 0) {
|
||||||
|
img->partition_root = root;
|
||||||
|
} else {
|
||||||
|
img->root = root;
|
||||||
|
}
|
||||||
|
|
||||||
iso_msg_debug(img->image->id, "Matching hardlinks...");
|
iso_msg_debug(img->image->id, "Matching hardlinks...");
|
||||||
ret = match_hardlinks(img, img->root, 0);
|
ret = match_hardlinks(img, root, 0);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -1009,7 +1091,7 @@ int ecma119_tree_create(Ecma119Image *img)
|
|||||||
if (img->rockridge && !img->allow_deep_paths) {
|
if (img->rockridge && !img->allow_deep_paths) {
|
||||||
|
|
||||||
/* reorder the tree, acording to RRIP, 4.1.5 */
|
/* reorder the tree, acording to RRIP, 4.1.5 */
|
||||||
ret = reorder_tree(img, img->root, 1, 0);
|
ret = reorder_tree(img, root, 1, 0);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,10 @@
|
|||||||
* See COPYING file for details.
|
* See COPYING file for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "eltorito.h"
|
#include "eltorito.h"
|
||||||
#include "stream.h"
|
#include "stream.h"
|
||||||
#include "fsource.h"
|
#include "fsource.h"
|
||||||
@ -649,6 +653,8 @@ int iso_image_add_boot_image(IsoImage *image, const char *image_path,
|
|||||||
struct el_torito_boot_catalog *catalog = image->bootcat;
|
struct el_torito_boot_catalog *catalog = image->bootcat;
|
||||||
ElToritoBootImage *boot_img;
|
ElToritoBootImage *boot_img;
|
||||||
|
|
||||||
|
if(catalog == NULL)
|
||||||
|
return ISO_BOOT_NO_CATALOG;
|
||||||
if (catalog->num_bootimages >= Libisofs_max_boot_imageS)
|
if (catalog->num_bootimages >= Libisofs_max_boot_imageS)
|
||||||
return ISO_BOOT_IMAGE_OVERFLOW;
|
return ISO_BOOT_IMAGE_OVERFLOW;
|
||||||
ret = create_image(image, image_path, type, &boot_img);
|
ret = create_image(image, image_path, type, &boot_img);
|
||||||
@ -670,6 +676,18 @@ int iso_image_set_boot_catalog_weight(IsoImage *image, int sort_weight)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* API */
|
||||||
|
int iso_image_set_boot_catalog_hidden(IsoImage *image, int hide_attrs)
|
||||||
|
{
|
||||||
|
if (image->bootcat == NULL)
|
||||||
|
return 0;
|
||||||
|
if (image->bootcat->node == NULL)
|
||||||
|
return 0;
|
||||||
|
iso_node_set_hidden((IsoNode *) image->bootcat->node, hide_attrs);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void el_torito_boot_catalog_free(struct el_torito_boot_catalog *cat)
|
void el_torito_boot_catalog_free(struct el_torito_boot_catalog *cat)
|
||||||
{
|
{
|
||||||
struct el_torito_boot_image *image;
|
struct el_torito_boot_image *image;
|
||||||
@ -924,7 +942,7 @@ int catalog_stream_new(Ecma119Image *target, IsoStream **stream)
|
|||||||
return ISO_OUT_OF_MEM;
|
return ISO_OUT_OF_MEM;
|
||||||
}
|
}
|
||||||
data = calloc(1, sizeof(struct catalog_stream));
|
data = calloc(1, sizeof(struct catalog_stream));
|
||||||
if (str == NULL) {
|
if (data == NULL) {
|
||||||
free(str);
|
free(str);
|
||||||
return ISO_OUT_OF_MEM;
|
return ISO_OUT_OF_MEM;
|
||||||
}
|
}
|
||||||
@ -1089,6 +1107,7 @@ int eltorito_writer_compute_data_blocks(IsoImageWriter *writer)
|
|||||||
}
|
}
|
||||||
ret = iso_stream_open(original);
|
ret = iso_stream_open(original);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
free(buf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
ret = iso_stream_read(original, buf, size);
|
ret = iso_stream_read(original, buf, size);
|
||||||
@ -1139,8 +1158,8 @@ int eltorito_writer_write_vol_desc(IsoImageWriter *writer)
|
|||||||
memcpy(vol.std_identifier, "CD001", 5);
|
memcpy(vol.std_identifier, "CD001", 5);
|
||||||
vol.vol_desc_version[0] = 1;
|
vol.vol_desc_version[0] = 1;
|
||||||
memcpy(vol.boot_sys_id, "EL TORITO SPECIFICATION", 23);
|
memcpy(vol.boot_sys_id, "EL TORITO SPECIFICATION", 23);
|
||||||
iso_lsb(vol.boot_catalog, t->cat->sections[0].block, 4);
|
iso_lsb(vol.boot_catalog,
|
||||||
|
t->cat->sections[0].block - t->eff_partition_offset, 4);
|
||||||
return iso_write(t, &vol, sizeof(struct ecma119_boot_rec_vol_desc));
|
return iso_write(t, &vol, sizeof(struct ecma119_boot_rec_vol_desc));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,10 @@
|
|||||||
* See COPYING file for details.
|
* See COPYING file for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "filesrc.h"
|
#include "filesrc.h"
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
@ -14,10 +18,7 @@
|
|||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
#include "stream.h"
|
#include "stream.h"
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
#include "md5.h"
|
#include "md5.h"
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -53,11 +54,8 @@ int iso_file_src_create(Ecma119Image *img, IsoFile *file, IsoFileSrc **src)
|
|||||||
unsigned int fs_id;
|
unsigned int fs_id;
|
||||||
dev_t dev_id;
|
dev_t dev_id;
|
||||||
ino_t ino_id;
|
ino_t ino_id;
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
int cret, no_md5= 0;
|
int cret, no_md5= 0;
|
||||||
void *xipt = NULL;
|
void *xipt = NULL;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (img == NULL || file == NULL || src == NULL) {
|
if (img == NULL || file == NULL || src == NULL) {
|
||||||
return ISO_NULL_POINTER;
|
return ISO_NULL_POINTER;
|
||||||
@ -103,9 +101,6 @@ int iso_file_src_create(Ecma119Image *img, IsoFile *file, IsoFileSrc **src)
|
|||||||
/* insert the filesrc in the tree */
|
/* insert the filesrc in the tree */
|
||||||
ret = iso_rbtree_insert(img->files, fsrc, (void**)src);
|
ret = iso_rbtree_insert(img->files, fsrc, (void**)src);
|
||||||
if (ret <= 0) {
|
if (ret <= 0) {
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
if (ret == 0 && (*src)->checksum_index > 0) {
|
if (ret == 0 && (*src)->checksum_index > 0) {
|
||||||
/* Duplicate file source was mapped to previously registered source
|
/* Duplicate file source was mapped to previously registered source
|
||||||
*/
|
*/
|
||||||
@ -113,17 +108,12 @@ int iso_file_src_create(Ecma119Image *img, IsoFile *file, IsoFileSrc **src)
|
|||||||
if (cret < 0)
|
if (cret < 0)
|
||||||
ret = cret;
|
ret = cret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
free(fsrc->sections);
|
free(fsrc->sections);
|
||||||
free(fsrc);
|
free(fsrc);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
iso_stream_ref(fsrc->stream);
|
iso_stream_ref(fsrc->stream);
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
if ((img->md5_file_checksums & 1) &&
|
if ((img->md5_file_checksums & 1) &&
|
||||||
file->from_old_session && img->appendable) {
|
file->from_old_session && img->appendable) {
|
||||||
ret = iso_node_get_xinfo((IsoNode *) file, checksum_md5_xinfo_func,
|
ret = iso_node_get_xinfo((IsoNode *) file, checksum_md5_xinfo_func,
|
||||||
@ -149,8 +139,6 @@ int iso_file_src_create(Ecma119Image *img, IsoFile *file, IsoFileSrc **src)
|
|||||||
return cret;
|
return cret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,21 +292,16 @@ int filesrc_read(IsoFileSrc *file, char *buf, size_t count)
|
|||||||
return iso_stream_read_buffer(file->stream, buf, count, &got);
|
return iso_stream_read_buffer(file->stream, buf, count, &got);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
/* @return 1=ok, md5 is valid,
|
/* @return 1=ok, md5 is valid,
|
||||||
0= not ok, go on,
|
0= not ok, go on,
|
||||||
<0 fatal error, abort
|
<0 fatal error, abort
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static
|
static
|
||||||
int filesrc_make_md5(Ecma119Image *t, IsoFileSrc *file, char md5[16], int flag)
|
int filesrc_make_md5(Ecma119Image *t, IsoFileSrc *file, char md5[16], int flag)
|
||||||
{
|
{
|
||||||
return iso_stream_make_md5(file->stream, md5, 0);
|
return iso_stream_make_md5(file->stream, md5, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
static
|
static
|
||||||
int filesrc_writer_write_data(IsoImageWriter *writer)
|
int filesrc_writer_write_data(IsoImageWriter *writer)
|
||||||
{
|
{
|
||||||
@ -331,13 +314,9 @@ int filesrc_writer_write_data(IsoImageWriter *writer)
|
|||||||
char buffer[BLOCK_SIZE];
|
char buffer[BLOCK_SIZE];
|
||||||
off_t file_size;
|
off_t file_size;
|
||||||
uint32_t nblocks;
|
uint32_t nblocks;
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
void *ctx= NULL;
|
void *ctx= NULL;
|
||||||
char md5[16], pre_md5[16];
|
char md5[16], pre_md5[16];
|
||||||
int pre_md5_valid = 0;
|
int pre_md5_valid = 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
if (writer == NULL) {
|
if (writer == NULL) {
|
||||||
return ISO_ASSERT_FAILURE;
|
return ISO_ASSERT_FAILURE;
|
||||||
@ -353,17 +332,11 @@ int filesrc_writer_write_data(IsoImageWriter *writer)
|
|||||||
was_error = 0;
|
was_error = 0;
|
||||||
file_size = iso_file_src_get_size(file);
|
file_size = iso_file_src_get_size(file);
|
||||||
nblocks = DIV_UP(file_size, BLOCK_SIZE);
|
nblocks = DIV_UP(file_size, BLOCK_SIZE);
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
pre_md5_valid = 0;
|
pre_md5_valid = 0;
|
||||||
if (file->checksum_index > 0 && (t->md5_file_checksums & 2)) {
|
if (file->checksum_index > 0 && (t->md5_file_checksums & 2)) {
|
||||||
/* Obtain an MD5 of content by a first read pass */
|
/* Obtain an MD5 of content by a first read pass */
|
||||||
pre_md5_valid = filesrc_make_md5(t, file, pre_md5, 0);
|
pre_md5_valid = filesrc_make_md5(t, file, pre_md5, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
res = filesrc_open(file);
|
res = filesrc_open(file);
|
||||||
iso_stream_get_file_name(file->stream, name);
|
iso_stream_get_file_name(file->stream, name);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
@ -407,18 +380,12 @@ int filesrc_writer_write_data(IsoImageWriter *writer)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
if (file->checksum_index > 0) {
|
if (file->checksum_index > 0) {
|
||||||
/* initialize file checksum */
|
/* initialize file checksum */
|
||||||
res = iso_md5_start(&ctx);
|
res = iso_md5_start(&ctx);
|
||||||
if (res <= 0)
|
if (res <= 0)
|
||||||
file->checksum_index = 0;
|
file->checksum_index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
/* write file contents to image */
|
/* write file contents to image */
|
||||||
for (b = 0; b < nblocks; ++b) {
|
for (b = 0; b < nblocks; ++b) {
|
||||||
int wres;
|
int wres;
|
||||||
@ -434,9 +401,6 @@ int filesrc_writer_write_data(IsoImageWriter *writer)
|
|||||||
ret = wres;
|
ret = wres;
|
||||||
goto ex;
|
goto ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
if (file->checksum_index > 0) {
|
if (file->checksum_index > 0) {
|
||||||
/* Add to file checksum */
|
/* Add to file checksum */
|
||||||
if (file_size - b * BLOCK_SIZE > BLOCK_SIZE)
|
if (file_size - b * BLOCK_SIZE > BLOCK_SIZE)
|
||||||
@ -447,9 +411,6 @@ int filesrc_writer_write_data(IsoImageWriter *writer)
|
|||||||
if (res <= 0)
|
if (res <= 0)
|
||||||
file->checksum_index = 0;
|
file->checksum_index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
filesrc_close(file);
|
filesrc_close(file);
|
||||||
@ -484,9 +445,6 @@ int filesrc_writer_write_data(IsoImageWriter *writer)
|
|||||||
ret = res;
|
ret = res;
|
||||||
goto ex;
|
goto ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
if (file->checksum_index > 0) {
|
if (file->checksum_index > 0) {
|
||||||
/* Add to file checksum */
|
/* Add to file checksum */
|
||||||
if (file_size - b * BLOCK_SIZE > BLOCK_SIZE)
|
if (file_size - b * BLOCK_SIZE > BLOCK_SIZE)
|
||||||
@ -497,14 +455,8 @@ int filesrc_writer_write_data(IsoImageWriter *writer)
|
|||||||
if (res <= 0)
|
if (res <= 0)
|
||||||
file->checksum_index = 0;
|
file->checksum_index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
if (file->checksum_index > 0 &&
|
if (file->checksum_index > 0 &&
|
||||||
file->checksum_index <= t->checksum_idx_counter) {
|
file->checksum_index <= t->checksum_idx_counter) {
|
||||||
/* Obtain checksum and dispose checksum context */
|
/* Obtain checksum and dispose checksum context */
|
||||||
@ -529,19 +481,12 @@ int filesrc_writer_write_data(IsoImageWriter *writer)
|
|||||||
/* Write md5 into checksum buffer at file->checksum_index */
|
/* Write md5 into checksum buffer at file->checksum_index */
|
||||||
memcpy(t->checksum_buffer + 16 * file->checksum_index, md5, 16);
|
memcpy(t->checksum_buffer + 16 * file->checksum_index, md5, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ISO_SUCCESS;
|
ret = ISO_SUCCESS;
|
||||||
ex:;
|
ex:;
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
if (ctx != NULL) /* avoid any memory leak */
|
if (ctx != NULL) /* avoid any memory leak */
|
||||||
iso_md5_end(&ctx, md5);
|
iso_md5_end(&ctx, md5);
|
||||||
#endif
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,14 +18,8 @@
|
|||||||
struct Iso_File_Src
|
struct Iso_File_Src
|
||||||
{
|
{
|
||||||
unsigned int prev_img :1; /**< if the file comes from a previous image */
|
unsigned int prev_img :1; /**< if the file comes from a previous image */
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
unsigned int checksum_index :31;
|
unsigned int checksum_index :31;
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
|
|
||||||
/** File Sections of the file in the image */
|
/** File Sections of the file in the image */
|
||||||
struct iso_file_section *sections;
|
struct iso_file_section *sections;
|
||||||
int nsections;
|
int nsections;
|
||||||
|
@ -8,6 +8,10 @@
|
|||||||
* See COPYING file for details.
|
* See COPYING file for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "libisofs.h"
|
#include "libisofs.h"
|
||||||
#include "filter.h"
|
#include "filter.h"
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
|
@ -13,6 +13,10 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "../libisofs.h"
|
#include "../libisofs.h"
|
||||||
#include "../filter.h"
|
#include "../filter.h"
|
||||||
#include "../fsource.h"
|
#include "../fsource.h"
|
||||||
|
@ -17,6 +17,10 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "../libisofs.h"
|
#include "../libisofs.h"
|
||||||
#include "../filter.h"
|
#include "../filter.h"
|
||||||
#include "../fsource.h"
|
#include "../fsource.h"
|
||||||
|
@ -1,188 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2008 Vreixo Formoso
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* or later as published by the Free Software Foundation.
|
|
||||||
* See COPYING file for details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "../libisofs.h"
|
|
||||||
#include "../filter.h"
|
|
||||||
#include "../fsource.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* A simple Filter implementation for example purposes. It encrypts a file
|
|
||||||
* by XORing each byte by a given key.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static ino_t xor_ino_id = 0;
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
IsoStream *orig;
|
|
||||||
uint8_t key;
|
|
||||||
ino_t id;
|
|
||||||
} XorEncryptStreamData;
|
|
||||||
|
|
||||||
static
|
|
||||||
int xor_encrypt_stream_open(IsoStream *stream)
|
|
||||||
{
|
|
||||||
XorEncryptStreamData *data;
|
|
||||||
if (stream == NULL) {
|
|
||||||
return ISO_NULL_POINTER;
|
|
||||||
}
|
|
||||||
data = (XorEncryptStreamData*)stream->data;
|
|
||||||
return iso_stream_open(data->orig);
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
int xor_encrypt_stream_close(IsoStream *stream)
|
|
||||||
{
|
|
||||||
XorEncryptStreamData *data;
|
|
||||||
if (stream == NULL) {
|
|
||||||
return ISO_NULL_POINTER;
|
|
||||||
}
|
|
||||||
data = stream->data;
|
|
||||||
return iso_stream_close(data->orig);
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
off_t xor_encrypt_stream_get_size(IsoStream *stream)
|
|
||||||
{
|
|
||||||
XorEncryptStreamData *data;
|
|
||||||
if (stream == NULL) {
|
|
||||||
return ISO_NULL_POINTER;
|
|
||||||
}
|
|
||||||
data = stream->data;
|
|
||||||
return iso_stream_get_size(data->orig);
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
int xor_encrypt_stream_read(IsoStream *stream, void *buf, size_t count)
|
|
||||||
{
|
|
||||||
int ret, len;
|
|
||||||
XorEncryptStreamData *data;
|
|
||||||
uint8_t *buffer = buf;
|
|
||||||
|
|
||||||
if (stream == NULL) {
|
|
||||||
return ISO_NULL_POINTER;
|
|
||||||
}
|
|
||||||
data = stream->data;
|
|
||||||
ret = iso_stream_read(data->orig, buf, count);
|
|
||||||
if (ret < 0) {
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* xor */
|
|
||||||
for (len = 0; len < ret; ++len) {
|
|
||||||
buffer[len] = buffer[len] ^ data->key;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
int xor_encrypt_stream_is_repeatable(IsoStream *stream)
|
|
||||||
{
|
|
||||||
/* the filter can't be created if underlying stream is not repeatable */
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
void xor_encrypt_stream_get_id(IsoStream *stream, unsigned int *fs_id,
|
|
||||||
dev_t *dev_id, ino_t *ino_id)
|
|
||||||
{
|
|
||||||
XorEncryptStreamData *data = stream->data;
|
|
||||||
*fs_id = ISO_FILTER_FS_ID;
|
|
||||||
*dev_id = XOR_ENCRYPT_DEV_ID;
|
|
||||||
*ino_id = data->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
void xor_encrypt_stream_free(IsoStream *stream)
|
|
||||||
{
|
|
||||||
XorEncryptStreamData *data = stream->data;
|
|
||||||
iso_stream_unref(data->orig);
|
|
||||||
free(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
IsoStreamIface xor_encrypt_stream_class = {
|
|
||||||
0,
|
|
||||||
"xorf",
|
|
||||||
xor_encrypt_stream_open,
|
|
||||||
xor_encrypt_stream_close,
|
|
||||||
xor_encrypt_stream_get_size,
|
|
||||||
xor_encrypt_stream_read,
|
|
||||||
xor_encrypt_stream_is_repeatable,
|
|
||||||
xor_encrypt_stream_get_id,
|
|
||||||
xor_encrypt_stream_free
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static
|
|
||||||
void xor_encrypt_filter_free(FilterContext *filter)
|
|
||||||
{
|
|
||||||
free(filter->data);
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
int xor_encrypt_filter_get_filter(FilterContext *filter, IsoStream *original,
|
|
||||||
IsoStream **filtered)
|
|
||||||
{
|
|
||||||
IsoStream *str;
|
|
||||||
XorEncryptStreamData *data;
|
|
||||||
|
|
||||||
if (filter == NULL || original == NULL || filtered == NULL) {
|
|
||||||
return ISO_NULL_POINTER;
|
|
||||||
}
|
|
||||||
|
|
||||||
str = malloc(sizeof(IsoStream));
|
|
||||||
if (str == NULL) {
|
|
||||||
return ISO_OUT_OF_MEM;
|
|
||||||
}
|
|
||||||
data = malloc(sizeof(XorEncryptStreamData));
|
|
||||||
if (str == NULL) {
|
|
||||||
free(str);
|
|
||||||
return ISO_OUT_OF_MEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* fill data */
|
|
||||||
data->key = *((uint8_t*)filter->data);
|
|
||||||
data->id = xor_ino_id++;
|
|
||||||
|
|
||||||
/* get reference to the source */
|
|
||||||
data->orig = original;
|
|
||||||
iso_stream_ref(original);
|
|
||||||
|
|
||||||
str->refcount = 1;
|
|
||||||
str->data = data;
|
|
||||||
str->class = &xor_encrypt_stream_class;
|
|
||||||
|
|
||||||
*filtered = str;
|
|
||||||
return ISO_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
int create_xor_encrypt_filter(uint8_t key, FilterContext **filter)
|
|
||||||
{
|
|
||||||
FilterContext *f;
|
|
||||||
uint8_t *data;
|
|
||||||
|
|
||||||
f = calloc(1, sizeof(FilterContext));
|
|
||||||
if (f == NULL) {
|
|
||||||
return ISO_OUT_OF_MEM;
|
|
||||||
}
|
|
||||||
data = malloc(sizeof(uint8_t));
|
|
||||||
if (data == NULL) {
|
|
||||||
free(f);
|
|
||||||
return ISO_OUT_OF_MEM;
|
|
||||||
}
|
|
||||||
f->refcount = 1;
|
|
||||||
f->version = 0;
|
|
||||||
*data = key;
|
|
||||||
f->data = data;
|
|
||||||
f->free = xor_encrypt_filter_free;
|
|
||||||
f->get_filter = xor_encrypt_filter_get_filter;
|
|
||||||
|
|
||||||
return ISO_SUCCESS;
|
|
||||||
}
|
|
@ -14,6 +14,10 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "../libisofs.h"
|
#include "../libisofs.h"
|
||||||
#include "../filter.h"
|
#include "../filter.h"
|
||||||
#include "../fsource.h"
|
#include "../fsource.h"
|
||||||
@ -826,6 +830,9 @@ int ziso_cmp_ino(IsoStream *s1, IsoStream *s2)
|
|||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef Libisofs_with_zliB
|
||||||
|
|
||||||
static
|
static
|
||||||
void ziso_filter_free(FilterContext *filter)
|
void ziso_filter_free(FilterContext *filter)
|
||||||
{
|
{
|
||||||
@ -913,8 +920,6 @@ int ziso_filter_get_uncompressor(FilterContext *filter, IsoStream *original,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef Libisofs_with_zliB
|
|
||||||
|
|
||||||
/* Produce a parameter object suitable for iso_file_add_filter().
|
/* Produce a parameter object suitable for iso_file_add_filter().
|
||||||
* It may be disposed by free() after all those calls are made.
|
* It may be disposed by free() after all those calls are made.
|
||||||
*
|
*
|
||||||
|
@ -7,6 +7,10 @@
|
|||||||
* See COPYING file for details.
|
* See COPYING file for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "libisofs.h"
|
#include "libisofs.h"
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
|
|
||||||
|
@ -13,6 +13,10 @@
|
|||||||
* IsoDataSource to read image data.
|
* IsoDataSource to read image data.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "libisofs.h"
|
#include "libisofs.h"
|
||||||
#include "ecma119.h"
|
#include "ecma119.h"
|
||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
@ -389,9 +393,19 @@ char* ifs_get_path(IsoFileSource *src)
|
|||||||
if (data->parent == NULL) {
|
if (data->parent == NULL) {
|
||||||
return strdup("");
|
return strdup("");
|
||||||
} else {
|
} else {
|
||||||
char *path = ifs_get_path(data->parent);
|
char *path, *new_path;
|
||||||
int pathlen = strlen(path);
|
int pathlen;
|
||||||
path = realloc(path, pathlen + strlen(data->name) + 2);
|
|
||||||
|
path = ifs_get_path(data->parent);
|
||||||
|
if (path == NULL)
|
||||||
|
return NULL;
|
||||||
|
pathlen = strlen(path);
|
||||||
|
new_path = realloc(path, pathlen + strlen(data->name) + 2);
|
||||||
|
if (new_path == NULL) {
|
||||||
|
free(path);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
path= new_path;
|
||||||
path[pathlen] = '/';
|
path[pathlen] = '/';
|
||||||
path[pathlen + 1] = '\0';
|
path[pathlen + 1] = '\0';
|
||||||
return strcat(path, data->name);
|
return strcat(path, data->name);
|
||||||
@ -2439,9 +2453,6 @@ int iso_image_filesystem_new(IsoDataSource *src, struct iso_read_opts *opts,
|
|||||||
ifs->free = ifs_fs_free;
|
ifs->free = ifs_fs_free;
|
||||||
|
|
||||||
/* read Volume Descriptors and ensure it is a valid image */
|
/* read Volume Descriptors and ensure it is a valid image */
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
if (data->md5_load) {
|
if (data->md5_load) {
|
||||||
/* From opts->block on : check for superblock and tree tags */;
|
/* From opts->block on : check for superblock and tree tags */;
|
||||||
ret = iso_src_check_sb_tree(src, opts->block, 0);
|
ret = iso_src_check_sb_tree(src, opts->block, 0);
|
||||||
@ -2456,8 +2467,6 @@ int iso_image_filesystem_new(IsoDataSource *src, struct iso_read_opts *opts,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
/* 1. first, open the filesystem */
|
/* 1. first, open the filesystem */
|
||||||
ifs_fs_open(ifs);
|
ifs_fs_open(ifs);
|
||||||
|
|
||||||
@ -3128,8 +3137,6 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
|
|||||||
uint8_t *rpt;
|
uint8_t *rpt;
|
||||||
IsoFileSource *boot_src;
|
IsoFileSource *boot_src;
|
||||||
IsoNode *node;
|
IsoNode *node;
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
uint32_t old_checksum_start_lba;
|
uint32_t old_checksum_start_lba;
|
||||||
uint32_t old_checksum_end_lba;
|
uint32_t old_checksum_end_lba;
|
||||||
uint32_t old_checksum_idx_count;
|
uint32_t old_checksum_idx_count;
|
||||||
@ -3139,7 +3146,6 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
|
|||||||
size_t size;
|
size_t size;
|
||||||
void *ctx = NULL;
|
void *ctx = NULL;
|
||||||
char md5[16];
|
char md5[16];
|
||||||
#endif
|
|
||||||
|
|
||||||
if (image == NULL || src == NULL || opts == NULL) {
|
if (image == NULL || src == NULL || opts == NULL) {
|
||||||
return ISO_NULL_POINTER;
|
return ISO_NULL_POINTER;
|
||||||
@ -3181,14 +3187,11 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
|
|||||||
oldroot = image->root;
|
oldroot = image->root;
|
||||||
oldbootcat = image->bootcat; /* could be NULL */
|
oldbootcat = image->bootcat; /* could be NULL */
|
||||||
image->bootcat = NULL;
|
image->bootcat = NULL;
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
old_checksum_start_lba = image->checksum_start_lba;
|
old_checksum_start_lba = image->checksum_start_lba;
|
||||||
old_checksum_end_lba = image->checksum_end_lba;
|
old_checksum_end_lba = image->checksum_end_lba;
|
||||||
old_checksum_idx_count = image->checksum_idx_count;
|
old_checksum_idx_count = image->checksum_idx_count;
|
||||||
old_checksum_array = image->checksum_array;
|
old_checksum_array = image->checksum_array;
|
||||||
image->checksum_array = NULL;
|
image->checksum_array = NULL;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* create new builder */
|
/* create new builder */
|
||||||
ret = iso_image_builder_new(blback, &image->builder);
|
ret = iso_image_builder_new(blback, &image->builder);
|
||||||
@ -3363,8 +3366,6 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
|
|||||||
(*features)->size = data->nblocks;
|
(*features)->size = data->nblocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
if (data->md5_load) {
|
if (data->md5_load) {
|
||||||
/* Read checksum array */
|
/* Read checksum array */
|
||||||
ret = iso_root_get_isofsca((IsoNode *) image->root,
|
ret = iso_root_get_isofsca((IsoNode *) image->root,
|
||||||
@ -3417,8 +3418,6 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
ret = iso_image_eval_boot_info_table(image, opts, src, data->nblocks, 0);
|
ret = iso_image_eval_boot_info_table(image, opts, src, data->nblocks, 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto import_revert;
|
goto import_revert;
|
||||||
@ -3432,14 +3431,11 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
|
|||||||
el_torito_boot_catalog_free(image->bootcat);
|
el_torito_boot_catalog_free(image->bootcat);
|
||||||
image->root = oldroot;
|
image->root = oldroot;
|
||||||
image->bootcat = oldbootcat;
|
image->bootcat = oldbootcat;
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
old_checksum_start_lba = image->checksum_start_lba;
|
old_checksum_start_lba = image->checksum_start_lba;
|
||||||
old_checksum_end_lba = image->checksum_end_lba;
|
old_checksum_end_lba = image->checksum_end_lba;
|
||||||
old_checksum_idx_count = image->checksum_idx_count;
|
old_checksum_idx_count = image->checksum_idx_count;
|
||||||
image->checksum_array = old_checksum_array;
|
image->checksum_array = old_checksum_array;
|
||||||
old_checksum_array = NULL;
|
old_checksum_array = NULL;
|
||||||
#endif
|
|
||||||
|
|
||||||
import_cleanup:;
|
import_cleanup:;
|
||||||
|
|
||||||
@ -3450,14 +3446,10 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
|
|||||||
iso_file_source_unref(newroot);
|
iso_file_source_unref(newroot);
|
||||||
fs->close(fs);
|
fs->close(fs);
|
||||||
iso_filesystem_unref(fs);
|
iso_filesystem_unref(fs);
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
if (old_checksum_array != NULL)
|
if (old_checksum_array != NULL)
|
||||||
free(old_checksum_array);
|
free(old_checksum_array);
|
||||||
if (ctx != NULL)
|
if (ctx != NULL)
|
||||||
iso_md5_end(&ctx, md5);
|
iso_md5_end(&ctx, md5);
|
||||||
#endif
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,10 @@
|
|||||||
* Filesystem/FileSource implementation to access the local filesystem.
|
* Filesystem/FileSource implementation to access the local filesystem.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "fsource.h"
|
#include "fsource.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "aaip_0_2.h"
|
#include "aaip_0_2.h"
|
||||||
@ -58,9 +62,19 @@ char* lfs_get_path(IsoFileSource *src)
|
|||||||
if (data->parent == src) {
|
if (data->parent == src) {
|
||||||
return strdup("/");
|
return strdup("/");
|
||||||
} else {
|
} else {
|
||||||
char *path = lfs_get_path(data->parent);
|
char *path, *new_path;
|
||||||
int pathlen = strlen(path);
|
int pathlen;
|
||||||
path = realloc(path, pathlen + strlen(data->name) + 2);
|
|
||||||
|
path = lfs_get_path(data->parent);
|
||||||
|
if (path == NULL)
|
||||||
|
return NULL;
|
||||||
|
pathlen = strlen(path);
|
||||||
|
new_path = realloc(path, pathlen + strlen(data->name) + 2);
|
||||||
|
if (new_path == NULL) {
|
||||||
|
free(path);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
path= new_path;
|
||||||
if (pathlen != 1) {
|
if (pathlen != 1) {
|
||||||
/* pathlen can only be 1 for root */
|
/* pathlen can only be 1 for root */
|
||||||
path[pathlen] = '/';
|
path[pathlen] = '/';
|
||||||
|
@ -7,6 +7,10 @@
|
|||||||
* See COPYING file for details.
|
* See COPYING file for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "fsource.h"
|
#include "fsource.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
@ -8,6 +8,10 @@
|
|||||||
* See COPYING file for details.
|
* See COPYING file for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "libisofs.h"
|
#include "libisofs.h"
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
@ -81,14 +85,10 @@ int iso_image_new(const char *name, IsoImage **image)
|
|||||||
img->inode_counter = 0;
|
img->inode_counter = 0;
|
||||||
img->used_inodes = NULL;
|
img->used_inodes = NULL;
|
||||||
img->used_inodes_start = 0;
|
img->used_inodes_start = 0;
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
img->checksum_start_lba = 0;
|
img->checksum_start_lba = 0;
|
||||||
img->checksum_end_lba = 0;
|
img->checksum_end_lba = 0;
|
||||||
img->checksum_idx_count = 0;
|
img->checksum_idx_count = 0;
|
||||||
img->checksum_array = NULL;
|
img->checksum_array = NULL;
|
||||||
#endif
|
|
||||||
|
|
||||||
*image = img;
|
*image = img;
|
||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -145,17 +145,12 @@ void iso_image_unref(IsoImage *image)
|
|||||||
|
|
||||||
int iso_image_free_checksums(IsoImage *image, int flag)
|
int iso_image_free_checksums(IsoImage *image, int flag)
|
||||||
{
|
{
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
image->checksum_start_lba = 0;
|
image->checksum_start_lba = 0;
|
||||||
image->checksum_end_lba = 0;
|
image->checksum_end_lba = 0;
|
||||||
image->checksum_idx_count = 0;
|
image->checksum_idx_count = 0;
|
||||||
if (image->checksum_array != NULL)
|
if (image->checksum_array != NULL)
|
||||||
free(image->checksum_array);
|
free(image->checksum_array);
|
||||||
image->checksum_array = NULL;
|
image->checksum_array = NULL;
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,13 +170,13 @@ int iso_image_free_checksums(IsoImage *image, int flag)
|
|||||||
*/
|
*/
|
||||||
int iso_image_attach_data(IsoImage *image, void *data, void (*give_up)(void*))
|
int iso_image_attach_data(IsoImage *image, void *data, void (*give_up)(void*))
|
||||||
{
|
{
|
||||||
if (image == NULL || (data != NULL && free == NULL)) {
|
if (image == NULL) {
|
||||||
return ISO_NULL_POINTER;
|
return ISO_NULL_POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (image->user_data != NULL) {
|
if (image->user_data != NULL) {
|
||||||
/* free previously attached data */
|
/* free previously attached data */
|
||||||
if (image->user_data_free) {
|
if (image->user_data_free != NULL) {
|
||||||
image->user_data_free(image->user_data);
|
image->user_data_free(image->user_data);
|
||||||
}
|
}
|
||||||
image->user_data = NULL;
|
image->user_data = NULL;
|
||||||
@ -592,39 +587,23 @@ ex:;
|
|||||||
int iso_image_get_session_md5(IsoImage *image, uint32_t *start_lba,
|
int iso_image_get_session_md5(IsoImage *image, uint32_t *start_lba,
|
||||||
uint32_t *end_lba, char md5[16], int flag)
|
uint32_t *end_lba, char md5[16], int flag)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
if (image->checksum_array == NULL || image->checksum_idx_count < 1)
|
if (image->checksum_array == NULL || image->checksum_idx_count < 1)
|
||||||
return 0;
|
return 0;
|
||||||
*start_lba = image->checksum_start_lba;
|
*start_lba = image->checksum_start_lba;
|
||||||
*end_lba = image->checksum_end_lba;
|
*end_lba = image->checksum_end_lba;
|
||||||
memcpy(md5, image->checksum_array, 16);
|
memcpy(md5, image->checksum_array, 16);
|
||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
#endif /* ! Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int iso_image_set_checksums(IsoImage *image, char *checksum_array,
|
int iso_image_set_checksums(IsoImage *image, char *checksum_array,
|
||||||
uint32_t start_lba, uint32_t end_lba,
|
uint32_t start_lba, uint32_t end_lba,
|
||||||
uint32_t idx_count, int flag)
|
uint32_t idx_count, int flag)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
iso_image_free_checksums(image, 0);
|
iso_image_free_checksums(image, 0);
|
||||||
image->checksum_array = checksum_array;
|
image->checksum_array = checksum_array;
|
||||||
image->checksum_start_lba = start_lba;
|
image->checksum_start_lba = start_lba;
|
||||||
image->checksum_end_lba = end_lba;
|
image->checksum_end_lba = end_lba;
|
||||||
image->checksum_idx_count = idx_count;
|
image->checksum_idx_count = idx_count;
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,8 +154,6 @@ struct Iso_Image
|
|||||||
uint8_t *used_inodes;
|
uint8_t *used_inodes;
|
||||||
ino_t used_inodes_start;
|
ino_t used_inodes_start;
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array of MD5 checksums as announced by xattr "isofs.ca" of the
|
* Array of MD5 checksums as announced by xattr "isofs.ca" of the
|
||||||
* root node. Array element 0 contains an overall image checksum for the
|
* root node. Array element 0 contains an overall image checksum for the
|
||||||
@ -168,8 +166,6 @@ struct Iso_Image
|
|||||||
uint32_t checksum_idx_count;
|
uint32_t checksum_idx_count;
|
||||||
char *checksum_array;
|
char *checksum_array;
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,6 +7,10 @@
|
|||||||
* See COPYING file for details.
|
* See COPYING file for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "iso1999.h"
|
#include "iso1999.h"
|
||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
#include "writer.h"
|
#include "writer.h"
|
||||||
@ -1024,6 +1028,7 @@ int iso1999_writer_create(Ecma119Image *target)
|
|||||||
"Creating low level ISO 9660:1999 tree...");
|
"Creating low level ISO 9660:1999 tree...");
|
||||||
ret = iso1999_tree_create(target);
|
ret = iso1999_tree_create(target);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
free((char *) writer);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,10 @@
|
|||||||
* See COPYING file for details.
|
* See COPYING file for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "joliet.h"
|
#include "joliet.h"
|
||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
#include "writer.h"
|
#include "writer.h"
|
||||||
@ -552,17 +556,19 @@ int joliet_tree_create(Ecma119Image *t)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* the Joliet tree is stored in Ecma119Image target */
|
/* the Joliet tree is stored in Ecma119Image target */
|
||||||
t->joliet_root = root;
|
if (t->eff_partition_offset > 0) {
|
||||||
|
t->j_part_root = root;
|
||||||
|
} else {
|
||||||
|
t->joliet_root = root;
|
||||||
|
}
|
||||||
|
|
||||||
iso_msg_debug(t->image->id, "Sorting the Joliet tree...");
|
iso_msg_debug(t->image->id, "Sorting the Joliet tree...");
|
||||||
sort_tree(root);
|
sort_tree(root);
|
||||||
|
|
||||||
iso_msg_debug(t->image->id, "Mangling Joliet names...");
|
iso_msg_debug(t->image->id, "Mangling Joliet names...");
|
||||||
ret = mangle_tree(t, t->joliet_root);
|
ret = mangle_tree(t, root);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
|
|
||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -669,6 +675,7 @@ int joliet_writer_compute_data_blocks(IsoImageWriter *writer)
|
|||||||
{
|
{
|
||||||
Ecma119Image *t;
|
Ecma119Image *t;
|
||||||
uint32_t path_table_size;
|
uint32_t path_table_size;
|
||||||
|
size_t ndirs;
|
||||||
|
|
||||||
if (writer == NULL) {
|
if (writer == NULL) {
|
||||||
return ISO_OUT_OF_MEM;
|
return ISO_OUT_OF_MEM;
|
||||||
@ -692,6 +699,24 @@ int joliet_writer_compute_data_blocks(IsoImageWriter *writer)
|
|||||||
t->curblock += DIV_UP(path_table_size, BLOCK_SIZE);
|
t->curblock += DIV_UP(path_table_size, BLOCK_SIZE);
|
||||||
t->joliet_path_table_size = path_table_size;
|
t->joliet_path_table_size = path_table_size;
|
||||||
|
|
||||||
|
if (t->partition_offset > 0) {
|
||||||
|
/* Take into respect second directory tree */
|
||||||
|
ndirs = t->joliet_ndirs;
|
||||||
|
t->joliet_ndirs = 0;
|
||||||
|
calc_dir_pos(t, t->j_part_root);
|
||||||
|
if (t->joliet_ndirs != ndirs) {
|
||||||
|
iso_msg_submit(t->image->id, ISO_ASSERT_FAILURE, 0,
|
||||||
|
"Number of directories differs in Joliet partiton_tree");
|
||||||
|
return ISO_ASSERT_FAILURE;
|
||||||
|
}
|
||||||
|
/* Take into respect second set of path tables */
|
||||||
|
path_table_size = calc_path_table_size(t->j_part_root);
|
||||||
|
t->j_part_l_path_table_pos = t->curblock;
|
||||||
|
t->curblock += DIV_UP(path_table_size, BLOCK_SIZE);
|
||||||
|
t->j_part_m_path_table_pos = t->curblock;
|
||||||
|
t->curblock += DIV_UP(path_table_size, BLOCK_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -754,7 +779,7 @@ void write_one_dir_record(Ecma119Image *t, JolietNode *node, int file_id,
|
|||||||
node = node->parent;
|
node = node->parent;
|
||||||
|
|
||||||
rec->len_dr[0] = len_dr;
|
rec->len_dr[0] = len_dr;
|
||||||
iso_bb(rec->block, block, 4);
|
iso_bb(rec->block, block - t->eff_partition_offset, 4);
|
||||||
iso_bb(rec->length, len, 4);
|
iso_bb(rec->length, len, 4);
|
||||||
iso_datetime_7(rec->recording_time, t->now, t->always_gmt);
|
iso_datetime_7(rec->recording_time, t->now, t->always_gmt);
|
||||||
rec->flags[0] = ((node->type == JOLIET_DIR) ? 2 : 0) | (multi_extend ? 0x80 : 0);
|
rec->flags[0] = ((node->type == JOLIET_DIR) ? 2 : 0) | (multi_extend ? 0x80 : 0);
|
||||||
@ -790,7 +815,6 @@ void ucsncpy_pad(uint16_t *dest, const uint16_t *src, size_t max)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
|
||||||
int joliet_writer_write_vol_desc(IsoImageWriter *writer)
|
int joliet_writer_write_vol_desc(IsoImageWriter *writer)
|
||||||
{
|
{
|
||||||
IsoImage *image;
|
IsoImage *image;
|
||||||
@ -831,16 +855,25 @@ int joliet_writer_write_vol_desc(IsoImageWriter *writer)
|
|||||||
|
|
||||||
/* make use of UCS-2 Level 3 */
|
/* make use of UCS-2 Level 3 */
|
||||||
memcpy(vol.esc_sequences, "%/E", 3);
|
memcpy(vol.esc_sequences, "%/E", 3);
|
||||||
|
iso_bb(vol.vol_space_size, t->vol_space_size - t->eff_partition_offset,
|
||||||
iso_bb(vol.vol_space_size, t->vol_space_size, 4);
|
4);
|
||||||
iso_bb(vol.vol_set_size, (uint32_t) 1, 2);
|
iso_bb(vol.vol_set_size, (uint32_t) 1, 2);
|
||||||
iso_bb(vol.vol_seq_number, (uint32_t) 1, 2);
|
iso_bb(vol.vol_seq_number, (uint32_t) 1, 2);
|
||||||
iso_bb(vol.block_size, (uint32_t) BLOCK_SIZE, 2);
|
iso_bb(vol.block_size, (uint32_t) BLOCK_SIZE, 2);
|
||||||
iso_bb(vol.path_table_size, t->joliet_path_table_size, 4);
|
iso_bb(vol.path_table_size, t->joliet_path_table_size, 4);
|
||||||
iso_lsb(vol.l_path_table_pos, t->joliet_l_path_table_pos, 4);
|
|
||||||
iso_msb(vol.m_path_table_pos, t->joliet_m_path_table_pos, 4);
|
|
||||||
|
|
||||||
write_one_dir_record(t, t->joliet_root, 0, vol.root_dir_record, 1, 0);
|
if (t->eff_partition_offset > 0) {
|
||||||
|
/* Point to second tables and second root */
|
||||||
|
iso_lsb(vol.l_path_table_pos,
|
||||||
|
t->j_part_l_path_table_pos - t->eff_partition_offset, 4);
|
||||||
|
iso_msb(vol.m_path_table_pos,
|
||||||
|
t->j_part_m_path_table_pos - t->eff_partition_offset, 4);
|
||||||
|
write_one_dir_record(t, t->j_part_root, 0, vol.root_dir_record, 1, 0);
|
||||||
|
} else {
|
||||||
|
iso_lsb(vol.l_path_table_pos, t->joliet_l_path_table_pos, 4);
|
||||||
|
iso_msb(vol.m_path_table_pos, t->joliet_m_path_table_pos, 4);
|
||||||
|
write_one_dir_record(t, t->joliet_root, 0, vol.root_dir_record, 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
ucsncpy_pad((uint16_t*)vol.vol_set_id, volset_id, 128);
|
ucsncpy_pad((uint16_t*)vol.vol_set_id, volset_id, 128);
|
||||||
ucsncpy_pad((uint16_t*)vol.publisher_id, pub_id, 128);
|
ucsncpy_pad((uint16_t*)vol.publisher_id, pub_id, 128);
|
||||||
@ -980,7 +1013,8 @@ int write_path_table(Ecma119Image *t, JolietNode **pathlist, int l_type)
|
|||||||
rec = (struct ecma119_path_table_record*) buf;
|
rec = (struct ecma119_path_table_record*) buf;
|
||||||
rec->len_di[0] = dir->parent ? (uint8_t) ucslen(dir->name) * 2 : 1;
|
rec->len_di[0] = dir->parent ? (uint8_t) ucslen(dir->name) * 2 : 1;
|
||||||
rec->len_xa[0] = 0;
|
rec->len_xa[0] = 0;
|
||||||
write_int(rec->block, dir->info.dir->block, 4);
|
write_int(rec->block, dir->info.dir->block - t->eff_partition_offset,
|
||||||
|
4);
|
||||||
write_int(rec->parent, parent + 1, 2);
|
write_int(rec->parent, parent + 1, 2);
|
||||||
if (dir->parent) {
|
if (dir->parent) {
|
||||||
memcpy(rec->dir_id, dir->name, rec->len_di[0]);
|
memcpy(rec->dir_id, dir->name, rec->len_di[0]);
|
||||||
@ -1019,7 +1053,12 @@ int write_path_tables(Ecma119Image *t)
|
|||||||
if (pathlist == NULL) {
|
if (pathlist == NULL) {
|
||||||
return ISO_OUT_OF_MEM;
|
return ISO_OUT_OF_MEM;
|
||||||
}
|
}
|
||||||
pathlist[0] = t->joliet_root;
|
|
||||||
|
if (t->eff_partition_offset > 0) {
|
||||||
|
pathlist[0] = t->j_part_root;
|
||||||
|
} else {
|
||||||
|
pathlist[0] = t->joliet_root;
|
||||||
|
}
|
||||||
cur = 1;
|
cur = 1;
|
||||||
|
|
||||||
for (i = 0; i < t->joliet_ndirs; i++) {
|
for (i = 0; i < t->joliet_ndirs; i++) {
|
||||||
@ -1047,18 +1086,21 @@ int write_path_tables(Ecma119Image *t)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
int joliet_writer_write_data(IsoImageWriter *writer)
|
int joliet_writer_write_dirs(IsoImageWriter *writer)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
Ecma119Image *t;
|
Ecma119Image *t;
|
||||||
|
JolietNode *root;
|
||||||
|
|
||||||
if (writer == NULL) {
|
|
||||||
return ISO_NULL_POINTER;
|
|
||||||
}
|
|
||||||
t = writer->target;
|
t = writer->target;
|
||||||
|
|
||||||
/* first of all, we write the directory structure */
|
/* first of all, we write the directory structure */
|
||||||
ret = write_dirs(t, t->joliet_root);
|
if (t->eff_partition_offset > 0) {
|
||||||
|
root = t->j_part_root;
|
||||||
|
} else {
|
||||||
|
root = t->joliet_root;
|
||||||
|
}
|
||||||
|
ret = write_dirs(t, root);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -1069,12 +1111,40 @@ int joliet_writer_write_data(IsoImageWriter *writer)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
int joliet_writer_write_data(IsoImageWriter *writer)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
Ecma119Image *t;
|
||||||
|
|
||||||
|
if (writer == NULL) {
|
||||||
|
return ISO_NULL_POINTER;
|
||||||
|
}
|
||||||
|
t = writer->target;
|
||||||
|
|
||||||
|
ret = joliet_writer_write_dirs(writer);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
if (t->partition_offset > 0) {
|
||||||
|
t->eff_partition_offset = t->partition_offset;
|
||||||
|
ret = joliet_writer_write_dirs(writer);
|
||||||
|
t->eff_partition_offset = 0;
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
return ISO_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
int joliet_writer_free_data(IsoImageWriter *writer)
|
int joliet_writer_free_data(IsoImageWriter *writer)
|
||||||
{
|
{
|
||||||
/* free the Joliet tree */
|
/* free the Joliet tree */
|
||||||
Ecma119Image *t = writer->target;
|
Ecma119Image *t = writer->target;
|
||||||
joliet_node_free(t->joliet_root);
|
joliet_node_free(t->joliet_root);
|
||||||
|
if (t->j_part_root != NULL)
|
||||||
|
joliet_node_free(t->j_part_root);
|
||||||
|
t->j_part_root = NULL;
|
||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1098,12 +1168,23 @@ int joliet_writer_create(Ecma119Image *target)
|
|||||||
iso_msg_debug(target->image->id, "Creating low level Joliet tree...");
|
iso_msg_debug(target->image->id, "Creating low level Joliet tree...");
|
||||||
ret = joliet_tree_create(target);
|
ret = joliet_tree_create(target);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
free((char *) writer);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add this writer to image */
|
/* add this writer to image */
|
||||||
target->writers[target->nwriters++] = writer;
|
target->writers[target->nwriters++] = writer;
|
||||||
|
|
||||||
|
if(target->partition_offset > 0) {
|
||||||
|
/* Create second tree */
|
||||||
|
target->eff_partition_offset = target->partition_offset;
|
||||||
|
ret = joliet_tree_create(target);
|
||||||
|
if (ret < 0) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
target->eff_partition_offset = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* we need the volume descriptor */
|
/* we need the volume descriptor */
|
||||||
target->curblock++;
|
target->curblock++;
|
||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
|
@ -54,4 +54,10 @@ struct joliet_node
|
|||||||
*/
|
*/
|
||||||
int joliet_writer_create(Ecma119Image *target);
|
int joliet_writer_create(Ecma119Image *target);
|
||||||
|
|
||||||
|
|
||||||
|
/* Not to be called but only for comparison with target->writers[i]
|
||||||
|
*/
|
||||||
|
int joliet_writer_write_vol_desc(IsoImageWriter *writer);
|
||||||
|
|
||||||
|
|
||||||
#endif /* LIBISO_JOLIET_H */
|
#endif /* LIBISO_JOLIET_H */
|
||||||
|
@ -5,6 +5,10 @@
|
|||||||
provided under GPL version 2 or later
|
provided under GPL version 2 or later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -8,6 +8,10 @@
|
|||||||
* See COPYING file for details.
|
* See COPYING file for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Important: If you add a public API function then add its name to file
|
||||||
|
libisofs/libisofs.ver
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Applications must use 64 bit off_t, e.g. on 32-bit GNU/Linux by defining
|
* Applications must use 64 bit off_t, e.g. on 32-bit GNU/Linux by defining
|
||||||
@ -168,7 +172,17 @@ enum IsoHideNodeFlag {
|
|||||||
/** Hide the node in the Joliet tree, if Joliet extension are enabled */
|
/** Hide the node in the Joliet tree, if Joliet extension are enabled */
|
||||||
LIBISO_HIDE_ON_JOLIET = 1 << 1,
|
LIBISO_HIDE_ON_JOLIET = 1 << 1,
|
||||||
/** Hide the node in the ISO-9660:1999 tree, if that format is enabled */
|
/** Hide the node in the ISO-9660:1999 tree, if that format is enabled */
|
||||||
LIBISO_HIDE_ON_1999 = 1 << 2
|
LIBISO_HIDE_ON_1999 = 1 << 2,
|
||||||
|
|
||||||
|
/** With IsoNode and IsoBoot: Write data content even if the node is
|
||||||
|
* not visible in any tree.
|
||||||
|
* With directory nodes : Write data content of IsoNode and IsoBoot
|
||||||
|
* in the directory's tree unless they are
|
||||||
|
* explicitely marked LIBISO_HIDE_ON_RR
|
||||||
|
* without LIBISO_HIDE_BUT_WRITE.
|
||||||
|
* @since 0.6.34
|
||||||
|
*/
|
||||||
|
LIBISO_HIDE_BUT_WRITE = 1 << 3
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -632,7 +646,7 @@ struct IsoFileSource_Iface
|
|||||||
* The dest. will be copied there, and it will be NULL-terminated
|
* The dest. will be copied there, and it will be NULL-terminated
|
||||||
* @param bufsiz
|
* @param bufsiz
|
||||||
* characters to be copied. Destination link will be truncated if
|
* characters to be copied. Destination link will be truncated if
|
||||||
* it is larger than given size. This include the \0 character.
|
* it is larger than given size. This include the 0x0 character.
|
||||||
* @return
|
* @return
|
||||||
* 1 on success, < 0 on error (has to be a valid libisofs error code)
|
* 1 on success, < 0 on error (has to be a valid libisofs error code)
|
||||||
* Error codes:
|
* Error codes:
|
||||||
@ -720,6 +734,9 @@ struct IsoFileSource_Iface
|
|||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
#ifndef Libisofs_h_as_cpluspluS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An IsoFile Source is a POSIX abstraction of a file.
|
* An IsoFile Source is a POSIX abstraction of a file.
|
||||||
*
|
*
|
||||||
@ -732,6 +749,9 @@ struct iso_file_source
|
|||||||
void *data;
|
void *data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif /* ! Libisofs_h_as_cpluspluS */
|
||||||
|
#endif /* ! __cplusplus */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Representation of file contents. It is an stream of bytes, functionally
|
* Representation of file contents. It is an stream of bytes, functionally
|
||||||
* like a pipe.
|
* like a pipe.
|
||||||
@ -785,6 +805,7 @@ struct IsoStream_Iface
|
|||||||
/**
|
/**
|
||||||
* Type of Stream.
|
* Type of Stream.
|
||||||
* "fsrc" -> Read from file source
|
* "fsrc" -> Read from file source
|
||||||
|
* "cout" -> Cut out interval from disk file
|
||||||
* "mem " -> Read from memory
|
* "mem " -> Read from memory
|
||||||
* "boot" -> Boot catalog
|
* "boot" -> Boot catalog
|
||||||
* "extf" -> External filter program
|
* "extf" -> External filter program
|
||||||
@ -940,6 +961,9 @@ struct IsoStream_Iface
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
#ifndef Libisofs_h_as_cpluspluS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Representation of file contents as a stream of bytes.
|
* Representation of file contents as a stream of bytes.
|
||||||
*
|
*
|
||||||
@ -952,6 +976,9 @@ struct iso_stream
|
|||||||
void *data;
|
void *data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif /* ! Libisofs_h_as_cpluspluS */
|
||||||
|
#endif /* ! __cplusplus */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize libisofs. Before any usage of the library you must either call
|
* Initialize libisofs. Before any usage of the library you must either call
|
||||||
@ -1091,7 +1118,7 @@ int iso_lib_is_compatible(int major, int minor, int micro);
|
|||||||
*/
|
*/
|
||||||
#define iso_lib_header_version_major 0
|
#define iso_lib_header_version_major 0
|
||||||
#define iso_lib_header_version_minor 6
|
#define iso_lib_header_version_minor 6
|
||||||
#define iso_lib_header_version_micro 32
|
#define iso_lib_header_version_micro 36
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Usage discussion:
|
* Usage discussion:
|
||||||
@ -1177,6 +1204,8 @@ void iso_write_opts_free(IsoWriteOpts *opts);
|
|||||||
/**
|
/**
|
||||||
* Set the ISO-9960 level to write at.
|
* Set the ISO-9960 level to write at.
|
||||||
*
|
*
|
||||||
|
* @param opts
|
||||||
|
* The option set to be manipulated.
|
||||||
* @param level
|
* @param level
|
||||||
* -> 1 for higher compatibility with old systems. With this level
|
* -> 1 for higher compatibility with old systems. With this level
|
||||||
* filenames are restricted to 8.3 characters.
|
* filenames are restricted to 8.3 characters.
|
||||||
@ -1200,6 +1229,8 @@ int iso_write_opts_set_iso_level(IsoWriteOpts *opts, int level);
|
|||||||
* directories, support for symbolic links or special files... All that
|
* directories, support for symbolic links or special files... All that
|
||||||
* attributes can be modified/setted with the appropiate function.
|
* attributes can be modified/setted with the appropiate function.
|
||||||
*
|
*
|
||||||
|
* @param opts
|
||||||
|
* The option set to be manipulated.
|
||||||
* @param enable
|
* @param enable
|
||||||
* 1 to enable RR extension, 0 to not add them
|
* 1 to enable RR extension, 0 to not add them
|
||||||
* @return
|
* @return
|
||||||
@ -1217,6 +1248,8 @@ int iso_write_opts_set_rockridge(IsoWriteOpts *opts, int enable);
|
|||||||
* Usage of Joliet supplies longer filesystem length (up to 64 unicode
|
* Usage of Joliet supplies longer filesystem length (up to 64 unicode
|
||||||
* characters), and deeper directory structure.
|
* characters), and deeper directory structure.
|
||||||
*
|
*
|
||||||
|
* @param opts
|
||||||
|
* The option set to be manipulated.
|
||||||
* @param enable
|
* @param enable
|
||||||
* 1 to enable Joliet extension, 0 to not add them
|
* 1 to enable Joliet extension, 0 to not add them
|
||||||
* @return
|
* @return
|
||||||
@ -1242,7 +1275,7 @@ int iso_write_opts_set_iso1999(IsoWriteOpts *opts, int enable);
|
|||||||
* Inode numbers get written as "file serial number" with PX entries as of
|
* Inode numbers get written as "file serial number" with PX entries as of
|
||||||
* RRIP-1.12. They may mark families of hardlinks.
|
* RRIP-1.12. They may mark families of hardlinks.
|
||||||
* RRIP-1.10 prescribes a PX entry without file serial number. If not overriden
|
* RRIP-1.10 prescribes a PX entry without file serial number. If not overriden
|
||||||
* by iso_write_opts_set_rrip_1_10_px_ino() there will be no file serial
|
* by iso_write_opts_set_rrip_1_10_px_ino() there will be no file serial number
|
||||||
* written into RRIP-1.10 images.
|
* written into RRIP-1.10 images.
|
||||||
*
|
*
|
||||||
* Inode number generation does not affect IsoNode objects which imported their
|
* Inode number generation does not affect IsoNode objects which imported their
|
||||||
@ -1256,12 +1289,14 @@ int iso_write_opts_set_iso1999(IsoWriteOpts *opts, int enable);
|
|||||||
* properties, then one of them will get assigned a new unique inode number.
|
* properties, then one of them will get assigned a new unique inode number.
|
||||||
* I.e. the hardlink relation between both IsoNode objects ends.
|
* I.e. the hardlink relation between both IsoNode objects ends.
|
||||||
*
|
*
|
||||||
|
* @param opts
|
||||||
|
* The option set to be manipulated.
|
||||||
* @param enable
|
* @param enable
|
||||||
* 1 = Collect IsoNode objects which have identical data sources and
|
* 1 = Collect IsoNode objects which have identical data sources and
|
||||||
* properties.
|
* properties.
|
||||||
* 0 = Generate unique inode numbers for all IsoNode objects which do not
|
* 0 = Generate unique inode numbers for all IsoNode objects which do not
|
||||||
* have a valid inode number from an imported ISO image.
|
* have a valid inode number from an imported ISO image.
|
||||||
* All other values are reserved.
|
* All other values are reserved.
|
||||||
*
|
*
|
||||||
* @since 0.6.20
|
* @since 0.6.20
|
||||||
*/
|
*/
|
||||||
@ -1273,10 +1308,12 @@ int iso_write_opts_set_hardlinks(IsoWriteOpts *opts, int enable);
|
|||||||
* (e.g. the local POSIX filesystem) see iso_image_set_ignore_aclea().
|
* (e.g. the local POSIX filesystem) see iso_image_set_ignore_aclea().
|
||||||
* For loading of this information from images see iso_read_opts_set_no_aaip().
|
* For loading of this information from images see iso_read_opts_set_no_aaip().
|
||||||
*
|
*
|
||||||
|
* @param opts
|
||||||
|
* The option set to be manipulated.
|
||||||
* @param enable
|
* @param enable
|
||||||
* 1 = write AAIP information from nodes into the image
|
* 1 = write AAIP information from nodes into the image
|
||||||
* 0 = do not write AAIP information into the image
|
* 0 = do not write AAIP information into the image
|
||||||
* All other values are reserved.
|
* All other values are reserved.
|
||||||
*
|
*
|
||||||
* @since 0.6.14
|
* @since 0.6.14
|
||||||
*/
|
*/
|
||||||
@ -1286,6 +1323,8 @@ int iso_write_opts_set_aaip(IsoWriteOpts *opts, int enable);
|
|||||||
* Omit the version number (";1") at the end of the ISO-9660 identifiers.
|
* Omit the version number (";1") at the end of the ISO-9660 identifiers.
|
||||||
* This breaks ECMA-119 specification, but version numbers are usually not
|
* This breaks ECMA-119 specification, but version numbers are usually not
|
||||||
* used, so it should work on most systems. Use with caution.
|
* used, so it should work on most systems. Use with caution.
|
||||||
|
* @param opts
|
||||||
|
* The option set to be manipulated.
|
||||||
* @param omit
|
* @param omit
|
||||||
* bit0= omit version number with ECMA-119 and Joliet
|
* bit0= omit version number with ECMA-119 and Joliet
|
||||||
* bit1= omit version number with Joliet alone (@since 0.6.30)
|
* bit1= omit version number with Joliet alone (@since 0.6.30)
|
||||||
@ -1326,6 +1365,9 @@ int iso_write_opts_set_max_37_char_filenames(IsoWriteOpts *opts, int allow);
|
|||||||
* extension. libisofs adds it if original filename doesn't has one. Set
|
* extension. libisofs adds it if original filename doesn't has one. Set
|
||||||
* this to 1 to prevent this behavior.
|
* this to 1 to prevent this behavior.
|
||||||
* This breaks ECMA-119 specification. Use with caution.
|
* This breaks ECMA-119 specification. Use with caution.
|
||||||
|
*
|
||||||
|
* @param opts
|
||||||
|
* The option set to be manipulated.
|
||||||
* @param no
|
* @param no
|
||||||
* bit0= no forced dot with ECMA-119
|
* bit0= no forced dot with ECMA-119
|
||||||
* bit1= no forced dot with Joliet (@since 0.6.30)
|
* bit1= no forced dot with Joliet (@since 0.6.30)
|
||||||
@ -1345,7 +1387,7 @@ int iso_write_opts_set_allow_lowercase(IsoWriteOpts *opts, int allow);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow all ASCII characters to be appear on an ISO-9660 filename. Note
|
* Allow all ASCII characters to be appear on an ISO-9660 filename. Note
|
||||||
* that "/" and "\0" characters are never allowed, even in RR names.
|
* that "/" and 0x0 characters are never allowed, even in RR names.
|
||||||
* This breaks ECMA-119 specification. Use with caution.
|
* This breaks ECMA-119 specification. Use with caution.
|
||||||
*
|
*
|
||||||
* @since 0.6.2
|
* @since 0.6.2
|
||||||
@ -1456,12 +1498,14 @@ int iso_write_opts_set_record_md5(IsoWriteOpts *opts, int session, int files);
|
|||||||
* Set the parameters "name" and "timestamp" for a scdbackup checksum tag.
|
* Set the parameters "name" and "timestamp" for a scdbackup checksum tag.
|
||||||
* It will be appended to the libisofs session tag if the image starts at
|
* It will be appended to the libisofs session tag if the image starts at
|
||||||
* LBA 0 (see iso_write_opts_set_ms_block()). The scdbackup tag can be used
|
* LBA 0 (see iso_write_opts_set_ms_block()). The scdbackup tag can be used
|
||||||
* to verify the image by command scdbackup_verify <device> -auto_end.
|
* to verify the image by command scdbackup_verify device -auto_end.
|
||||||
* See scdbackup/README appendix VERIFY for its inner details.
|
* See scdbackup/README appendix VERIFY for its inner details.
|
||||||
*
|
*
|
||||||
|
* @param opts
|
||||||
|
* The option set to be manipulated.
|
||||||
* @param name
|
* @param name
|
||||||
* A word of up to 80 characters. Typically <volno>_<totalno> telling
|
* A word of up to 80 characters. Typically volno_totalno telling
|
||||||
* that this is volume <volno> of a total of <totalno> volumes.
|
* that this is volume volno of a total of totalno volumes.
|
||||||
* @param timestamp
|
* @param timestamp
|
||||||
* A string of 13 characters YYMMDD.hhmmss (e.g. A90831.190324).
|
* A string of 13 characters YYMMDD.hhmmss (e.g. A90831.190324).
|
||||||
* A9 = 2009, B0 = 2010, B1 = 2011, ... C0 = 2020, ...
|
* A9 = 2009, B0 = 2010, B1 = 2011, ... C0 = 2020, ...
|
||||||
@ -1607,6 +1651,8 @@ int iso_write_opts_set_output_charset(IsoWriteOpts *opts, const char *charset);
|
|||||||
* image will always be a stand-alone image, as there is no previous data to
|
* image will always be a stand-alone image, as there is no previous data to
|
||||||
* refer to.
|
* refer to.
|
||||||
*
|
*
|
||||||
|
* @param opts
|
||||||
|
* The option set to be manipulated.
|
||||||
* @param append
|
* @param append
|
||||||
* 1 to create an appended image, 0 for an stand-alone one.
|
* 1 to create an appended image, 0 for an stand-alone one.
|
||||||
*
|
*
|
||||||
@ -1632,7 +1678,7 @@ int iso_write_opts_set_appendable(IsoWriteOpts *opts, int append);
|
|||||||
int iso_write_opts_set_ms_block(IsoWriteOpts *opts, uint32_t ms_block);
|
int iso_write_opts_set_ms_block(IsoWriteOpts *opts, uint32_t ms_block);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the buffer where to store the descriptors which shall to be written
|
* Sets the buffer where to store the descriptors which shall be written
|
||||||
* at the beginning of an overwriteable media to point to the newly written
|
* at the beginning of an overwriteable media to point to the newly written
|
||||||
* image.
|
* image.
|
||||||
* This is needed if the write start address of the image is not 0.
|
* This is needed if the write start address of the image is not 0.
|
||||||
@ -1659,24 +1705,31 @@ int iso_write_opts_set_ms_block(IsoWriteOpts *opts, uint32_t ms_block);
|
|||||||
* - Together with iso_write_opts_set_appendable(opts, 0) the buffer allows
|
* - Together with iso_write_opts_set_appendable(opts, 0) the buffer allows
|
||||||
* to write the first session on overwriteable media to start addresses
|
* to write the first session on overwriteable media to start addresses
|
||||||
* other than 0.
|
* other than 0.
|
||||||
|
* This address must not be smaller than 32 blocks plus the eventual
|
||||||
|
* partition offset as defined by iso_write_opts_set_part_offset().
|
||||||
* libisoburn in most cases writes the first session on overwriteable media
|
* libisoburn in most cases writes the first session on overwriteable media
|
||||||
* and disk files to LBA 32 in order to preserve its descriptors from the
|
* and disk files to LBA (32 + partition_offset) in order to preserve its
|
||||||
* subsequent overwriting by the descriptor buffer of later sessions.
|
* descriptors from the subsequent overwriting by the descriptor buffer of
|
||||||
|
* later sessions.
|
||||||
*
|
*
|
||||||
* @param buffer
|
* @param opts
|
||||||
|
* The option set to be manipulated.
|
||||||
|
* @param overwrite
|
||||||
* When not NULL, it should point to at least 64KiB of memory, where
|
* When not NULL, it should point to at least 64KiB of memory, where
|
||||||
* libisofs will install the contents that shall be written at the
|
* libisofs will install the contents that shall be written at the
|
||||||
* beginning of overwriteable media.
|
* beginning of overwriteable media.
|
||||||
* You should initialize the buffer either with 0s, or with the contents
|
* You should initialize the buffer either with 0s, or with the contents
|
||||||
* of the first 32 blocks of the image you are growing. In most cases,
|
* of the first 32 blocks of the image you are growing. In most cases,
|
||||||
* 0 is good enought.
|
* 0 is good enought.
|
||||||
|
* IMPORTANT: If you use iso_write_opts_set_part_offset() then the
|
||||||
|
* overwrite buffer must be larger by the offset defined there.
|
||||||
*
|
*
|
||||||
* @since 0.6.2
|
* @since 0.6.2
|
||||||
*/
|
*/
|
||||||
int iso_write_opts_set_overwrite_buf(IsoWriteOpts *opts, uint8_t *overwrite);
|
int iso_write_opts_set_overwrite_buf(IsoWriteOpts *opts, uint8_t *overwrite);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the size, in number of blocks, of the FIFO buffer used between the
|
* Set the size, in number of blocks, of the ring buffer used between the
|
||||||
* writer thread and the burn_source. You have to provide at least a 32
|
* writer thread and the burn_source. You have to provide at least a 32
|
||||||
* blocks buffer. Default value is set to 2MB, if that is ok for you, you
|
* blocks buffer. Default value is set to 2MB, if that is ok for you, you
|
||||||
* don't need to call this function.
|
* don't need to call this function.
|
||||||
@ -1724,6 +1777,8 @@ int iso_write_opts_set_system_area(IsoWriteOpts *opts, char data[32768],
|
|||||||
* Explicitely set the four timestamps of the emerging Primary Volume
|
* Explicitely set the four timestamps of the emerging Primary Volume
|
||||||
* Descriptor. Default with all parameters is 0.
|
* Descriptor. Default with all parameters is 0.
|
||||||
* ECMA-119 defines them as:
|
* ECMA-119 defines them as:
|
||||||
|
* @param opts
|
||||||
|
* The option set to be manipulated.
|
||||||
* @param vol_creation_time
|
* @param vol_creation_time
|
||||||
* When "the information in the volume was created."
|
* When "the information in the volume was created."
|
||||||
* A value of 0 means that the timepoint of write start is to be used.
|
* A value of 0 means that the timepoint of write start is to be used.
|
||||||
@ -1736,7 +1791,7 @@ int iso_write_opts_set_system_area(IsoWriteOpts *opts, char data[32768],
|
|||||||
* @param vol_effective_time
|
* @param vol_effective_time
|
||||||
* When "the information in the volume may be used."
|
* When "the information in the volume may be used."
|
||||||
* A value of 0 means that not such retention is intended.
|
* A value of 0 means that not such retention is intended.
|
||||||
* @param uuid
|
* @param vol_uuid
|
||||||
* If this text is not empty, then it overrides vol_creation_time and
|
* If this text is not empty, then it overrides vol_creation_time and
|
||||||
* vol_modification_time by copying the first 16 decimal digits from
|
* vol_modification_time by copying the first 16 decimal digits from
|
||||||
* uuid, eventually padding up with decimal '1', and writing a NUL-byte
|
* uuid, eventually padding up with decimal '1', and writing a NUL-byte
|
||||||
@ -1745,6 +1800,8 @@ int iso_write_opts_set_system_area(IsoWriteOpts *opts, char data[32768],
|
|||||||
* is fully predictable and free of timezone pitfalls.
|
* is fully predictable and free of timezone pitfalls.
|
||||||
* It should express a reasonable time in form YYYYMMDDhhmmsscc
|
* It should express a reasonable time in form YYYYMMDDhhmmsscc
|
||||||
* E.g.: "2010040711405800" = 7 Apr 2010 11:40:58 (+0 centiseconds)
|
* E.g.: "2010040711405800" = 7 Apr 2010 11:40:58 (+0 centiseconds)
|
||||||
|
* @return
|
||||||
|
* ISO_SUCCESS or error
|
||||||
*
|
*
|
||||||
* @since 0.6.30
|
* @since 0.6.30
|
||||||
*/
|
*/
|
||||||
@ -1754,6 +1811,43 @@ int iso_write_opts_set_pvd_times(IsoWriteOpts *opts,
|
|||||||
char *vol_uuid);
|
char *vol_uuid);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Control production of a second set of volume descriptors (superblock)
|
||||||
|
* and directory trees, together with a partition table in the MBR where the
|
||||||
|
* first partition has non-zero start address and the others are zeroed.
|
||||||
|
* The first partition stretches to the end of the whole ISO image.
|
||||||
|
* The additional volume descriptor set and trees will allow to mount the
|
||||||
|
* ISO image at the start of the first partition, while it is still possible
|
||||||
|
* to mount it via the normal first volume descriptor set and tree at the
|
||||||
|
* start of the image resp. storage device.
|
||||||
|
* This makes few sense on optical media. But on USB sticks it creates a
|
||||||
|
* conventional partition table which makes it mountable on e.g. Linux via
|
||||||
|
* /dev/sdb and /dev/sdb1 alike.
|
||||||
|
* IMPORTANT: When submitting memory by iso_write_opts_set_overwrite_buf()
|
||||||
|
* then its size must be at least 64 KiB + partition offset.
|
||||||
|
*
|
||||||
|
* @param opts
|
||||||
|
* The option set to be manipulated.
|
||||||
|
* @param block_offset_2k
|
||||||
|
* The offset of the partition start relative to device start.
|
||||||
|
* This is counted in 2 kB blocks. The partition table will show the
|
||||||
|
* according number of 512 byte sectors.
|
||||||
|
* Default is 0 which causes no special partition table preparations.
|
||||||
|
* If it is not 0 then it must not be smaller than 16.
|
||||||
|
* @param secs_512_per_head
|
||||||
|
* Number of 512 byte sectors per head. 1 to 63. 0=automatic.
|
||||||
|
* @param heads_per_cyl
|
||||||
|
* Number of heads per cylinder. 1 to 255. 0=automatic.
|
||||||
|
* @return
|
||||||
|
* ISO_SUCCESS or error
|
||||||
|
*
|
||||||
|
* @since 0.6.36
|
||||||
|
*/
|
||||||
|
int iso_write_opts_set_part_offset(IsoWriteOpts *opts,
|
||||||
|
uint32_t block_offset_2k,
|
||||||
|
int secs_512_per_head, int heads_per_cyl);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inquire the start address of the file data blocks after having used
|
* Inquire the start address of the file data blocks after having used
|
||||||
* IsoWriteOpts with iso_image_create_burn_source().
|
* IsoWriteOpts with iso_image_create_burn_source().
|
||||||
@ -1880,10 +1974,12 @@ int iso_read_opts_set_no_iso1999(IsoReadOpts *opts, int noiso1999);
|
|||||||
* (e.g. the local POSIX filesystem) see iso_image_set_ignore_aclea().
|
* (e.g. the local POSIX filesystem) see iso_image_set_ignore_aclea().
|
||||||
* For eventual writing of this information see iso_write_opts_set_aaip().
|
* For eventual writing of this information see iso_write_opts_set_aaip().
|
||||||
*
|
*
|
||||||
|
* @param opts
|
||||||
|
* The option set to be manipulated
|
||||||
* @param noaaip
|
* @param noaaip
|
||||||
* 1 = Do not read AAIP information
|
* 1 = Do not read AAIP information
|
||||||
* 0 = Read AAIP information if available
|
* 0 = Read AAIP information if available
|
||||||
* All other values are reserved.
|
* All other values are reserved.
|
||||||
* @since 0.6.14
|
* @since 0.6.14
|
||||||
*/
|
*/
|
||||||
int iso_read_opts_set_no_aaip(IsoReadOpts *opts, int noaaip);
|
int iso_read_opts_set_no_aaip(IsoReadOpts *opts, int noaaip);
|
||||||
@ -1894,10 +1990,12 @@ int iso_read_opts_set_no_aaip(IsoReadOpts *opts, int noaaip);
|
|||||||
* Important: Loading of the MD5 array will only work if AAIP is enabled
|
* Important: Loading of the MD5 array will only work if AAIP is enabled
|
||||||
* because its position and layout is recorded in xattr "isofs.ca".
|
* because its position and layout is recorded in xattr "isofs.ca".
|
||||||
*
|
*
|
||||||
|
* @param opts
|
||||||
|
* The option set to be manipulated
|
||||||
* @param no_md5
|
* @param no_md5
|
||||||
* 1 = Do not read MD5 checksum array
|
* 1 = Do not read MD5 checksum array
|
||||||
* 0 = Read Md% array if available
|
* 0 = Read Md% array if available
|
||||||
* All other values are reserved.
|
* All other values are reserved.
|
||||||
*
|
*
|
||||||
* @since 0.6.22
|
* @since 0.6.22
|
||||||
*/
|
*/
|
||||||
@ -1915,6 +2013,8 @@ int iso_read_opts_set_no_md5(IsoReadOpts *opts, int no_md5);
|
|||||||
* Two image nodes which have the same inode number represent two hardlinks
|
* Two image nodes which have the same inode number represent two hardlinks
|
||||||
* of the same file object. So discarding the numbers splits hardlinks.
|
* of the same file object. So discarding the numbers splits hardlinks.
|
||||||
*
|
*
|
||||||
|
* @param opts
|
||||||
|
* The option set to be manipulated
|
||||||
* @param new_inos
|
* @param new_inos
|
||||||
* 1 = Discard imported inode numbers and finally hand out a unique new
|
* 1 = Discard imported inode numbers and finally hand out a unique new
|
||||||
* one to each single file before it gets written into an ISO image.
|
* one to each single file before it gets written into an ISO image.
|
||||||
@ -1953,6 +2053,8 @@ int iso_read_opts_set_default_gid(IsoReadOpts *opts, gid_t gid);
|
|||||||
/**
|
/**
|
||||||
* Set default permissions for files when RR extensions are not present.
|
* Set default permissions for files when RR extensions are not present.
|
||||||
*
|
*
|
||||||
|
* @param opts
|
||||||
|
* The option set to be manipulated
|
||||||
* @param file_perm
|
* @param file_perm
|
||||||
* Permissions for files.
|
* Permissions for files.
|
||||||
* @param dir_perm
|
* @param dir_perm
|
||||||
@ -1969,6 +2071,8 @@ int iso_read_opts_set_default_permissions(IsoReadOpts *opts, mode_t file_perm,
|
|||||||
* in a charset different that the local one. This could happen, for example,
|
* in a charset different that the local one. This could happen, for example,
|
||||||
* if the image was created on a system with different charset.
|
* if the image was created on a system with different charset.
|
||||||
*
|
*
|
||||||
|
* @param opts
|
||||||
|
* The option set to be manipulated
|
||||||
* @param charset
|
* @param charset
|
||||||
* The charset to use as input charset. You can obtain the list of
|
* The charset to use as input charset. You can obtain the list of
|
||||||
* charsets supported on your system executing "iconv -l" in a shell.
|
* charsets supported on your system executing "iconv -l" in a shell.
|
||||||
@ -1981,6 +2085,8 @@ int iso_read_opts_set_input_charset(IsoReadOpts *opts, const char *charset);
|
|||||||
* Enable or disable methods to automatically choose an input charset.
|
* Enable or disable methods to automatically choose an input charset.
|
||||||
* This eventually overrides the name set via iso_read_opts_set_input_charset()
|
* This eventually overrides the name set via iso_read_opts_set_input_charset()
|
||||||
*
|
*
|
||||||
|
* @param opts
|
||||||
|
* The option set to be manipulated
|
||||||
* @param mode
|
* @param mode
|
||||||
* Bitfield for control purposes:
|
* Bitfield for control purposes:
|
||||||
* bit0= Allow to use the input character set name which is eventually
|
* bit0= Allow to use the input character set name which is eventually
|
||||||
@ -1999,6 +2105,8 @@ int iso_read_opts_auto_input_charset(IsoReadOpts *opts, int mode);
|
|||||||
/**
|
/**
|
||||||
* Enable or disable loading of the first 32768 bytes of the session.
|
* Enable or disable loading of the first 32768 bytes of the session.
|
||||||
*
|
*
|
||||||
|
* @param opts
|
||||||
|
* The option set to be manipulated
|
||||||
* @param mode
|
* @param mode
|
||||||
* Bitfield for control purposes:
|
* Bitfield for control purposes:
|
||||||
* bit0= Load System Area data and attach them to the image so that they
|
* bit0= Load System Area data and attach them to the image so that they
|
||||||
@ -2102,6 +2210,8 @@ void iso_image_unref(IsoImage *image);
|
|||||||
* to store addition info together with the IsoImage. If the image already
|
* to store addition info together with the IsoImage. If the image already
|
||||||
* has data attached, the old data will be freed.
|
* has data attached, the old data will be freed.
|
||||||
*
|
*
|
||||||
|
* @param image
|
||||||
|
* The image to which data shall be attached.
|
||||||
* @param data
|
* @param data
|
||||||
* Pointer to application defined data that will be attached to the
|
* Pointer to application defined data that will be attached to the
|
||||||
* image. You can pass NULL to remove any already attached data.
|
* image. You can pass NULL to remove any already attached data.
|
||||||
@ -2343,6 +2453,8 @@ int iso_image_set_boot_image(IsoImage *image, const char *image_path,
|
|||||||
* See iso_image_set_boot_image
|
* See iso_image_set_boot_image
|
||||||
* @return
|
* @return
|
||||||
* 1 on success, < 0 on error
|
* 1 on success, < 0 on error
|
||||||
|
* ISO_BOOT_NO_CATALOG means iso_image_set_boot_image()
|
||||||
|
* was not called first.
|
||||||
*
|
*
|
||||||
* @since 0.6.32
|
* @since 0.6.32
|
||||||
*/
|
*/
|
||||||
@ -2350,8 +2462,6 @@ int iso_image_add_boot_image(IsoImage *image, const char *image_path,
|
|||||||
enum eltorito_boot_media_type type, int flag,
|
enum eltorito_boot_media_type type, int flag,
|
||||||
ElToritoBootImage **boot);
|
ElToritoBootImage **boot);
|
||||||
|
|
||||||
/* TODO #00026 : add support for "hidden" bootable images. */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the El-Torito boot catalog and the default boot image of an ISO image.
|
* Get the El-Torito boot catalog and the default boot image of an ISO image.
|
||||||
*
|
*
|
||||||
@ -2361,7 +2471,7 @@ int iso_image_add_boot_image(IsoImage *image, const char *image_path,
|
|||||||
* example, to prevent the user removing it.
|
* example, to prevent the user removing it.
|
||||||
*
|
*
|
||||||
* Both nodes are owned by libisofs and should not be freed. You can get your
|
* Both nodes are owned by libisofs and should not be freed. You can get your
|
||||||
* own ref with iso_node_ref(). You can can also check if the node is already
|
* own ref with iso_node_ref(). You can also check if the node is already
|
||||||
* on the tree by getting its parent (note that when reading El-Torito info
|
* on the tree by getting its parent (note that when reading El-Torito info
|
||||||
* from a previous image, the nodes might not be on the tree even if you haven't
|
* from a previous image, the nodes might not be on the tree even if you haven't
|
||||||
* removed them). Remember that you'll need to get a new ref
|
* removed them). Remember that you'll need to get a new ref
|
||||||
@ -2449,6 +2559,25 @@ void iso_image_remove_boot_image(IsoImage *image);
|
|||||||
*/
|
*/
|
||||||
int iso_image_set_boot_catalog_weight(IsoImage *image, int sort_weight);
|
int iso_image_set_boot_catalog_weight(IsoImage *image, int sort_weight);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hides the boot catalog file from directory trees.
|
||||||
|
*
|
||||||
|
* For the meaning of hiding files see iso_node_set_hidden().
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param image
|
||||||
|
* The image to manipulate.
|
||||||
|
* @param hide_attrs
|
||||||
|
* Or-combination of values from enum IsoHideNodeFlag to set the trees
|
||||||
|
* in which the record.
|
||||||
|
* @return
|
||||||
|
* 0= no boot catalog attached , 1= ok , <0 = error
|
||||||
|
*
|
||||||
|
* @since 0.6.34
|
||||||
|
*/
|
||||||
|
int iso_image_set_boot_catalog_hidden(IsoImage *image, int hide_attrs);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the boot media type as of parameter "type" of iso_image_set_boot_image()
|
* Get the boot media type as of parameter "type" of iso_image_set_boot_image()
|
||||||
* resp. iso_image_add_boot_image().
|
* resp. iso_image_add_boot_image().
|
||||||
@ -2641,6 +2770,8 @@ int el_torito_get_selection_crit(ElToritoBootImage *bootimg, uint8_t crit[20]);
|
|||||||
*
|
*
|
||||||
* @param bootimg
|
* @param bootimg
|
||||||
* The image to inquire
|
* The image to inquire
|
||||||
|
* @param flag
|
||||||
|
* Reserved for future usage, set to 0.
|
||||||
* @return
|
* @return
|
||||||
* 1 = seems to contain oot info table , 0 = quite surely not
|
* 1 = seems to contain oot info table , 0 = quite surely not
|
||||||
* @since 0.6.32
|
* @since 0.6.32
|
||||||
@ -2678,6 +2809,8 @@ int el_torito_seems_boot_info_table(ElToritoBootImage *bootimg, int flag);
|
|||||||
* For that you need isolinux.bin from SYSLINUX 3.72 or later.
|
* For that you need isolinux.bin from SYSLINUX 3.72 or later.
|
||||||
* IMPORTANT: The application has to take care that the image
|
* IMPORTANT: The application has to take care that the image
|
||||||
* on media gets padded up to the next full MB.
|
* on media gets padded up to the next full MB.
|
||||||
|
* @param bootimg
|
||||||
|
* The image to set options on
|
||||||
* @param flag
|
* @param flag
|
||||||
* Reserved for future usage, set to 0.
|
* Reserved for future usage, set to 0.
|
||||||
* @return
|
* @return
|
||||||
@ -2819,6 +2952,10 @@ int iso_node_remove_xinfo(IsoNode *node, iso_node_xinfo_func proc);
|
|||||||
* Get the given extended info (defined by the proc function) from the
|
* Get the given extended info (defined by the proc function) from the
|
||||||
* given node.
|
* given node.
|
||||||
*
|
*
|
||||||
|
* @param node
|
||||||
|
* The node to inquire
|
||||||
|
* @param proc
|
||||||
|
* The function pointer which serves as key
|
||||||
* @param data
|
* @param data
|
||||||
* Will be filled with the extended info corresponding to the given proc
|
* Will be filled with the extended info corresponding to the given proc
|
||||||
* function
|
* function
|
||||||
@ -2861,6 +2998,8 @@ const char *iso_node_get_name(const IsoNode *node);
|
|||||||
* Set the permissions for the node. This attribute is only useful when
|
* Set the permissions for the node. This attribute is only useful when
|
||||||
* Rock Ridge extensions are enabled.
|
* Rock Ridge extensions are enabled.
|
||||||
*
|
*
|
||||||
|
* @param node
|
||||||
|
* The node to change
|
||||||
* @param mode
|
* @param mode
|
||||||
* bitmask with the permissions of the node, as specified in 'man 2 stat'.
|
* bitmask with the permissions of the node, as specified in 'man 2 stat'.
|
||||||
* The file type bitfields will be ignored, only file permissions will be
|
* The file type bitfields will be ignored, only file permissions will be
|
||||||
@ -2958,26 +3097,40 @@ void iso_node_set_ctime(IsoNode *node, time_t time);
|
|||||||
time_t iso_node_get_ctime(const IsoNode *node);
|
time_t iso_node_get_ctime(const IsoNode *node);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set if the node will be hidden in RR/ISO tree, Joliet tree or both.
|
* Set whether the node will be hidden in the directory trees of RR/ISO 9660,
|
||||||
|
* or of Joliet (if enabled at all), or of ISO-9660:1999 (if enabled at all).
|
||||||
*
|
*
|
||||||
* If the file is set as hidden in one tree, it wil not be included there, so
|
* A hidden file does not show up by name in the affected directory tree.
|
||||||
* it won't be visible in a OS accessing CD using that tree. For example,
|
* For example, if a file is hidden only in Joliet, it will normally
|
||||||
* GNU/Linux systems access to Rock Ridge / ISO9960 tree in order to see
|
* not be visible on Windows systems, while being shown on GNU/Linux.
|
||||||
* what is recorded on CD, while MS Windows make use of the Joliet tree. If a
|
|
||||||
* file is hidden only in Joliet, it wil not be visible in Windows systems,
|
|
||||||
* while still visible in GNU/Linux.
|
|
||||||
*
|
*
|
||||||
* If a file is hidden in both trees, it will not be written to image.
|
* If a file is not shown in any of the enabled trees, then its content will
|
||||||
|
* not be written to the image, unless LIBISO_HIDE_BUT_WRITE is given (which
|
||||||
|
* is available only since release 0.6.34).
|
||||||
*
|
*
|
||||||
* @param node
|
* @param node
|
||||||
* The node that is to be hidden.
|
* The node that is to be hidden.
|
||||||
* @param hide_attrs
|
* @param hide_attrs
|
||||||
* IsoHideNodeFlag's to set the trees in which file will be hidden.
|
* Or-combination of values from enum IsoHideNodeFlag to set the trees
|
||||||
|
* in which the node's name shall be hidden.
|
||||||
*
|
*
|
||||||
* @since 0.6.2
|
* @since 0.6.2
|
||||||
*/
|
*/
|
||||||
void iso_node_set_hidden(IsoNode *node, int hide_attrs);
|
void iso_node_set_hidden(IsoNode *node, int hide_attrs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the hide_attrs as eventually set by iso_node_set_hidden().
|
||||||
|
*
|
||||||
|
* @param node
|
||||||
|
* The node to inquire.
|
||||||
|
* @return
|
||||||
|
* Or-combination of values from enum IsoHideNodeFlag which are
|
||||||
|
* currently set for the node.
|
||||||
|
*
|
||||||
|
* @since 0.6.34
|
||||||
|
*/
|
||||||
|
int iso_node_get_hidden(IsoNode *node);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compare two nodes whether they are based on the same input and
|
* Compare two nodes whether they are based on the same input and
|
||||||
* can be considered as hardlinks to the same file objects.
|
* can be considered as hardlinks to the same file objects.
|
||||||
@ -3407,6 +3560,8 @@ const char *iso_symlink_get_dest(const IsoSymlink *link);
|
|||||||
/**
|
/**
|
||||||
* Set the destination of a link.
|
* Set the destination of a link.
|
||||||
*
|
*
|
||||||
|
* @param opts
|
||||||
|
* The option set to be manipulated
|
||||||
* @param dest
|
* @param dest
|
||||||
* New destination for the link. It must be a non-empty string, otherwise
|
* New destination for the link. It must be a non-empty string, otherwise
|
||||||
* this function doesn't modify previous destination.
|
* this function doesn't modify previous destination.
|
||||||
@ -3675,8 +3830,13 @@ void iso_tree_set_follow_symlinks(IsoImage *image, int follow);
|
|||||||
int iso_tree_get_follow_symlinks(IsoImage *image);
|
int iso_tree_get_follow_symlinks(IsoImage *image);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set whether to skip or not hidden files when adding a directory recursibely.
|
* Set whether to skip or not disk files with names beginning by '.'
|
||||||
* Default behavior is to not ignore them, i.e., to add hidden files to image.
|
* when adding a directory recursively.
|
||||||
|
* Default behavior is to not ignore them.
|
||||||
|
*
|
||||||
|
* Clarification: This is not related to the IsoNode property to be hidden
|
||||||
|
* in one or more of the resulting image trees as of
|
||||||
|
* IsoHideNodeFlag and iso_node_set_hidden().
|
||||||
*
|
*
|
||||||
* @since 0.6.2
|
* @since 0.6.2
|
||||||
*/
|
*/
|
||||||
@ -3709,9 +3869,11 @@ enum iso_replace_mode iso_tree_get_replace_mode(IsoImage *image);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set whether to skip or not special files. Default behavior is to not skip
|
* Set whether to skip or not special files. Default behavior is to not skip
|
||||||
* them. Note that, despite of this setting, special files won't never be added
|
* them. Note that, despite of this setting, special files will never be added
|
||||||
* to an image unless RR extensions were enabled.
|
* to an image unless RR extensions were enabled.
|
||||||
*
|
*
|
||||||
|
* @param image
|
||||||
|
* The image to manipulate.
|
||||||
* @param skip
|
* @param skip
|
||||||
* Bitmask to determine what kind of special files will be skipped:
|
* Bitmask to determine what kind of special files will be skipped:
|
||||||
* bit0: ignore FIFOs
|
* bit0: ignore FIFOs
|
||||||
@ -3799,6 +3961,8 @@ int iso_tree_remove_exclude(IsoImage *image, const char *path);
|
|||||||
* added to the given image by a recursive addition function. This includes
|
* added to the given image by a recursive addition function. This includes
|
||||||
* image import.
|
* image import.
|
||||||
*
|
*
|
||||||
|
* @param image
|
||||||
|
* The image to manipulate.
|
||||||
* @param report
|
* @param report
|
||||||
* pointer to a function that will be called just before a file will be
|
* pointer to a function that will be called just before a file will be
|
||||||
* added to the image. You can control whether the file will be in fact
|
* added to the image. You can control whether the file will be in fact
|
||||||
@ -3927,7 +4091,7 @@ int iso_tree_add_new_cut_out_node(IsoImage *image, IsoDir *parent,
|
|||||||
* TODO comment Builder and Filesystem related issues when exposing both
|
* TODO comment Builder and Filesystem related issues when exposing both
|
||||||
*
|
*
|
||||||
* @param image
|
* @param image
|
||||||
* The image to which the directory belong.
|
* The image to which the directory belongs.
|
||||||
* @param parent
|
* @param parent
|
||||||
* Directory on the image tree where to add the contents of the dir
|
* Directory on the image tree where to add the contents of the dir
|
||||||
* @param dir
|
* @param dir
|
||||||
@ -3942,6 +4106,8 @@ int iso_tree_add_dir_rec(IsoImage *image, IsoDir *parent, const char *dir);
|
|||||||
/**
|
/**
|
||||||
* Locate a node by its absolute path on image.
|
* Locate a node by its absolute path on image.
|
||||||
*
|
*
|
||||||
|
* @param image
|
||||||
|
* The image to which the node belongs.
|
||||||
* @param node
|
* @param node
|
||||||
* Location for a pointer to the node, it will filled with NULL if the
|
* Location for a pointer to the node, it will filled with NULL if the
|
||||||
* given path does not exists on image.
|
* given path does not exists on image.
|
||||||
@ -4049,6 +4215,8 @@ int iso_set_msgs_severities(char *queue_severity, char *print_severity,
|
|||||||
* "NOTE", "UPDATE", "DEBUG", "ALL". To call with minimum_severity "NEVER"
|
* "NOTE", "UPDATE", "DEBUG", "ALL". To call with minimum_severity "NEVER"
|
||||||
* will discard the whole queue.
|
* will discard the whole queue.
|
||||||
*
|
*
|
||||||
|
* @param minimum_severity
|
||||||
|
* Threshhold
|
||||||
* @param error_code
|
* @param error_code
|
||||||
* Will become a unique error code as listed at the end of this header
|
* Will become a unique error code as listed at the end of this header
|
||||||
* @param imgid
|
* @param imgid
|
||||||
@ -4359,6 +4527,8 @@ int iso_file_source_read(IsoFileSource *src, void *buf, size_t count);
|
|||||||
* Repositions the offset of the given IsoFileSource (must be opened) to the
|
* Repositions the offset of the given IsoFileSource (must be opened) to the
|
||||||
* given offset according to the value of flag.
|
* given offset according to the value of flag.
|
||||||
*
|
*
|
||||||
|
* @param src
|
||||||
|
* The given source
|
||||||
* @param offset
|
* @param offset
|
||||||
* in bytes
|
* in bytes
|
||||||
* @param flag
|
* @param flag
|
||||||
@ -4377,7 +4547,7 @@ off_t iso_file_source_lseek(IsoFileSource *src, off_t offset, int flag);
|
|||||||
/**
|
/**
|
||||||
* Read a directory.
|
* Read a directory.
|
||||||
*
|
*
|
||||||
* Each call to this function will return a new children, until we reach
|
* Each call to this function will return a new child, until we reach
|
||||||
* the end of file (i.e, no more children), in that case it returns 0.
|
* the end of file (i.e, no more children), in that case it returns 0.
|
||||||
*
|
*
|
||||||
* The dir must be open() before calling this, and close() when no more
|
* The dir must be open() before calling this, and close() when no more
|
||||||
@ -4385,6 +4555,8 @@ off_t iso_file_source_lseek(IsoFileSource *src, off_t offset, int flag);
|
|||||||
*
|
*
|
||||||
* Note that "." and ".." children MUST NOT BE returned.
|
* Note that "." and ".." children MUST NOT BE returned.
|
||||||
*
|
*
|
||||||
|
* @param src
|
||||||
|
* The given source
|
||||||
* @param child
|
* @param child
|
||||||
* pointer to be filled with the given child. Undefined on error or OEF
|
* pointer to be filled with the given child. Undefined on error or OEF
|
||||||
* @return
|
* @return
|
||||||
@ -4411,7 +4583,7 @@ int iso_file_source_readdir(IsoFileSource *src, IsoFileSource **child);
|
|||||||
* The dest. will be copied there, and it will be NULL-terminated
|
* The dest. will be copied there, and it will be NULL-terminated
|
||||||
* @param bufsiz
|
* @param bufsiz
|
||||||
* characters to be copied. Destination link will be truncated if
|
* characters to be copied. Destination link will be truncated if
|
||||||
* it is larger than given size. This include the '\0' character.
|
* it is larger than given size. This includes the 0x0 character.
|
||||||
* @return
|
* @return
|
||||||
* 1 on success, < 0 on error
|
* 1 on success, < 0 on error
|
||||||
* Error codes:
|
* Error codes:
|
||||||
@ -5710,6 +5882,10 @@ int iso_md5_match(char first_md5[16], char second_md5[16]);
|
|||||||
/** Too many boot images (FAILURE,HIGH, -69) */
|
/** Too many boot images (FAILURE,HIGH, -69) */
|
||||||
#define ISO_BOOT_IMAGE_OVERFLOW 0xE830FFBA
|
#define ISO_BOOT_IMAGE_OVERFLOW 0xE830FFBA
|
||||||
|
|
||||||
|
/** No boot catalog created yet ((FAILURE,HIGH, -70) */ /* @since 0.6.34 */
|
||||||
|
#define ISO_BOOT_NO_CATALOG 0xE830FFB9
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error on file operation (FAILURE,HIGH, -128)
|
* Error on file operation (FAILURE,HIGH, -128)
|
||||||
* (take a look at more specified error codes below)
|
* (take a look at more specified error codes below)
|
||||||
@ -5952,8 +6128,35 @@ int iso_md5_match(char first_md5[16], char second_md5[16]);
|
|||||||
*/
|
*/
|
||||||
#define ISO_SCDBACKUP_TAG_NOT_0 0xD030FE99
|
#define ISO_SCDBACKUP_TAG_NOT_0 0xD030FE99
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The setting of iso_write_opts_set_ms_block() leaves not enough room
|
||||||
|
* for the prescibed size of iso_write_opts_set_overwrite_buf().
|
||||||
|
* (FAILURE, HIGH, -360)
|
||||||
|
* @since 0.6.36
|
||||||
|
*/
|
||||||
|
#define ISO_OVWRT_MS_TOO_SMALL 0xE830FE98
|
||||||
|
|
||||||
/* ! PLACE NEW ERROR CODES HERE ! */
|
/**
|
||||||
|
* The partition offset is not 0 and leaves not not enough room for
|
||||||
|
* system area, volume descriptors, and checksum tags of the first tree.
|
||||||
|
* (FAILURE, HIGH, -361)
|
||||||
|
*/
|
||||||
|
#define ISO_PART_OFFST_TOO_SMALL 0xE830FE97
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ring buffer is smaller than 64 kB + partition offset.
|
||||||
|
* (FAILURE, HIGH, -362)
|
||||||
|
*/
|
||||||
|
#define ISO_OVWRT_FIFO_TOO_SMALL 0xE830FE96
|
||||||
|
|
||||||
|
|
||||||
|
/* Internal developer note:
|
||||||
|
Place new error codes directly above this comment.
|
||||||
|
Newly introduced errors must get a message entry in
|
||||||
|
libisofs/message.c, function iso_error_to_msg()
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* ! PLACE NEW ERROR CODES ABOVE. NOT AFTER THIS LINE ! */
|
||||||
|
|
||||||
|
|
||||||
/** Read error occured with IsoDataSource (SORRY,HIGH, -513) */
|
/** Read error occured with IsoDataSource (SORRY,HIGH, -513) */
|
||||||
@ -5969,7 +6172,7 @@ int iso_md5_match(char first_md5[16], char second_md5[16]);
|
|||||||
#define ISO_DATA_SOURCE_FATAL 0xF030FCFF
|
#define ISO_DATA_SOURCE_FATAL 0xF030FCFF
|
||||||
|
|
||||||
|
|
||||||
/* ! PLACE NEW ERROR CODES ABOVE. NOT HERE ! */
|
/* ! PLACE NEW ERROR CODES SEVERAL LINES ABOVE. NOT HERE ! */
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
@ -6160,13 +6363,7 @@ struct burn_source {
|
|||||||
|
|
||||||
/* ---------------------------- Improvements --------------------------- */
|
/* ---------------------------- Improvements --------------------------- */
|
||||||
|
|
||||||
|
/* currently none being tested */
|
||||||
/* Checksums : During image writing equip IsoFile objects with MD5 checksums
|
|
||||||
and compute an overall checksum of the session. Store them in
|
|
||||||
a separate checksum block area after the data area of the
|
|
||||||
session.
|
|
||||||
*/
|
|
||||||
#define Libisofs_with_checksumS yes
|
|
||||||
|
|
||||||
|
|
||||||
/* ---------------------------- Experiments ---------------------------- */
|
/* ---------------------------- Experiments ---------------------------- */
|
||||||
|
291
libisofs/libisofs.ver
Normal file
291
libisofs/libisofs.ver
Normal file
@ -0,0 +1,291 @@
|
|||||||
|
LIBISOFS6 {
|
||||||
|
global:
|
||||||
|
aaip_xinfo_func;
|
||||||
|
el_torito_get_bootable;
|
||||||
|
el_torito_get_boot_media_type;
|
||||||
|
el_torito_get_boot_platform_id;
|
||||||
|
el_torito_get_id_string;
|
||||||
|
el_torito_get_isolinux_options;
|
||||||
|
el_torito_get_load_seg;
|
||||||
|
el_torito_get_load_size;
|
||||||
|
el_torito_get_selection_crit;
|
||||||
|
el_torito_patch_isolinux_image;
|
||||||
|
el_torito_seems_boot_info_table;
|
||||||
|
el_torito_set_boot_platform_id;
|
||||||
|
el_torito_set_id_string;
|
||||||
|
el_torito_set_isolinux_options;
|
||||||
|
el_torito_set_load_seg;
|
||||||
|
el_torito_set_load_size;
|
||||||
|
el_torito_set_no_bootable;
|
||||||
|
el_torito_set_selection_crit;
|
||||||
|
iso_data_source_new_from_file;
|
||||||
|
iso_data_source_ref;
|
||||||
|
iso_data_source_unref;
|
||||||
|
iso_dir_add_node;
|
||||||
|
iso_dir_find_children;
|
||||||
|
iso_dir_get_children;
|
||||||
|
iso_dir_get_children_count;
|
||||||
|
iso_dir_get_node;
|
||||||
|
iso_dir_iter_free;
|
||||||
|
iso_dir_iter_has_next;
|
||||||
|
iso_dir_iter_next;
|
||||||
|
iso_dir_iter_remove;
|
||||||
|
iso_dir_iter_take;
|
||||||
|
iso_error_get_code;
|
||||||
|
iso_error_get_priority;
|
||||||
|
iso_error_get_severity;
|
||||||
|
iso_error_to_msg;
|
||||||
|
iso_file_add_external_filter;
|
||||||
|
iso_file_add_gzip_filter;
|
||||||
|
iso_file_add_zisofs_filter;
|
||||||
|
iso_file_get_md5;
|
||||||
|
iso_file_get_old_image_lba;
|
||||||
|
iso_file_get_old_image_sections;
|
||||||
|
iso_file_get_size;
|
||||||
|
iso_file_get_sort_weight;
|
||||||
|
iso_file_get_stream;
|
||||||
|
iso_file_make_md5;
|
||||||
|
iso_file_remove_filter;
|
||||||
|
iso_file_source_access;
|
||||||
|
iso_file_source_close;
|
||||||
|
iso_file_source_get_aa_string;
|
||||||
|
iso_file_source_get_filesystem;
|
||||||
|
iso_file_source_get_name;
|
||||||
|
iso_file_source_get_path;
|
||||||
|
iso_file_source_lseek;
|
||||||
|
iso_file_source_lstat;
|
||||||
|
iso_file_source_open;
|
||||||
|
iso_file_source_read;
|
||||||
|
iso_file_source_readdir;
|
||||||
|
iso_file_source_readlink;
|
||||||
|
iso_file_source_ref;
|
||||||
|
iso_file_source_stat;
|
||||||
|
iso_file_source_unref;
|
||||||
|
iso_filesystem_ref;
|
||||||
|
iso_filesystem_unref;
|
||||||
|
iso_finish;
|
||||||
|
iso_get_local_charset;
|
||||||
|
iso_get_messenger;
|
||||||
|
iso_gzip_get_refcounts;
|
||||||
|
iso_image_add_boot_image;
|
||||||
|
iso_image_attach_data;
|
||||||
|
iso_image_create_burn_source;
|
||||||
|
iso_image_filesystem_new;
|
||||||
|
iso_image_fs_get_abstract_file_id;
|
||||||
|
iso_image_fs_get_application_id;
|
||||||
|
iso_image_fs_get_biblio_file_id;
|
||||||
|
iso_image_fs_get_copyright_file_id;
|
||||||
|
iso_image_fs_get_data_preparer_id;
|
||||||
|
iso_image_fs_get_publisher_id;
|
||||||
|
iso_image_fs_get_system_id;
|
||||||
|
iso_image_fs_get_volset_id;
|
||||||
|
iso_image_fs_get_volume_id;
|
||||||
|
iso_image_get_abstract_file_id;
|
||||||
|
iso_image_get_all_boot_imgs;
|
||||||
|
iso_image_get_application_id;
|
||||||
|
iso_image_get_attached_data;
|
||||||
|
iso_image_get_biblio_file_id;
|
||||||
|
iso_image_get_boot_image;
|
||||||
|
iso_image_get_copyright_file_id;
|
||||||
|
iso_image_get_data_preparer_id;
|
||||||
|
iso_image_get_msg_id;
|
||||||
|
iso_image_get_publisher_id;
|
||||||
|
iso_image_get_root;
|
||||||
|
iso_image_get_session_md5;
|
||||||
|
iso_image_get_system_area;
|
||||||
|
iso_image_get_system_id;
|
||||||
|
iso_image_get_volset_id;
|
||||||
|
iso_image_get_volume_id;
|
||||||
|
iso_image_import;
|
||||||
|
iso_image_new;
|
||||||
|
iso_image_ref;
|
||||||
|
iso_image_remove_boot_image;
|
||||||
|
iso_image_set_abstract_file_id;
|
||||||
|
iso_image_set_application_id;
|
||||||
|
iso_image_set_biblio_file_id;
|
||||||
|
iso_image_set_boot_catalog_hidden;
|
||||||
|
iso_image_set_boot_catalog_weight;
|
||||||
|
iso_image_set_boot_image;
|
||||||
|
iso_image_set_copyright_file_id;
|
||||||
|
iso_image_set_data_preparer_id;
|
||||||
|
iso_image_set_ignore_aclea;
|
||||||
|
iso_image_set_publisher_id;
|
||||||
|
iso_image_set_system_id;
|
||||||
|
iso_image_set_volset_id;
|
||||||
|
iso_image_set_volume_id;
|
||||||
|
iso_image_unref;
|
||||||
|
iso_image_update_sizes;
|
||||||
|
iso_init;
|
||||||
|
iso_init_with_flag;
|
||||||
|
iso_lib_is_compatible;
|
||||||
|
iso_lib_version;
|
||||||
|
iso_local_get_acl_text;
|
||||||
|
iso_local_get_attrs;
|
||||||
|
iso_local_get_perms_wo_acl;
|
||||||
|
iso_local_set_acl_text;
|
||||||
|
iso_local_set_attrs;
|
||||||
|
iso_md5_clone;
|
||||||
|
iso_md5_compute;
|
||||||
|
iso_md5_end;
|
||||||
|
iso_md5_match;
|
||||||
|
iso_md5_start;
|
||||||
|
iso_msgs_submit;
|
||||||
|
iso_new_find_conditions_and;
|
||||||
|
iso_new_find_conditions_atime;
|
||||||
|
iso_new_find_conditions_ctime;
|
||||||
|
iso_new_find_conditions_gid;
|
||||||
|
iso_new_find_conditions_mode;
|
||||||
|
iso_new_find_conditions_mtime;
|
||||||
|
iso_new_find_conditions_name;
|
||||||
|
iso_new_find_conditions_not;
|
||||||
|
iso_new_find_conditions_or;
|
||||||
|
iso_new_find_conditions_uid;
|
||||||
|
iso_node_add_xinfo;
|
||||||
|
iso_node_cmp_ino;
|
||||||
|
iso_node_get_acl_text;
|
||||||
|
iso_node_get_atime;
|
||||||
|
iso_node_get_attrs;
|
||||||
|
iso_node_get_ctime;
|
||||||
|
iso_node_get_gid;
|
||||||
|
iso_node_get_hidden;
|
||||||
|
iso_node_get_mode;
|
||||||
|
iso_node_get_mtime;
|
||||||
|
iso_node_get_name;
|
||||||
|
iso_node_get_old_image_lba;
|
||||||
|
iso_node_get_parent;
|
||||||
|
iso_node_get_permissions;
|
||||||
|
iso_node_get_perms_wo_acl;
|
||||||
|
iso_node_get_type;
|
||||||
|
iso_node_get_uid;
|
||||||
|
iso_node_get_xinfo;
|
||||||
|
iso_node_lookup_attr;
|
||||||
|
iso_node_ref;
|
||||||
|
iso_node_remove;
|
||||||
|
iso_node_remove_xinfo;
|
||||||
|
iso_node_set_acl_text;
|
||||||
|
iso_node_set_atime;
|
||||||
|
iso_node_set_attrs;
|
||||||
|
iso_node_set_ctime;
|
||||||
|
iso_node_set_gid;
|
||||||
|
iso_node_set_hidden;
|
||||||
|
iso_node_set_mtime;
|
||||||
|
iso_node_set_name;
|
||||||
|
iso_node_set_permissions;
|
||||||
|
iso_node_set_sort_weight;
|
||||||
|
iso_node_set_uid;
|
||||||
|
iso_node_take;
|
||||||
|
iso_node_unref;
|
||||||
|
iso_node_zf_by_magic;
|
||||||
|
iso_obtain_msgs;
|
||||||
|
iso_read_image_features_destroy;
|
||||||
|
iso_read_image_features_get_size;
|
||||||
|
iso_read_image_features_has_eltorito;
|
||||||
|
iso_read_image_features_has_iso1999;
|
||||||
|
iso_read_image_features_has_joliet;
|
||||||
|
iso_read_image_features_has_rockridge;
|
||||||
|
iso_read_opts_auto_input_charset;
|
||||||
|
iso_read_opts_free;
|
||||||
|
iso_read_opts_load_system_area;
|
||||||
|
iso_read_opts_new;
|
||||||
|
iso_read_opts_set_default_gid;
|
||||||
|
iso_read_opts_set_default_permissions;
|
||||||
|
iso_read_opts_set_default_uid;
|
||||||
|
iso_read_opts_set_input_charset;
|
||||||
|
iso_read_opts_set_new_inos;
|
||||||
|
iso_read_opts_set_no_aaip;
|
||||||
|
iso_read_opts_set_no_iso1999;
|
||||||
|
iso_read_opts_set_no_joliet;
|
||||||
|
iso_read_opts_set_no_md5;
|
||||||
|
iso_read_opts_set_no_rockridge;
|
||||||
|
iso_read_opts_set_preferjoliet;
|
||||||
|
iso_read_opts_set_start_block;
|
||||||
|
iso_ring_buffer_get_status;
|
||||||
|
iso_set_abort_severity;
|
||||||
|
iso_set_local_charset;
|
||||||
|
iso_set_msgs_severities;
|
||||||
|
iso_sev_to_text;
|
||||||
|
iso_special_get_dev;
|
||||||
|
iso_stream_close;
|
||||||
|
iso_stream_cmp_ino;
|
||||||
|
iso_stream_get_external_filter;
|
||||||
|
iso_stream_get_id;
|
||||||
|
iso_stream_get_input_stream;
|
||||||
|
iso_stream_get_size;
|
||||||
|
iso_stream_get_source_path;
|
||||||
|
iso_stream_is_repeatable;
|
||||||
|
iso_stream_open;
|
||||||
|
iso_stream_read;
|
||||||
|
iso_stream_ref;
|
||||||
|
iso_stream_unref;
|
||||||
|
iso_stream_update_size;
|
||||||
|
iso_symlink_get_dest;
|
||||||
|
iso_symlink_set_dest;
|
||||||
|
iso_text_to_sev;
|
||||||
|
iso_tree_add_dir_rec;
|
||||||
|
iso_tree_add_exclude;
|
||||||
|
iso_tree_add_new_cut_out_node;
|
||||||
|
iso_tree_add_new_dir;
|
||||||
|
iso_tree_add_new_file;
|
||||||
|
iso_tree_add_new_node;
|
||||||
|
iso_tree_add_new_special;
|
||||||
|
iso_tree_add_new_symlink;
|
||||||
|
iso_tree_add_node;
|
||||||
|
iso_tree_get_follow_symlinks;
|
||||||
|
iso_tree_get_ignore_hidden;
|
||||||
|
iso_tree_get_ignore_special;
|
||||||
|
iso_tree_get_node_path;
|
||||||
|
iso_tree_get_replace_mode;
|
||||||
|
iso_tree_path_to_node;
|
||||||
|
iso_tree_remove_exclude;
|
||||||
|
iso_tree_set_follow_symlinks;
|
||||||
|
iso_tree_set_ignore_hidden;
|
||||||
|
iso_tree_set_ignore_special;
|
||||||
|
iso_tree_set_replace_mode;
|
||||||
|
iso_tree_set_report_callback;
|
||||||
|
iso_util_decode_md5_tag;
|
||||||
|
iso_write_opts_free;
|
||||||
|
iso_write_opts_get_data_start;
|
||||||
|
iso_write_opts_new;
|
||||||
|
iso_write_opts_set_aaip;
|
||||||
|
iso_write_opts_set_aaip_susp_1_10;
|
||||||
|
iso_write_opts_set_allow_deep_paths;
|
||||||
|
iso_write_opts_set_allow_full_ascii;
|
||||||
|
iso_write_opts_set_allow_longer_paths;
|
||||||
|
iso_write_opts_set_allow_lowercase;
|
||||||
|
iso_write_opts_set_always_gmt;
|
||||||
|
iso_write_opts_set_appendable;
|
||||||
|
iso_write_opts_set_default_dir_mode;
|
||||||
|
iso_write_opts_set_default_file_mode;
|
||||||
|
iso_write_opts_set_default_gid;
|
||||||
|
iso_write_opts_set_default_timestamp;
|
||||||
|
iso_write_opts_set_default_uid;
|
||||||
|
iso_write_opts_set_dir_rec_mtime;
|
||||||
|
iso_write_opts_set_fifo_size;
|
||||||
|
iso_write_opts_set_hardlinks;
|
||||||
|
iso_write_opts_set_iso1999;
|
||||||
|
iso_write_opts_set_iso_level;
|
||||||
|
iso_write_opts_set_joliet;
|
||||||
|
iso_write_opts_set_joliet_longer_paths;
|
||||||
|
iso_write_opts_set_max_37_char_filenames;
|
||||||
|
iso_write_opts_set_ms_block;
|
||||||
|
iso_write_opts_set_no_force_dots;
|
||||||
|
iso_write_opts_set_omit_version_numbers;
|
||||||
|
iso_write_opts_set_output_charset;
|
||||||
|
iso_write_opts_set_overwrite_buf;
|
||||||
|
iso_write_opts_set_part_offset;
|
||||||
|
iso_write_opts_set_pvd_times;
|
||||||
|
iso_write_opts_set_record_md5;
|
||||||
|
iso_write_opts_set_relaxed_vol_atts;
|
||||||
|
iso_write_opts_set_replace_mode;
|
||||||
|
iso_write_opts_set_replace_timestamps;
|
||||||
|
iso_write_opts_set_rockridge;
|
||||||
|
iso_write_opts_set_rrip_1_10_px_ino;
|
||||||
|
iso_write_opts_set_rrip_version_1_10;
|
||||||
|
iso_write_opts_set_scdbackup_tag;
|
||||||
|
iso_write_opts_set_sort_files;
|
||||||
|
iso_write_opts_set_system_area;
|
||||||
|
iso_zisofs_get_params;
|
||||||
|
iso_zisofs_get_refcounts;
|
||||||
|
iso_zisofs_set_params;
|
||||||
|
local: *;
|
||||||
|
};
|
@ -1,3 +1,8 @@
|
|||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -8,6 +8,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -430,8 +434,6 @@ int checksum_md5_xinfo_func(void *data, int flag)
|
|||||||
|
|
||||||
/* MD5 checksum image writer */
|
/* MD5 checksum image writer */
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@flag bit0= recursion
|
@flag bit0= recursion
|
||||||
bit1= session will be appended to an existing image
|
bit1= session will be appended to an existing image
|
||||||
@ -508,15 +510,10 @@ int checksum_copy_old_nodes(Ecma119Image *target, IsoNode *node, int flag)
|
|||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
int checksum_writer_compute_data_blocks(IsoImageWriter *writer)
|
int checksum_writer_compute_data_blocks(IsoImageWriter *writer)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
size_t size;
|
size_t size;
|
||||||
Ecma119Image *t;
|
Ecma119Image *t;
|
||||||
int ret;
|
int ret;
|
||||||
@ -557,9 +554,6 @@ int checksum_writer_compute_data_blocks(IsoImageWriter *writer)
|
|||||||
t->checksum_idx_counter + 2, 16, "MD5", 0);
|
t->checksum_idx_counter + 2, 16, "MD5", 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -580,9 +574,6 @@ int checksum_writer_write_vol_desc(IsoImageWriter *writer)
|
|||||||
static
|
static
|
||||||
int checksum_writer_write_data(IsoImageWriter *writer)
|
int checksum_writer_write_data(IsoImageWriter *writer)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
int wres, res;
|
int wres, res;
|
||||||
size_t i, size;
|
size_t i, size;
|
||||||
Ecma119Image *t;
|
Ecma119Image *t;
|
||||||
@ -649,12 +640,6 @@ ex:;
|
|||||||
if (ctx != NULL)
|
if (ctx != NULL)
|
||||||
iso_md5_end(&ctx, md5);
|
iso_md5_end(&ctx, md5);
|
||||||
return(res);
|
return(res);
|
||||||
|
|
||||||
#else /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
return ISO_SUCCESS;
|
|
||||||
|
|
||||||
#endif /* ! Libisofs_with_checksumS */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -684,17 +669,11 @@ int checksum_writer_create(Ecma119Image *target)
|
|||||||
|
|
||||||
/* add this writer to image */
|
/* add this writer to image */
|
||||||
target->writers[target->nwriters++] = writer;
|
target->writers[target->nwriters++] = writer;
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
/* Account for superblock checksum tag */
|
/* Account for superblock checksum tag */
|
||||||
if (target->md5_session_checksum) {
|
if (target->md5_session_checksum) {
|
||||||
target->checksum_sb_tag_pos = target->curblock;
|
target->checksum_sb_tag_pos = target->curblock;
|
||||||
target->curblock++;
|
target->curblock++;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -702,9 +681,6 @@ int checksum_writer_create(Ecma119Image *target)
|
|||||||
static
|
static
|
||||||
int iso_md5_write_scdbackup_tag(Ecma119Image *t, char *tag_block, int flag)
|
int iso_md5_write_scdbackup_tag(Ecma119Image *t, char *tag_block, int flag)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
void *ctx = NULL;
|
void *ctx = NULL;
|
||||||
off_t pos = 0, line_start;
|
off_t pos = 0, line_start;
|
||||||
int record_len, block_len, res, i;
|
int record_len, block_len, res, i;
|
||||||
@ -753,12 +729,6 @@ ex:;
|
|||||||
if (ctx != NULL)
|
if (ctx != NULL)
|
||||||
iso_md5_end(&ctx, md5);
|
iso_md5_end(&ctx, md5);
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
return ISO_SUCCESS;
|
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -772,9 +742,6 @@ ex:;
|
|||||||
*/
|
*/
|
||||||
int iso_md5_write_tag(Ecma119Image *t, int flag)
|
int iso_md5_write_tag(Ecma119Image *t, int flag)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
int res, mode, l, i, wres, tag_id_len;
|
int res, mode, l, i, wres, tag_id_len;
|
||||||
void *ctx = NULL;
|
void *ctx = NULL;
|
||||||
char md5[16], tag_block[2048], *tag_id;
|
char md5[16], tag_block[2048], *tag_id;
|
||||||
@ -863,13 +830,6 @@ ex:;
|
|||||||
if (ctx != NULL)
|
if (ctx != NULL)
|
||||||
iso_md5_end(&ctx, md5);
|
iso_md5_end(&ctx, md5);
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
#else /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
return ISO_SUCCESS;
|
|
||||||
|
|
||||||
#endif /* ! Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,6 +6,11 @@
|
|||||||
* or later as published by the Free Software Foundation.
|
* or later as published by the Free Software Foundation.
|
||||||
* See COPYING file for details.
|
* See COPYING file for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -279,6 +284,14 @@ const char *iso_error_to_msg(int errcode)
|
|||||||
return "Detected file content changes while it was written into the image";
|
return "Detected file content changes while it was written into the image";
|
||||||
case ISO_SCDBACKUP_TAG_NOT_0:
|
case ISO_SCDBACKUP_TAG_NOT_0:
|
||||||
return "Session does not start at LBA 0. scdbackup checksum tag not written.";
|
return "Session does not start at LBA 0. scdbackup checksum tag not written.";
|
||||||
|
case ISO_BOOT_NO_CATALOG:
|
||||||
|
return "No boot catalog created yet";
|
||||||
|
case ISO_OVWRT_MS_TOO_SMALL:
|
||||||
|
return "Multi-session offset too small for overwrite buffer";
|
||||||
|
case ISO_PART_OFFST_TOO_SMALL:
|
||||||
|
return "Partition offset too small for first tree root.";
|
||||||
|
case ISO_OVWRT_FIFO_TOO_SMALL:
|
||||||
|
return "The ring buffer is too small for overwrite buffer";
|
||||||
default:
|
default:
|
||||||
return "Unknown error";
|
return "Unknown error";
|
||||||
}
|
}
|
||||||
@ -419,8 +432,6 @@ int iso_obtain_msgs(char *minimum_severity, int *error_code, int *imgid,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ts A80222 : derived from libburn/init.c:burn_msgs_submit()
|
|
||||||
*/
|
|
||||||
int iso_msgs_submit(int error_code, char msg_text[], int os_errno,
|
int iso_msgs_submit(int error_code, char msg_text[], int os_errno,
|
||||||
char severity[], int origin)
|
char severity[], int origin)
|
||||||
{
|
{
|
||||||
@ -448,8 +459,6 @@ int iso_msgs_submit(int error_code, char msg_text[], int os_errno,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ts A80222 : derived from libburn/init.c:burn_text_to_sev()
|
|
||||||
*/
|
|
||||||
int iso_text_to_sev(char *severity_name, int *sevno)
|
int iso_text_to_sev(char *severity_name, int *sevno)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@ -461,8 +470,6 @@ int iso_text_to_sev(char *severity_name, int *sevno)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ts A80222 : derived from libburn/init.c:burn_sev_to_text()
|
|
||||||
*/
|
|
||||||
int iso_sev_to_text(int severity_number, char **severity_name)
|
int iso_sev_to_text(int severity_number, char **severity_name)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@ -501,7 +508,6 @@ int iso_error_get_code(int e)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ts A80222 */
|
|
||||||
int iso_report_errfile(char *path, int error_code, int os_errno, int flag)
|
int iso_report_errfile(char *path, int error_code, int os_errno, int flag)
|
||||||
{
|
{
|
||||||
libiso_msgs_submit(libiso_msgr, 0, error_code,
|
libiso_msgs_submit(libiso_msgr, 0, error_code,
|
||||||
|
@ -8,6 +8,10 @@
|
|||||||
* See COPYING file for details.
|
* See COPYING file for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "libisofs.h"
|
#include "libisofs.h"
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
@ -428,6 +432,12 @@ void iso_node_set_hidden(IsoNode *node, int hide_attrs)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int iso_node_get_hidden(IsoNode *node)
|
||||||
|
{
|
||||||
|
return node->hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new node to a dir. Note that this function don't add a new ref to
|
* Add a new node to a dir. Note that this function don't add a new ref to
|
||||||
* the node, so you don't need to free it, it will be automatically freed
|
* the node, so you don't need to free it, it will be automatically freed
|
||||||
@ -2660,9 +2670,6 @@ ex:;
|
|||||||
/* API */
|
/* API */
|
||||||
int iso_file_get_md5(IsoImage *image, IsoFile *file, char md5[16], int flag)
|
int iso_file_get_md5(IsoImage *image, IsoFile *file, char md5[16], int flag)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
int ret, i;
|
int ret, i;
|
||||||
size_t value_len;
|
size_t value_len;
|
||||||
char *value = NULL;
|
char *value = NULL;
|
||||||
@ -2702,21 +2709,12 @@ ex:;
|
|||||||
if (value != NULL)
|
if (value != NULL)
|
||||||
free(value);
|
free(value);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
#endif /* ! Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* API */
|
/* API */
|
||||||
int iso_file_make_md5(IsoFile *file, int flag)
|
int iso_file_make_md5(IsoFile *file, int flag)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
int ret, dig = 0;
|
int ret, dig = 0;
|
||||||
char *md5 = NULL;
|
char *md5 = NULL;
|
||||||
|
|
||||||
@ -2737,13 +2735,6 @@ int iso_file_make_md5(IsoFile *file, int flag)
|
|||||||
ret = 1;
|
ret = 1;
|
||||||
ex:;
|
ex:;
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
return ISO_ERROR;
|
|
||||||
|
|
||||||
#endif /* ! Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,6 +9,10 @@
|
|||||||
* See COPYING file for details.
|
* See COPYING file for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "rockridge.h"
|
#include "rockridge.h"
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
#include "ecma119_tree.h"
|
#include "ecma119_tree.h"
|
||||||
@ -180,7 +184,8 @@ int rrip_add_PL(Ecma119Image *t, Ecma119Node *n, struct susp_info *susp)
|
|||||||
PL[3] = 1;
|
PL[3] = 1;
|
||||||
|
|
||||||
/* write the location of the real parent, already computed */
|
/* write the location of the real parent, already computed */
|
||||||
iso_bb(&PL[4], n->info.dir->real_parent->info.dir->block, 4);
|
iso_bb(&PL[4],
|
||||||
|
n->info.dir->real_parent->info.dir->block - t->eff_partition_offset, 4);
|
||||||
return susp_append(t, susp, PL);
|
return susp_append(t, susp, PL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,7 +278,8 @@ int rrip_add_CL(Ecma119Image *t, Ecma119Node *n, struct susp_info *susp)
|
|||||||
CL[1] = 'L';
|
CL[1] = 'L';
|
||||||
CL[2] = 12;
|
CL[2] = 12;
|
||||||
CL[3] = 1;
|
CL[3] = 1;
|
||||||
iso_bb(&CL[4], n->info.real_me->info.dir->block, 4);
|
iso_bb(&CL[4], n->info.real_me->info.dir->block - t->eff_partition_offset,
|
||||||
|
4);
|
||||||
return susp_append(t, susp, CL);
|
return susp_append(t, susp, CL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -693,7 +699,8 @@ int susp_add_CE(Ecma119Image *t, size_t ce_len, struct susp_info *susp)
|
|||||||
CE[1] = 'E';
|
CE[1] = 'E';
|
||||||
CE[2] = 28;
|
CE[2] = 28;
|
||||||
CE[3] = 1;
|
CE[3] = 1;
|
||||||
iso_bb(&CE[4], susp->ce_block, 4);
|
|
||||||
|
iso_bb(&CE[4], susp->ce_block - t->eff_partition_offset, 4);
|
||||||
iso_bb(&CE[12], susp->ce_len, 4);
|
iso_bb(&CE[12], susp->ce_len, 4);
|
||||||
iso_bb(&CE[20], (uint32_t) ce_len, 4);
|
iso_bb(&CE[20], (uint32_t) ce_len, 4);
|
||||||
|
|
||||||
|
@ -13,6 +13,10 @@
|
|||||||
* Rock Ridge and AAIP extensions on an ECMA-119 image.
|
* Rock Ridge and AAIP extensions on an ECMA-119 image.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "libisofs.h"
|
#include "libisofs.h"
|
||||||
#include "ecma119.h"
|
#include "ecma119.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
@ -8,6 +8,10 @@
|
|||||||
* See COPYING file for details.
|
* See COPYING file for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "libisofs.h"
|
#include "libisofs.h"
|
||||||
#include "stream.h"
|
#include "stream.h"
|
||||||
#include "fsource.h"
|
#include "fsource.h"
|
||||||
@ -582,7 +586,7 @@ int iso_memory_stream_new(unsigned char *buf, size_t size, IsoStream **stream)
|
|||||||
return ISO_OUT_OF_MEM;
|
return ISO_OUT_OF_MEM;
|
||||||
}
|
}
|
||||||
data = malloc(sizeof(MemStreamData));
|
data = malloc(sizeof(MemStreamData));
|
||||||
if (str == NULL) {
|
if (data == NULL) {
|
||||||
free(str);
|
free(str);
|
||||||
return ISO_OUT_OF_MEM;
|
return ISO_OUT_OF_MEM;
|
||||||
}
|
}
|
||||||
@ -864,9 +868,6 @@ int iso_stream_read_buffer(IsoStream *stream, char *buf, size_t count,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Libisofs_with_checksumS
|
|
||||||
|
|
||||||
|
|
||||||
/* @param flag bit0= dig out most original stream (e.g. because from old image)
|
/* @param flag bit0= dig out most original stream (e.g. because from old image)
|
||||||
@return 1=ok, md5 is valid,
|
@return 1=ok, md5 is valid,
|
||||||
0= not ok,
|
0= not ok,
|
||||||
@ -923,6 +924,3 @@ ex:;
|
|||||||
iso_md5_end(&ctx, md5);
|
iso_md5_end(&ctx, md5);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Libisofs_with_checksumS */
|
|
||||||
|
|
||||||
|
@ -8,6 +8,10 @@
|
|||||||
* See COPYING file for details.
|
* See COPYING file for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "system_area.h"
|
#include "system_area.h"
|
||||||
#include "eltorito.h"
|
#include "eltorito.h"
|
||||||
#include "filesrc.h"
|
#include "filesrc.h"
|
||||||
@ -28,12 +32,42 @@ int make_isohybrid_mbr(int bin_lba, int *img_blocks, char *mbr, int flag);
|
|||||||
* Be cautious with changing parameters. Only few combinations are tested.
|
* Be cautious with changing parameters. Only few combinations are tested.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int make_isolinux_mbr(int32_t *img_blocks, uint32_t boot_lba,
|
int make_isolinux_mbr(uint32_t *img_blocks, uint32_t boot_lba,
|
||||||
uint32_t mbr_id, int head_count, int sector_count,
|
uint32_t mbr_id, int head_count, int sector_count,
|
||||||
int part_offset, int part_number, int fs_type,
|
int part_offset, int part_number, int fs_type,
|
||||||
uint8_t *buf, int flag);
|
uint8_t *buf, int flag);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param flag bit0= img_blocks is start address rather than end address:
|
||||||
|
do not subtract 1
|
||||||
|
*/
|
||||||
|
static
|
||||||
|
void iso_compute_cyl_head_sec(uint32_t *img_blocks, int hpc, int sph,
|
||||||
|
uint32_t *end_lba, uint32_t *end_sec,
|
||||||
|
uint32_t *end_head, uint32_t *end_cyl, int flag)
|
||||||
|
{
|
||||||
|
uint32_t secs;
|
||||||
|
|
||||||
|
/* Partition table unit is 512 bytes per sector, ECMA-119 unit is 2048 */
|
||||||
|
if (*img_blocks >= 0x40000000)
|
||||||
|
*img_blocks = 0x40000000 - 1; /* truncate rather than roll over */
|
||||||
|
if (flag & 1)
|
||||||
|
secs = *end_lba = *img_blocks * 4; /* first valid 512-lba */
|
||||||
|
else
|
||||||
|
secs = *end_lba = *img_blocks * 4 - 1; /* last valid 512-lba */
|
||||||
|
*end_cyl = secs / (sph * hpc);
|
||||||
|
secs -= *end_cyl * sph * hpc;
|
||||||
|
*end_head = secs / sph;
|
||||||
|
*end_sec = secs - *end_head * sph + 1; /* Sector count starts by 1 */
|
||||||
|
if (*end_cyl >= 1024) {
|
||||||
|
*end_cyl = 1023;
|
||||||
|
*end_head = hpc - 1;
|
||||||
|
*end_sec = sph;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* This is the gesture of grub-mkisofs --protective-msdos-label as explained by
|
/* This is the gesture of grub-mkisofs --protective-msdos-label as explained by
|
||||||
Vladimir Serbinenko <phcoder@gmail.com>, 2 April 2010, on grub-devel@gnu.org
|
Vladimir Serbinenko <phcoder@gmail.com>, 2 April 2010, on grub-devel@gnu.org
|
||||||
"Currently we use first and not last entry. You need to:
|
"Currently we use first and not last entry. You need to:
|
||||||
@ -49,38 +83,35 @@ int make_isolinux_mbr(int32_t *img_blocks, uint32_t boot_lba,
|
|||||||
should go into bytes 458-461. But with a start lba of 1, this is the
|
should go into bytes 458-461. But with a start lba of 1, this is the
|
||||||
same number.
|
same number.
|
||||||
See also http://en.wikipedia.org/wiki/Master_boot_record
|
See also http://en.wikipedia.org/wiki/Master_boot_record
|
||||||
|
|
||||||
|
flag bit0= do not write 0x55, 0xAA to 510,511
|
||||||
|
bit1= do not mark partition as bootable
|
||||||
*/
|
*/
|
||||||
static
|
static
|
||||||
int make_grub_msdos_label(int img_blocks, uint8_t *buf, int flag)
|
int make_grub_msdos_label(uint32_t img_blocks, uint8_t *buf, int flag)
|
||||||
{
|
{
|
||||||
uint8_t *wpt;
|
uint8_t *wpt;
|
||||||
unsigned long end_lba, secs, end_sec, end_head, end_cyl;
|
uint32_t end_lba, end_sec, end_head, end_cyl;
|
||||||
int sph = 63, hpc = 255, i;
|
int sph = 63, hpc = 255, i;
|
||||||
|
|
||||||
/* Partition table unit is 512 bytes per sector, ECMA-119 unit is 2048 */
|
iso_compute_cyl_head_sec(&img_blocks, hpc, sph,
|
||||||
if (img_blocks >= 0x40000000)
|
&end_lba, &end_sec, &end_head, &end_cyl, 0);
|
||||||
img_blocks = 0x40000000 - 1; /* truncate rather than roll over */
|
|
||||||
secs = end_lba = img_blocks * 4 - 1; /* last valid 512-lba */
|
|
||||||
end_cyl = secs / (sph * hpc);
|
|
||||||
secs -= end_cyl * sph * hpc;
|
|
||||||
end_head = secs / sph;
|
|
||||||
end_sec = secs - end_head * sph + 1; /* Sector count starts by 1 */
|
|
||||||
if (end_cyl >= 1024) {
|
|
||||||
end_cyl = 1023;
|
|
||||||
end_head = hpc - 1;
|
|
||||||
end_sec = sph;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 1) Zero-fill 446-510 */
|
/* 1) Zero-fill 446-510 */
|
||||||
wpt = buf + 446;
|
wpt = buf + 446;
|
||||||
memset(wpt, 0, 64);
|
memset(wpt, 0, 64);
|
||||||
|
|
||||||
/* 2) Put 0x55, 0xAA into 510-512 (actually 510-511) */
|
if (!(flag & 1)) {
|
||||||
buf[510] = 0x55;
|
/* 2) Put 0x55, 0xAA into 510-512 (actually 510-511) */
|
||||||
buf[511] = 0xAA;
|
buf[510] = 0x55;
|
||||||
|
buf[511] = 0xAA;
|
||||||
/* 3) Put 0x80 (for bootable partition), */
|
}
|
||||||
*(wpt++) = 0x80;
|
if (!(flag & 2)) {
|
||||||
|
/* 3) Put 0x80 (for bootable partition), */
|
||||||
|
*(wpt++) = 0x80;
|
||||||
|
} else {
|
||||||
|
*(wpt++) = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* 0, 2, 0 (C/H/S of the start), */
|
/* 0, 2, 0 (C/H/S of the start), */
|
||||||
*(wpt++) = 0;
|
*(wpt++) = 0;
|
||||||
@ -116,10 +147,71 @@ int make_grub_msdos_label(int img_blocks, uint8_t *buf, int flag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* @param flag bit0= zeroize partitions entries 2, 3, 4
|
||||||
|
*/
|
||||||
|
static
|
||||||
|
int iso_offset_partition_start(uint32_t img_blocks, uint32_t partition_offset,
|
||||||
|
int sph_in, int hpc_in, uint8_t *buf, int flag)
|
||||||
|
{
|
||||||
|
uint8_t *wpt;
|
||||||
|
uint32_t end_lba, end_sec, end_head, end_cyl;
|
||||||
|
uint32_t start_lba, start_sec, start_head, start_cyl;
|
||||||
|
int sph = 63, hpc = 255, i;
|
||||||
|
|
||||||
|
if (sph_in > 0)
|
||||||
|
sph = sph_in;
|
||||||
|
if (hpc_in > 0)
|
||||||
|
hpc = hpc_in;
|
||||||
|
iso_compute_cyl_head_sec(&partition_offset, hpc, sph,
|
||||||
|
&start_lba, &start_sec, &start_head, &start_cyl, 1);
|
||||||
|
iso_compute_cyl_head_sec(&img_blocks, hpc, sph,
|
||||||
|
&end_lba, &end_sec, &end_head, &end_cyl, 0);
|
||||||
|
wpt = buf + 446;
|
||||||
|
|
||||||
|
/* Let pass only legal bootability values */
|
||||||
|
if (*wpt != 0 && *wpt != 0x80)
|
||||||
|
(*wpt) = 0;
|
||||||
|
wpt++;
|
||||||
|
|
||||||
|
/* C/H/S of the start */
|
||||||
|
*(wpt++) = start_head;
|
||||||
|
*(wpt++) = start_sec | ((start_cyl & 0x300) >> 2);
|
||||||
|
*(wpt++) = end_cyl & 0xff;
|
||||||
|
|
||||||
|
/* (partition type) */
|
||||||
|
wpt++;
|
||||||
|
|
||||||
|
/* 3 bytes of C/H/S end */
|
||||||
|
*(wpt++) = end_head;
|
||||||
|
*(wpt++) = end_sec | ((end_cyl & 0x300) >> 2);
|
||||||
|
*(wpt++) = end_cyl & 0xff;
|
||||||
|
|
||||||
|
/* LBA start in little endian */
|
||||||
|
for (i = 0; i < 4; i++)
|
||||||
|
*(wpt++) = (start_lba >> (8 * i)) & 0xff;
|
||||||
|
|
||||||
|
/* Number of sectors in partition, little endian */
|
||||||
|
end_lba = end_lba - start_lba + 1;
|
||||||
|
for (i = 0; i < 4; i++)
|
||||||
|
*(wpt++) = (end_lba >> (8 * i)) & 0xff;
|
||||||
|
|
||||||
|
if (wpt - buf != 462) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"libisofs: program error in iso_offset_partition_start: \"assert 462\"\n");
|
||||||
|
return ISO_ASSERT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flag & 1) /* zeroize the other partition entries */
|
||||||
|
memset(wpt, 0, 3 * 16);
|
||||||
|
|
||||||
|
return ISO_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int iso_write_system_area(Ecma119Image *t, uint8_t *buf)
|
int iso_write_system_area(Ecma119Image *t, uint8_t *buf)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret, int_img_blocks;
|
||||||
int img_blocks;
|
uint32_t img_blocks;
|
||||||
|
|
||||||
if ((t == NULL) || (buf == NULL)) {
|
if ((t == NULL) || (buf == NULL)) {
|
||||||
return ISO_NULL_POINTER;
|
return ISO_NULL_POINTER;
|
||||||
@ -138,8 +230,13 @@ int iso_write_system_area(Ecma119Image *t, uint8_t *buf)
|
|||||||
/* Check for isolinux image with magic number of 3.72 and produce
|
/* Check for isolinux image with magic number of 3.72 and produce
|
||||||
an MBR from our built-in template. (Deprecated since 31 Mar 2010)
|
an MBR from our built-in template. (Deprecated since 31 Mar 2010)
|
||||||
*/
|
*/
|
||||||
|
if (img_blocks < 0x80000000) {
|
||||||
|
int_img_blocks= img_blocks;
|
||||||
|
} else {
|
||||||
|
int_img_blocks= 0x7ffffff0;
|
||||||
|
}
|
||||||
ret = make_isohybrid_mbr(t->bootsrc[0]->sections[0].block,
|
ret = make_isohybrid_mbr(t->bootsrc[0]->sections[0].block,
|
||||||
&img_blocks, (char*)buf, 0);
|
&int_img_blocks, (char*)buf, 0);
|
||||||
if (ret != 1) {
|
if (ret != 1) {
|
||||||
/* error, it should never happen */
|
/* error, it should never happen */
|
||||||
return ISO_ASSERT_FAILURE;
|
return ISO_ASSERT_FAILURE;
|
||||||
@ -147,9 +244,9 @@ int iso_write_system_area(Ecma119Image *t, uint8_t *buf)
|
|||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
}
|
}
|
||||||
if (t->system_area_options & 1) {
|
if (t->system_area_options & 1) {
|
||||||
/* Write GRUB protective msdos label, i.e. a isimple partition table */
|
/* Write GRUB protective msdos label, i.e. a simple partition table */
|
||||||
ret = make_grub_msdos_label(img_blocks, buf, 0);
|
ret = make_grub_msdos_label(img_blocks, buf, 0);
|
||||||
if (ret != 1) /* error should never happen */
|
if (ret != ISO_SUCCESS) /* error should never happen */
|
||||||
return ISO_ASSERT_FAILURE;
|
return ISO_ASSERT_FAILURE;
|
||||||
} else if(t->system_area_options & 2) {
|
} else if(t->system_area_options & 2) {
|
||||||
/* Patch externally provided system area as isohybrid MBR */
|
/* Patch externally provided system area as isohybrid MBR */
|
||||||
@ -163,6 +260,22 @@ int iso_write_system_area(Ecma119Image *t, uint8_t *buf)
|
|||||||
(uint32_t) 0, 64, 32, 0, 1, 0x17, buf, 1);
|
(uint32_t) 0, 64, 32, 0, 1, 0x17, buf, 1);
|
||||||
if (ret != 1)
|
if (ret != 1)
|
||||||
return ret;
|
return ret;
|
||||||
|
} else if(t->partition_offset > 0) {
|
||||||
|
/* Write a simple partition table. */
|
||||||
|
ret = make_grub_msdos_label(img_blocks, buf, 2);
|
||||||
|
if (ret != ISO_SUCCESS) /* error should never happen */
|
||||||
|
return ISO_ASSERT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (t->partition_offset > 0) {
|
||||||
|
/* Adjust partition table to partition offset */
|
||||||
|
img_blocks = t->curblock; /* value might be altered */
|
||||||
|
ret = iso_offset_partition_start(img_blocks, t->partition_offset,
|
||||||
|
t->partition_secs_per_head,
|
||||||
|
t->partition_heads_per_cyl, buf, 1);
|
||||||
|
if (ret != ISO_SUCCESS) /* error should never happen */
|
||||||
|
return ISO_ASSERT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
return ISO_SUCCESS;
|
return ISO_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,10 @@
|
|||||||
* Functions that act on the iso tree.
|
* Functions that act on the iso tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "libisofs.h"
|
#include "libisofs.h"
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
|
@ -9,6 +9,10 @@
|
|||||||
* See COPYING file for details.
|
* See COPYING file for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "libisofs.h"
|
#include "libisofs.h"
|
||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
|
@ -7,6 +7,10 @@
|
|||||||
* See COPYING file for details.
|
* See COPYING file for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "libisofs.h"
|
#include "libisofs.h"
|
||||||
|
|
||||||
|
@ -7,6 +7,10 @@
|
|||||||
* See COPYING file for details.
|
* See COPYING file for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "../config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "libisofs.h"
|
#include "libisofs.h"
|
||||||
|
|
||||||
@ -281,7 +285,7 @@ void ** iso_rbtree_to_array(IsoRBTree *tree, int (*include_item)(void *),
|
|||||||
size_t *size)
|
size_t *size)
|
||||||
{
|
{
|
||||||
size_t pos;
|
size_t pos;
|
||||||
void **array;
|
void **array, **new_array;
|
||||||
|
|
||||||
array = malloc((tree->size + 1) * sizeof(void*));
|
array = malloc((tree->size + 1) * sizeof(void*));
|
||||||
if (array == NULL) {
|
if (array == NULL) {
|
||||||
@ -292,7 +296,12 @@ void ** iso_rbtree_to_array(IsoRBTree *tree, int (*include_item)(void *),
|
|||||||
pos = rbtree_to_array_aux(tree->root, array, 0, include_item);
|
pos = rbtree_to_array_aux(tree->root, array, 0, include_item);
|
||||||
array[pos] = NULL;
|
array[pos] = NULL;
|
||||||
|
|
||||||
array = realloc(array, (pos + 1) * sizeof(void*));
|
new_array = realloc(array, (pos + 1) * sizeof(void*));
|
||||||
|
if (new_array == NULL) {
|
||||||
|
free((char *) array);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
array= new_array;
|
||||||
if (size) {
|
if (size) {
|
||||||
*size = pos;
|
*size = pos;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user