Compare commits

...

37 Commits

Author SHA1 Message Date
481d425580 Version leap to 0.6.30 2010-04-17 13:18:56 +02:00
99e988d652 Updated genealogy of isohybrid MBR production. 2010-04-17 08:46:45 +02:00
38a7b4a5b1 New API calls iso_read_opts_load_system_area() and iso_image_get_system_area() 2010-04-16 21:49:44 +02:00
9dc894584d Enhanced configure tests for iconv. Now aborting if not available. 2010-04-15 12:16:41 +02:00
1a7ab679cd Extended effect of iso_write_opts_set_pvd_times() parameter uuid to
creation time, to keep it consistent with modification time.
2010-04-14 12:00:43 +02:00
016baf9984 Implemented no_force_dots and separate omit_version_numbers for
Joliet to allow producing the same Joliet names as mkisofs -J.
2010-04-13 10:18:55 +02:00
b089f2e978 New bit1 of iso_write_opts_set_system_area() options.
New inner call make_isolinux_mbr() produces a bootable System Area
from an ISOLINUX mbr/isohdp[fp]x*.bin file and an ISOLINUX
El Torito bootable image (isolinux.bin).
2010-04-10 18:50:59 +02:00
c3d5ab7bc7 New API call iso_write_opts_set_pvd_times(). 2010-04-07 21:03:00 +02:00
f13167335a New API call iso_write_opts_set_system_area() acts like mkisofs option -G 2010-04-06 14:41:36 +02:00
f0f378c38f Adjusted copyright and license statements in single files. 2010-02-14 11:39:34 +01:00
907b44c556 Added copyright statements to technical specs in doc directory. 2010-02-13 14:18:40 +01:00
00011036dd Updated license situation of make_isohybrid_mbr.c 2010-02-12 21:57:48 +01:00
55497d3931 Changed comments from "Linux" to "GNU/Linux" where appropriate. 2010-02-12 20:14:15 +01:00
c47f206fe3 Version leap to 0.6.29 2010-02-10 15:45:19 +01:00
386ce0e60a Version leap to 0.6.28 2010-02-10 15:37:56 +01:00
9fe4172f0d Updated license statement about our legal view and future licenses. 2010-02-08 18:30:45 +01:00
61f2cdd02b Wrapped #endif mark into comment characters. 2010-02-08 15:08:53 +01:00
f87c63da41 One more safety precaution about checksum indice. 2010-02-08 14:54:08 +01:00
afebbe187d Bug fix: Random checksum index could sneak in via boot catalog node
and cause a SIGSEGV if checksumming is enabled.
This and other occurences of malloc() were changed to calloc().
2010-02-08 13:46:45 +01:00
3951df25be Corrected a wrong constant with checksum indice of Iso_File_Src.
It could have caused false checksum negatives in images with billions of files.
2010-02-08 13:04:56 +01:00
4b0f175a89 Reacted on compiler warnings from gzpLinux on kernel 2.6 2010-02-08 10:55:13 +01:00
633a8ada9e Avoiding unnecessary use of pthread_exit() 2010-02-05 14:52:24 +01:00
ce723a8c39 Forcing use of /usr/local on FreeBSD by LDFLAGS and CPPFLAGS. 2010-02-04 09:30:42 +01:00
83ace3b486 Changed leftover text which disallowed GPLv3. 2010-01-27 17:27:32 +01:00
23d3c43022 Removed more occurences of old restriction to GPLv2. 2010-01-27 06:48:59 +01:00
00470cbfea Version leap to 0.6.27 2010-01-20 10:19:50 +01:00
4c1abdf2bd Version leap to 0.6.26 2010-01-20 09:58:07 +01:00
f7842518fb Updated copyright year and removed ban to derive GPLv3 or later. 2010-01-19 17:11:07 +01:00
d756551385 Removed outdated defunct code piece 2010-01-19 15:19:24 +01:00
ced02f5903 Bug fix: Invalid checksum tags were preserved when the new session produced
no checksums
2010-01-17 21:08:58 +01:00
819e3218f6 More graceful reaction on filesystems where ACL are not enabled. 2010-01-11 09:57:00 +01:00
c874a159e2 Described scdbackup checksum tags in checksums..txt 2010-01-10 08:55:14 +01:00
a68e108333 Changed configure test for zlib from compress2() to compressBound() 2010-01-07 09:42:09 +01:00
da23a8166c Invalidating checksum buffer in case that image generation gets cancled. 2009-12-31 12:47:45 +01:00
cbb376a137 Introduced a default definition for PATH_MAX. 2009-12-31 08:48:51 +01:00
3852621bc0 Clarified that absolute paths to the local filesystem are expected. 2009-12-04 15:56:28 +01:00
0ff4cb34ed Version leap to 0.6.25 2009-10-08 14:47:08 +02:00
73 changed files with 1305 additions and 486 deletions

View File

@ -1,12 +1,12 @@
Vreixo Formoso <metalpain2002@yahoo.es>,
Mario Danic <mario.danic@gmail.com>,
Thomas Schmitt <scdbackup@gmx.net>
Copyright (C) 2007-2008 Vreixo Formoso, Mario Danic, Thomas Schmitt
Copyright (C) 2007-2010 Vreixo Formoso, Mario Danic, Thomas Schmitt
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
it under the terms of the GNU General Public License version 2 or later
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of

260
README
View File

@ -4,15 +4,17 @@
Released under GPL (see COPYING file for details).
Copyright (C) 2008 Vreixo Formoso, Mario Danic, Thomas Schmitt
Copyright (C) 2008 - 2010 Vreixo Formoso, Mario Danic, Thomas Schmitt
libisofs is part of the libburnia project (libburnia-project.org)
------------------------------------------------------------------------------
libisofs is a library to create an ISO-9660 filesystem, and supports extensions
like RockRidge or Joliet. It is also a full featured ISO-9660 editor, allowing
you to modify an ISO image or multisession disc, including file addition and
removal, change of file names and attributes, etc
libisofs is a library to create an ISO-9660 filesystem, supports extensions
like RockRidge or Joliet, and introduces an own extension AAIP.
It is a full featured ISO-9660 editor which composes and changes the directory
tree of an ISO image. This tree and its newly imported data file contents get
then written as independent single-session image or as add-on session for the
image from where the tree was originally loaded.
Features:
---------
@ -20,24 +22,45 @@ Features:
- Image creation
- Creates ISO-9660 images from local files.
- Support for RockRidge and Joliet extensions.
- Support for ISO-9660:1999 (version 2)
- Support for ISO-9660:1999 (version 2).
- Support for El-Torito bootable images.
- Full featured edition of file names and attributes on the image.
- Several options to relax ISO-9660 constraints.
- Special options for images intended for distribution (suitable default
modes for files, hiding of real timestamps...)
- Multisession
- Support for growing an existing image
- Support for multi-extent data files up to 400 GB (level 3).
- Full-featured edition of the image files, including: addition of new
files, removing of existent files, moving files, renaming files,
change file attributes (permissions, timestamps...)
- Support for "emulated multisession" or image growing, suitable for non
multisession media such as DVD+RW
- Optional recording per file of non-ISO 9660 features:
ACL, xattr, content MD5, hard link relations.
They do not hamper image readability by operating systems but can be
retrieved only via libisofs.
- Optional zisofs compression, gzip compression, external filter
processes.
- Several options to relax ISO-9660 constraints.
- Special options for images intended for distribution (suitable
default modes for files, hiding of real timestamps...).
- Image reading
- Image tree and data heap can be verified by stream reading and
eventually recorded MD5 tags.
- Directory tree and file attributes of ISO 9660 session get loaded
into memory for editing or for extraction into local filesystem.
- File content can be read by applications.
- Automatic zisofs decompression.
- Optional application of gzip decompression or external filter
processes.
- Eventually recorded MD5 of data file can be obtained, MD5 of data
stream can be computed and compared.
- Helper functions for restoring ACL and/or xattr to the local
filesystem.
- Multisession
- Support for growing an existing image on multi-session media.
- Support for "emulated multisession" on overwriteable media such as
DVD+RW, USB sticks, regular files.
- Support for blindly prepared add-on sessions (mkisofs style -M -C)
suitable for pipes which lead to an external burn program.
- Image modification
- It can create a completely new image from files on another image.
- Full-featured edition of image contents
- Creates a completely new image from files out of another image and
eventual editing operations. Suitable for any target medium.
- Others
- Handling of different input and output charset
- Handling of different input and output charset.
- Good integration with libburn for image burning.
- Reliable, good handling of different kind of errors.
@ -56,9 +79,8 @@ a) Images with unsupported features, such as:
- UDF.
- HSF/HFS+ or other Mac extensions.
- El-Torito with multiple entries.
- ECMA-119 with extended attributes, multiple extends per file.
- ECMA-119 with extended attributes.
- Non El-Torito boot info.
- zisofs compressed images.
- ...
In all these cases, the resulting new image (or new session) could lack some
features of the original image.
@ -123,178 +145,11 @@ To make the libraries accessible for running resp. developing applications
See INSTALL file for further details.
------------------------------------------------------------------------------
Overview of libburnia-project.org
libburnia-project.org is an open-source software project for reading, mastering
and writing optical discs.
For now this means only CD media and all single layer DVD media except DVD+R.
The project comprises of several more or less interdependent parts which
together strive to be a usable foundation for application development.
These are libraries, language bindings, and middleware binaries which emulate
classical (and valuable) Linux tools.
Our scope is currently Linux 2.4 and 2.6 only. For ports to other systems
we would need : login on a development machine resp. a live OS on CD or DVD,
advise from a system person about the equivalent of Linux sg or FreeBSD CAM,
volunteers for testing of realistic use cases.
We have a workable code base for burning CD and most single layer DVD.
The burn API is quite comprehensively documented and can be used to build a
presentable application.
We have a functional binary which emulates parts of cdrecord in order to
prove that usability, and in order to allow you to explore libburnia's scope
by help of existing cdrecord frontends.
The project components (list subject to growth, hopefully):
- libburn is the library by which preformatted data get onto optical media.
It uses either /dev/sgN (e.g. on kernel 2.4 with ide-scsi) or
/dev/hdX (e.g. on kernel 2.6).
libburn is the foundation of our cdrecord emulation. Its code is
independent of cdrecord. Its DVD capabilities are learned from
studying the code of dvd+rw-tools and MMC-5 specs. No code but only
the pure SCSI knowledge has been taken from dvd+rw-tools, though.
- libisofs is the library to pack up hard disk files and directories into a
ISO 9660 disk image. This may then be brought to media via libburn.
libisofs is to be the foundation of our upcoming mkisofs emulation.
- cdrskin is a limited cdrecord compatibility wrapper for libburn.
Cdrecord is a powerful GPL'ed burn program included in Joerg
Schilling's cdrtools. cdrskin strives to be a second source for
the services traditionally provided by cdrecord. Additionally it
provides libburn's DVD capabilities, where only -sao is compatible
with cdrecord.
cdrskin does not contain any bytes copied from cdrecord's sources.
Many bytes have been copied from the message output of cdrecord
runs, though.
See cdrskin/README and man cdrskin/cdrskin.1 for more.
- test is a collection of application gestures and examples given by the
authors of the library features. The main API example for libburn
is test/libburner.c .
Explore these examples if you look for inspiration.
We plan to be a responsive upstream. Bear with us. We are still practicing.
------------------------------------------------------------------------------
Project history as far as known to me:
- Founded in 2002 as it seems. See mailing list archives
http://lists.freedesktop.org/archives/libburn/
The site of this founder team is reachable and offers download of a
(somewhat outdated) tarball and from CVS :
http://icculus.org/burn/
Copyright holders and most probably founders:
Derek Foreman and Ben Jansens.
- I came to using libburn in 2005. Founded the cdrskin project and submitted
necessary patches which were accepted or implemented better. Except one
remaining patch which prevented cdrskin from using vanilla libburn from CVS.
The cdrskin project site is reachable and offers download of the heavily
patched (elsewise outdated) tarball under the name cdrskin-0.1.2 :
http://scdbackup.sourceforge.net/cdrskin_eng.html
It has meanwhile moved to use vanilla libburn.pykix.org , though.
Version 0.1.4 constitutes the first release of this kind.
- In July 2006 our team mate Mario Danic announced a revival of libburn
which by about nearly everybody else was perceived as unfriendly fork.
Derek Foreman four days later posted a message which expressed his
discontent.
The situation first caused me to publically regret it and then - after i
got the opportunity to move in with cdrskin - gave me true reason to
personally apologize to Derek Foreman, Ben Jansens and the contibutors at
icculus.org/burn. Posted to both projects:
http://lists.freedesktop.org/archives/libburn/2006-August/000446.html
http://mailman-mail1.webfaction.com/pipermail/libburn-hackers/2006-August/000024.html
- Mid August 2006 project cdrskin established a branch office in
libburn.pykix.org so that all maintainers of our tools have one single place
to get the current (at least slightely) usable coordinated versions of
everything.
Project cdrskin will live forth independendly for a while but it is committed
to stay in sync with libburn.pykix.org (or some successor, if ever).
cdrskin is also committed to support icculus.org/burn if the pending fork
is made reality by content changes in that project. It will cease to maintain
a patched version of icculus.org/burn though. Precondition for a new
release of cdrskin on base of icculus.org/burn would be the pending
"whitelist patch" therefore.
I would rather prefer if both projects find consense and merge, or at least
cooperate. I have not given up hope totally, yet.
I, personally, will honor any approach.
- 2nd September 2006 the decision is made to strive for a consolidation of
copyright and a commitment to GPL in a reasonable and open minded way.
This is to avoid long term problems with code of unknown origin and
with finding consense among the not so clearly defined group of copyright
claimers and -holders.
libisofs is already claimed sole copyright Mario Danic.
cdrskin and libburner are already claimed sole copyright Thomas Schmitt.
Rewrites of other components will follow and concluded by claiming full
copyright within the group of libburn.pykix.org-copyright holders.
- 16th September 2006 feature freeze for release of libburn-0.2.2 .
- 20th September 2006 release of libburn-0.2.2 .
- 26th October 2006 feature freeze for cdrskin-0.2.4 based on libburn-0.2.3 .
This version of cdrskin is much more cdrecord compatible in repect
to drive addressing and audio features.
- 30th October 2006 release of cdrskin-0.2.4 .
- 13th November 2006 splitting releases of libburn+cdrskin from libisofs.
- 24th November 2006 release of libburn-0.2.6 and cdrskin-0.2.6 . cdrskin has
become suitable for unaware frontends as long as they perform only the core
of cdrecord use cases (including open-ended input streams, audio, and
multi-session).
- 28th November 2006 the umbrella project which encloses both, libisofs and
libburn, is now called libburnia. For the origin of this name, see
http://en.wikipedia.org/wiki/Liburnians .
- 16th January 2007 release of libburn-0.3.0 and cdrskin-0.3.0 . Now the scope
is widened to a first class of DVD media: overwriteable single layer types
DVD-RAM, DVD+RW, DVD-RW. This is not a cdrecord emulation but rather inspired
by dvd+rw-tools' "poor man" writing facility for this class of media.
Taking a bow towards Andy Polyakov.
- 11th February 2007 version 0.3.2 covers sequential DVD-RW and DVD-R with
multi-session and with DAO.
- 12th March 2007 version 0.3.4 supports DVD+R and thus covers all single layer
DVD media. Code for double layer DVD+/-R is implemented but awaits a tester
yet.
- 23th April 2007 version 0.3.6 follows the unanimous opinion of Linux kernel
people that one should not use /dev/sg on kernel 2.6.
- 31st July 2007 version 0.3.8 marks the first anniversary of libburn revival.
We look back on improved stability, a substantially extended list of media
and write modes, and better protection against typical user mishaps.
- 24th October 2007 version 0.4.0 is the foundation of new library libisoburn
and an upcomming integrated application for manipulating and writing
ISO 9660 + Rock Ridge images. cdrskin-0.4.0 got capabilities like growisofs
by these enhancements: growing of overwriteable media and disk files.
Taking again a bow towards Andy Polyakov.
- 26th Januar 2008 version 0.4.2 rectifies the version numbering so that we
reliably release libburn.so.4 as should have been done since libburn-0.3.2.
cdrskin now is by default linked dynamically and does a runtime check
to ensure not to be started with a libburn which is older than itself.
------------------------------------------------------------------------------
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation. To be exact: version 2 of that License.
it under the terms of the GNU General Public License version 2 or later
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -309,19 +164,19 @@ Project history as far as known to me:
Clarification in my name and in the name of Mario Danic, upcoming copyright
holders on toplevel of libburnia. To be fully in effect after the remaining
other copyrighted code has been replaced by ours and by copyright-free
contributions of our friends:
contributions of our friends.
Note:
In the particular case of libisofs there is no foreign copyright involved.
As of 2010 foreign copyright is only in component libburn.
------------------------------------------------------------------------------
We, the copyright holders, agree on the interpretation that
dynamical linking of our libraries constitutes "use of" and
not "derivation from" our work in the sense of GPL, provided
those libraries are compiled from our unaltered code.
Thus you may link our libraries dynamically with applications
which are not under GPL. You may distribute our libraries and
application tools in binary form, if you fulfill the usual
condition of GPL to offer a copy of the source code -altered
or unaltered- under GPL.
We will not raise any legal protest to dynamic linking of our libraries
with applications that are not under GPL, as long as they fulfill
the condition of offering the library source code used, whether
altered or unaltered, under the GPLv2+, along with the application.
Nevertheless, the safest legal position is not to link libburn with
non-GPL compatible programs.
We ask you politely to use our work in open source spirit
and with the due reference to the entire open source community.
@ -335,7 +190,10 @@ It is the open source idea of responsible freedom which will be
decisive and you will have to prove that you exhausted all own
means to qualify for GPL.
For now we are firmly committed to maintain one single license: GPL.
We are firmly committed to allow GPLv2+ now and with future releases.
signed: Mario Danic, Thomas Schmitt
Signed: Mario Danic, Thomas Schmitt
Agreement joined later by: Vreixo Formoso
Public contact: <libburn-hackers@pykix.org>

View File

@ -1,3 +1,14 @@
AC_DEFUN([LIBBURNIA_SET_FLAGS],
[
case $target_os in
freebsd*)
LDFLAGS="$LDFLAGS -L/usr/local/lib"
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
;;
esac
])
AC_DEFUN([TARGET_SHIZZLE],
[
ARCH=""
@ -39,8 +50,9 @@ dnl From Bruno Haible.
dnl
AC_DEFUN([LIBBURNIA_CHECK_ICONV],
[
dnl Check whether it is allowed to link with -liconv
AC_MSG_CHECKING([for separate -liconv ])
AC_MSG_CHECKING([for iconv() in separate -liconv ])
libburnia_liconv="no"
libburnia_save_LIBS="$LIBS"
LIBS="$LIBS -liconv"
@ -54,6 +66,13 @@ AC_DEFUN([LIBBURNIA_CHECK_ICONV],
)
AC_MSG_RESULT([$libburnia_liconv])
if test x"$libburnia_save_LIBS" = x"$LIBS"
then
dnl GNU iconv has no function iconv() but libiconv() and a macro iconv()
dnl It is not tested whether this is detected by above macro.
AC_CHECK_LIB(iconv, libiconv, , )
fi
dnl Check for iconv(..., const char **inbuf, ...)
AC_MSG_CHECKING([for const qualifier with iconv() ])
AC_TRY_COMPILE([
@ -68,6 +87,50 @@ size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, si
])
dnl LIBBURNIA_ASSERT_ICONV is by Thomas Schmitt, libburnia project
dnl
AC_DEFUN([LIBBURNIA_ASSERT_ICONV],
[
if test x$LIBISOFS_ASSUME_ICONV = x
then
dnl Check for the essential gestures of libisofs/util.c
AC_MSG_CHECKING([for iconv() to be accessible now ])
AC_TRY_LINK([
#include <stdlib.h>
#include <wchar.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include <stdio.h>
#include <limits.h>
#include <iconv.h>
#include <locale.h>
#include <langinfo.h>
#include <unistd.h>],
[iconv_t cd = iconv_open("","");
iconv(cd,NULL,NULL,NULL,NULL);
iconv_close(cd);
], [iconv_test="yes"], [iconv_test="no"]
)
AC_MSG_RESULT([$iconv_test])
if test x$iconv_test = xno
then
echo >&2
echo "Cannot get function iconv() to work. Configuration aborted." >&2
echo "Check whether your system needs a separate libiconv installed." >&2
echo "If it is installed but not found, try something like" >&2
echo ' export LDFLAGS="$LDFLAGS -L/usr/local/lib"' >&2
echo ' export CPPFLAGS="$CPPFLAGS -I/usr/local/include"' >&2
echo ' export LIBS="$LIBS -liconv"' >&2
echo "You may override this test by exporting variable" >&2
echo " LIBISOFS_ASSUME_ICONV=yes" >&2
echo >&2
(exit 1); exit 1;
fi
fi
])
dnl LIBBURNIA_SET_PKGCONFIG determines the install directory for the *.pc file.
dnl Important: Must be performed _after_ TARGET_SHIZZLE
dnl

View File

@ -1,10 +1,12 @@
AC_INIT([libisofs], [0.6.24], [http://libburnia-project.org])
AC_INIT([libisofs], [0.6.30], [http://libburnia-project.org])
AC_PREREQ([2.50])
dnl AC_CONFIG_HEADER([config.h])
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
LIBBURNIA_SET_FLAGS
AM_INIT_AUTOMAKE([subdir-objects])
dnl A61101 This breaks Linux build (makes 32 bit off_t)
@ -44,7 +46,7 @@ dnl If LIBISOFS_*_VERSION changes, be sure to change AC_INIT above to match.
dnl
LIBISOFS_MAJOR_VERSION=0
LIBISOFS_MINOR_VERSION=6
LIBISOFS_MICRO_VERSION=24
LIBISOFS_MICRO_VERSION=30
LIBISOFS_VERSION=$LIBISOFS_MAJOR_VERSION.$LIBISOFS_MINOR_VERSION.$LIBISOFS_MICRO_VERSION
AC_SUBST(LIBISOFS_MAJOR_VERSION)
@ -54,11 +56,11 @@ AC_SUBST(LIBISOFS_VERSION)
dnl Libtool versioning
LT_RELEASE=$LIBISOFS_MAJOR_VERSION.$LIBISOFS_MINOR_VERSION
# 2009.10.08 development jump has not yet happened
# SONAME = 26 - 20 = 6 . Library name = libisofs.6.20.0
LT_CURRENT=26
# 2010.04.17 development jump has not yet happened
# SONAME = 32 - 26 = 6 . Library name = libisofs.6.26.0
LT_CURRENT=32
LT_AGE=26
LT_REVISION=0
LT_AGE=20
LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
AC_SUBST(LT_RELEASE)
@ -89,6 +91,9 @@ dnl If iconv(3) is in an extra lib, then it gets added to variable LIBS.
dnl If not, then no -liconv will be added.
LIBBURNIA_CHECK_ICONV
dnl To abort configuration if iconv() still cannot be compiled
LIBBURNIA_ASSERT_ICONV
AC_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)
@ -196,9 +201,11 @@ AC_ARG_ENABLE(zlib,
if test "x$enable_zlib" = xyes; then
dnl Check whether there is the header for zlib.
dnl If not, erase this macro which would enable use of compress2() and others.
dnl The empty parameter after "compress2" causes -lz.
dnl Linking fails on SuSE 9.0 because zlib has compress2() but lacks
dnl compressBound(). So compressBound is the more modern thing to test.
dnl The empty parameter after "compressBound" causes -lz.
ZLIB_DEF="-DLibisofs_with_zliB"
AC_CHECK_HEADER(zlib.h, AC_CHECK_LIB(z, compress2, , ZLIB_DEF= ), ZLIB_DEF= )
AC_CHECK_HEADER(zlib.h, AC_CHECK_LIB(z, compressBound, , ZLIB_DEF= ), ZLIB_DEF= )
else
ZLIB_DEF=
fi

View File

@ -2,8 +2,9 @@
* Copyright (c) 2007 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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"

View File

@ -2,8 +2,9 @@
* Copyright (c) 2007 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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"

View File

@ -3,9 +3,9 @@
* Copyright (c) 2007 - 2009 Vreixo Formoso, Thomas Schmitt
*
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
*
* 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.
*/
static char helptext[][80] = {
@ -65,6 +65,11 @@ static char helptext[][80] = {
#include <fcntl.h>
#include <err.h>
#ifndef PATH_MAX
#define PATH_MAX Libisofs_default_path_maX
#endif
/* ------------------------- from demo/tree.c ----------------------- */
static void

View File

@ -2,8 +2,9 @@
* Copyright (c) 2007 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*/

View File

@ -10,6 +10,12 @@
#include "libisofs.h"
#ifndef PATH_MAX
#define PATH_MAX Libisofs_default_path_maX
#endif
static void
print_permissions(mode_t mode)
{

View File

@ -2,8 +2,9 @@
* Copyright (c) 2007 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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"
@ -13,6 +14,12 @@
#include <stdlib.h>
#include <limits.h>
#ifndef PATH_MAX
#define PATH_MAX Libisofs_default_path_maX
#endif
/*
* Little test program to test filesystem implementations.
*

View File

@ -59,7 +59,7 @@ Entry number N + 1 holds the MD5 checksum of entries 0 to N.
Because the inquiry of AAIP attributes demands loading of the image tree,
there are also checksum tags which can be detected on the fly when reading
and checksumming the session from the start point as learned from a media
and checksumming the session from its start point as learned from a media
table-of-content.
The superblock checksum tag is written after the ECMA-119 volume descriptors.
@ -79,7 +79,7 @@ Tag_id distinguishes the following tag types
"libisofs_checksum_tag_v1" Session tag
A relocated superblock may appear at LBA 0 of an image which was produced for
being stored in a disk file or on overwriteable media (e.g. DVD+R, BD-RE).
being stored in a disk file or on overwriteable media (e.g. DVD+RW, BD-RE).
Typically there is a first session recorded with a superblock at LBA 32 and
the next session may follow shortly after its session tag. (Typically at the
next block address which is divisible by 32.) Normally no session starts after
@ -280,3 +280,41 @@ to iso_image_import() when reading the image. If this source is associated
to a libburn drive, then libburn function burn_read_data() can read directly
from it.
-------------------------------------------------------------------------------
scdbackup Checksum Tags
The session checksum tag does not occupy its whole block. So there is room to
store a scdbackup stream checksum tag, which is an ancestor format of the tags
described here. This feature allows scdbackup to omit its own checksum filter
if using xorriso as ISO 9660 formatter program.
Such a tag makes only sense if the session begins at LBA 0.
See scdbackup-*/README, appendix VERIFY for a specification.
Example of a scdbackup checksum tag:
scdbackup_checksum_tag_v0.1 2456606865 61 2_2 B00109.143415 2456606865 485bbef110870c45754d7adcc844a72c c2355d5ea3c94d792ff5893dfe0d6d7b
The tag is located at byte position 2456606865, contains 61 bytes of scdbackup
checksum record (the next four words):
Name of the backup volume is "2_2".
Written in year B0 = 2010 (A9 = 2009, B1 = 2011), January (01), 9th (09),
14:34:15 local time.
The size of the volume is 2456606865 bytes, which have a MD5 sum of
485bbef110870c45754d7adcc844a72c.
The checksum of "2_2 B00109.143415 2456606865 485bbef110870c45754d7adcc844a72c"
is c2355d5ea3c94d792ff5893dfe0d6d7b.
-------------------------------------------------------------------------------
This text is under
Copyright (c) 2009 - 2010 Thomas Schmitt <scdbackup@gmx.net>
It shall only be modified in sync with libisofs and other software which
makes use of libisofs checksums. Please mail change requests to mailing list
<libburn-hackers@pykix.org> or to the copyright holder in private.
Only if you cannot reach the copyright holder for at least one month it is
permissible to modify this text under the same license as the affected
copy of libisofs.
If you do so, you commit yourself to taking reasonable effort to stay in
sync with the other interested users of this text.

View File

@ -443,3 +443,14 @@ Program mkisofs emits entry XA
-------------------------------------------------------------------------------
This text is under
Copyright (c) 2009 - 2010 Thomas Schmitt <scdbackup@gmx.net>
It shall only be modified in sync with libisofs and other software which
makes use of AAIP. Please mail change requests to mailing list
<libburn-hackers@pykix.org> or to the copyright holder in private.
Only if you cannot reach the copyright holder for at least one month it is
permissible to modify this text under the same license as the affected
copy of libisofs.
If you do so, you commit yourself to taking reasonable effort to stay in
sync with the other interested users of this text.

View File

@ -149,3 +149,14 @@ Registered:
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
This text is under
Copyright (c) 2009 - 2010 Thomas Schmitt <scdbackup@gmx.net>
It shall only be modified in sync with libisofs and other software which
makes use of AAIP. Please mail change requests to mailing list
<libburn-hackers@pykix.org> or to the copyright holder in private.
Only if you cannot reach the copyright holder for at least one month it is
permissible to modify this text under the same license as the affected
copy of libisofs.
If you do so, you commit yourself to taking reasonable effort to stay in
sync with the other interested users of this text.

View File

@ -141,3 +141,14 @@ SUSP 1.12
RRIP 1.12
ftp://ftp.ymi.com/pub/rockridge/rrip112.ps
-------------------------------------------------------------------------------
This text is under
Copyright (c) 2009 - 2010 Thomas Schmitt <scdbackup@gmx.net>
It shall reflect the effective technical specifications as implemented in
zisofs-tools and the Linux kernel. So please contact mailing list
<libburn-hackers@pykix.org> or to the copyright holder in private, if you
want to make changes.
Only if you cannot reach the copyright holder for at least one month it is
permissible to modify and distribute this text under the license "BSD revised".

View File

@ -11,7 +11,7 @@
To be included by aaip_0_2.c
Copyright (c) 2009 Thomas Schmitt, libburnia project, GPLv2
Copyright (c) 2009 Thomas Schmitt, libburnia project, GPLv2+
*/

View File

@ -3,7 +3,7 @@
aaip-os-freebsd.c
Arbitrary Attribute Interchange Protocol , system adapter for getting and
setting of ACLs and ixattr.
setting of ACLs and xattr.
To be included by aaip_0_2.c
@ -18,6 +18,7 @@
#include <string.h>
#include <stdio.h>
#include <sys/stat.h>
#include <errno.h>
#ifndef Libisofs_with_aaip_acL
/* It seems ACL is fixely integrated in FreeBSD libc. There is no libacl. */
@ -37,13 +38,14 @@
finally has to be freed by a call to this function
with bit15 of flag.
@param flag Bitfield for control purposes
bit0= obtain default ACL rather than access ACL
(bit0= obtain default ACL rather than access ACL)
bit4= set *text = NULL and return 2
if the ACL matches st_mode permissions.
bit5= in case of symbolic link: inquire link target
bit15= free text and return 1
@return > 0 ok
0 ACL support not enabled at compile time
or filesystem does not support ACL
-1 failure of system ACL service (see errno)
-2 attempt to inquire ACL of a symbolic
link without bit4 or bit5
@ -88,8 +90,18 @@ int aaip_get_acl_text(char *path, char **text, int flag)
acl= acl_get_file(path, ACL_TYPE_ACCESS);
if(acl == NULL)
if(acl == NULL) {
if(errno == EOPNOTSUPP) {
/* filesystem does not support ACL */
if(flag & 16)
return(2);
/* >>> ??? fake ACL from POSIX permissions ? */;
return(0);
}
return(-1);
}
*text= acl_to_text(acl, NULL);
acl_free(acl);
@ -181,10 +193,8 @@ int aaip_get_attr_list(char *path, size_t *num_attrs, char ***names,
if(flag & 1) { /* Obtain ACL */
/* access-ACL */
ret= aaip_get_acl_text(path, &acl_text, flag & (16 | 32));
if(ret <= 0)
goto ex;
if(ret == 2)
aaip_get_acl_text(path, &acl_text, flag & (16 | 32));
if(acl_text == NULL)
{ret= 1; goto ex;} /* empty ACL / only st_mode info was found in ACL */
ret= aaip_encode_acl(acl_text, (mode_t) 0, &a_acl_len, &a_acl, flag & 2);
if(ret <= 0)

View File

@ -7,7 +7,7 @@
To be included by aaip_0_2.c
Copyright (c) 2009 Thomas Schmitt, libburnia project, GPLv2
Copyright (c) 2009 Thomas Schmitt, libburnia project, GPLv2+
*/
@ -18,6 +18,8 @@
#include <string.h>
#include <stdio.h>
#include <sys/stat.h>
#include <errno.h>
#ifdef Libisofs_with_aaip_acL
#include <sys/acl.h>
@ -46,6 +48,7 @@
2 only st_mode permissions exist and bit 4 is set
or empty ACL and bit0 is set
0 ACL support not enabled at compile time
or filesystem does not support ACL
-1 failure of system ACL service (see errno)
-2 attempt to inquire ACL of a symbolic link without
bit4 or bit5 resp. with no suitable link target
@ -79,8 +82,18 @@ int aaip_get_acl_text(char *path, char **text, int flag)
}
acl= acl_get_file(path, (flag & 1) ? ACL_TYPE_DEFAULT : ACL_TYPE_ACCESS);
if(acl == NULL)
if(acl == NULL) {
if(errno == ENOTSUP) {
/* filesystem does not support ACL */
if(flag & 16)
return(2);
/* >>> ??? fake ACL from POSIX permissions ? */;
return(0);
}
return(-1);
}
*text= acl_to_text(acl, NULL);
acl_free(acl);

View File

@ -7,7 +7,7 @@
See test/aaip_0_2.h
http://libburnia-project.org/wiki/AAIP
Copyright (c) 2009 Thomas Schmitt, libburnia project, GPLv2
Copyright (c) 2009 Thomas Schmitt, libburnia project, GPLv2+
*/
@ -567,7 +567,7 @@ ex:;
}
/* Linux man 5 acl says:
/* GNU/Linux man 5 acl says:
The permissions defined by ACLs are a superset of the permissions speci-
fied by the file permission bits. The permissions defined for the file
owner correspond to the permissions of the ACL_USER_OBJ entry. The per-

View File

@ -9,7 +9,7 @@
test/aaip_0_2.h - Public declarations
Copyright (c) 2009 Thomas Schmitt, libburnia project, GPLv2
Copyright (c) 2009 Thomas Schmitt, libburnia project, GPLv2+
*/

View File

@ -2,8 +2,9 @@
* Copyright (c) 2007 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*/
/*

View File

@ -2,8 +2,9 @@
* Copyright (c) 2007 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*/
#ifndef LIBISO_BUFFER_H_

View File

@ -3,8 +3,9 @@
* Copyright (c) 2009 Thomas Schmitt
*
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*/
/* libisofs.h defines aaip_xinfo_func */
@ -21,6 +22,11 @@
#include <limits.h>
#ifndef PATH_MAX
#define PATH_MAX Libisofs_default_path_maX
#endif
void iso_node_builder_ref(IsoNodeBuilder *builder)
{

View File

@ -2,8 +2,9 @@
* Copyright (c) 2007 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*/
#ifndef LIBISO_BUILDER_H_

View File

@ -2,8 +2,9 @@
* Copyright (c) 2007 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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"

View File

@ -4,8 +4,9 @@
* Copyright (c) 2009 Thomas Schmitt
*
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*/
/*
@ -72,6 +73,9 @@ void ecma119_image_free(Ecma119Image *t)
if (t->output_charset != NULL)
free(t->output_charset);
if (t->system_area_data != NULL)
free(t->system_area_data);
#ifdef Libisofs_with_checksumS
if (t->checksum_ctx != NULL) { /* dispose checksum context */
char md5[16];
@ -92,7 +96,7 @@ void ecma119_image_free(Ecma119Image *t)
static
int need_version_number(Ecma119Image *t, Ecma119Node *n)
{
if (t->omit_version_numbers) {
if (t->omit_version_numbers & 1) {
return 0;
}
if (n->type == ECMA119_DIR || n->type == ECMA119_PLACEHOLDER) {
@ -379,7 +383,7 @@ int ecma119_writer_write_vol_desc(IsoImageWriter *writer)
IsoImage *image;
Ecma119Image *t;
struct ecma119_pri_vol_desc vol;
int i;
char *vol_id, *pub_id, *data_id, *volset_id;
char *system_id, *application_id, *copyright_file_id;
char *abstract_file_id, *biblio_file_id;
@ -434,9 +438,44 @@ int ecma119_writer_write_vol_desc(IsoImageWriter *writer)
strncpy_pad((char*)vol.abstract_file_id, abstract_file_id, 37);
strncpy_pad((char*)vol.bibliographic_file_id, biblio_file_id, 37);
iso_datetime_17(vol.vol_creation_time, t->now, t->always_gmt);
iso_datetime_17(vol.vol_modification_time, t->now, t->always_gmt);
iso_datetime_17(vol.vol_effective_time, t->now, t->always_gmt);
if (t->vol_uuid[0]) {
for(i = 0; i < 16; i++)
if(t->vol_uuid[i] < '0' || t->vol_uuid[i] > '9')
break;
else
vol.vol_creation_time[i] = t->vol_uuid[i];
for(; i < 16; i++)
vol.vol_creation_time[i] = '1';
vol.vol_creation_time[16] = 0;
} else if (t->vol_creation_time > 0)
iso_datetime_17(vol.vol_creation_time, t->vol_creation_time,
t->always_gmt);
else
iso_datetime_17(vol.vol_creation_time, t->now, t->always_gmt);
if (t->vol_uuid[0]) {
for(i = 0; i < 16; i++)
if(t->vol_uuid[i] < '0' || t->vol_uuid[i] > '9')
break;
else
vol.vol_modification_time[i] = t->vol_uuid[i];
for(; i < 16; i++)
vol.vol_modification_time[i] = '1';
vol.vol_modification_time[16] = 0;
} else if (t->vol_modification_time > 0)
iso_datetime_17(vol.vol_modification_time, t->vol_modification_time,
t->always_gmt);
else
iso_datetime_17(vol.vol_modification_time, t->now, t->always_gmt);
if (t->vol_expiration_time > 0)
iso_datetime_17(vol.vol_expiration_time, t->vol_expiration_time,
t->always_gmt);
if (t->vol_effective_time > 0)
iso_datetime_17(vol.vol_effective_time, t->vol_effective_time,
t->always_gmt);
vol.file_structure_version[0] = 1;
free(vol_id);
@ -923,7 +962,12 @@ void *write_function(void *arg)
#endif
iso_ring_buffer_writer_close(target->buffer, 0);
#ifdef Libisofs_with_pthread_exiT
pthread_exit(NULL);
#else
return NULL;
#endif
write_error: ;
if (res == ISO_CANCELED) {
@ -938,12 +982,19 @@ void *write_function(void *arg)
#ifdef Libisofs_with_checksumS
/* Transplant checksum buffer from Ecma119Image to IsoImage */
/* Transplant checksum buffer away from Ecma119Image */
transplant_checksum_buffer(target, 0);
/* Invalidate the transplanted checksum buffer in IsoImage */
iso_image_free_checksums(target->image, 0);
#endif
#ifdef Libisofs_with_pthread_exiT
pthread_exit(NULL);
#else
return NULL;
#endif
}
@ -1050,9 +1101,11 @@ int checksum_prepare_nodes(Ecma119Image *target, IsoNode *node, int flag)
static
int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
{
int ret, i, voldesc_size, nwriters, image_checksums_mad = 0;
int ret, i, voldesc_size, nwriters, image_checksums_mad = 0, tag_pos;
Ecma119Image *target;
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;
char *system_area = NULL;
/* 1. Allocate target and copy opts there */
target = calloc(1, sizeof(Ecma119Image));
@ -1114,6 +1167,30 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
target->eltorito = (src->bootcat == NULL ? 0 : 1);
target->catalog = src->bootcat;
if (opts->system_area_data != NULL) {
system_area = opts->system_area_data;
system_area_options = opts->system_area_options;
} else if (src->system_area_data != NULL) {
system_area = src->system_area_data;
system_area_options = src->system_area_options;
}
target->system_area_data = NULL;
if (system_area != NULL) {
target->system_area_data = calloc(32768, 1);
if (target->system_area_data == NULL) {
ret = ISO_OUT_OF_MEM;
goto target_cleanup;
}
memcpy(target->system_area_data, system_area, 32768);
}
target->system_area_options = system_area_options;
target->vol_creation_time = opts->vol_creation_time;
target->vol_modification_time = opts->vol_modification_time;
target->vol_expiration_time = opts->vol_expiration_time;
target->vol_effective_time = opts->vol_effective_time;
strcpy(target->vol_uuid, opts->vol_uuid);
target->input_charset = strdup(iso_get_local_charset(0));
if (target->input_charset == NULL) {
ret = ISO_OUT_OF_MEM;
@ -1367,8 +1444,9 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
#ifdef Libisofs_with_checksumS
/* Write relocated superblock checksum tag */
tag_pos = voldesc_size / BLOCK_SIZE + 16 + 1;
if (target->md5_session_checksum) {
target->checksum_rlsb_tag_pos = voldesc_size / BLOCK_SIZE + 16 + 1;
target->checksum_rlsb_tag_pos = tag_pos;
if (target->checksum_rlsb_tag_pos < 32) {
ret = iso_md5_start(&(target->checksum_ctx));
if (ret < 0)
@ -1381,6 +1459,20 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *opts, Ecma119Image **img)
if (ret < 0)
goto target_cleanup;
}
tag_pos++;
}
/* Clean out eventual checksum tags */
for (i = tag_pos; i < 32; i++) {
int tag_type;
uint32_t pos, range_start, range_size, next_tag;
char md5[16];
ret = iso_util_decode_md5_tag((char *)(opts->overwrite + i * 2048),
&tag_type, &pos, &range_start,
&range_size, &next_tag, md5, 0);
if (ret > 0)
opts->overwrite[i * 2048] = 0;
}
#endif /* Libisofs_with_checksumS */
@ -1661,6 +1753,14 @@ int iso_write_opts_new(IsoWriteOpts **opts, int profile)
wopts->fifo_size = 1024; /* 2 MB buffer */
wopts->sort_files = 1; /* file sorting is always good */
wopts->system_area_data = NULL;
wopts->system_area_options = 0;
wopts->vol_creation_time = 0;
wopts->vol_modification_time = 0;
wopts->vol_expiration_time = 0;
wopts->vol_effective_time = 0;
wopts->vol_uuid[0]= 0;
*opts = wopts;
return ISO_SUCCESS;
}
@ -1672,6 +1772,8 @@ void iso_write_opts_free(IsoWriteOpts *opts)
}
free(opts->output_charset);
if(opts->system_area_data != NULL)
free(opts->system_area_data);
free(opts);
}
@ -1737,7 +1839,7 @@ int iso_write_opts_set_omit_version_numbers(IsoWriteOpts *opts, int omit)
if (opts == NULL) {
return ISO_NULL_POINTER;
}
opts->omit_version_numbers = omit ? 1 : 0;
opts->omit_version_numbers = omit & 3;
return ISO_SUCCESS;
}
@ -1773,7 +1875,7 @@ int iso_write_opts_set_no_force_dots(IsoWriteOpts *opts, int no)
if (opts == NULL) {
return ISO_NULL_POINTER;
}
opts->no_force_dots = no ? 1 : 0;
opts->no_force_dots = no & 3;
return ISO_SUCCESS;
}
@ -2057,3 +2159,43 @@ int iso_write_opts_get_data_start(IsoWriteOpts *opts, uint32_t *data_start,
return ISO_SUCCESS;
}
/*
* @param data Either NULL or 32 kB of data. Do not submit less bytes !
* @param options bit0 = apply GRUB protective msdos label
* @param flag bit0 = invalidate any attached system area data
* same as data == NULL
*/
int iso_write_opts_set_system_area(IsoWriteOpts *opts, char data[32768],
int options, int flag)
{
if (data == NULL || (flag & 1)) { /* Disable */
if (opts->system_area_data != NULL)
free(opts->system_area_data);
opts->system_area_data = NULL;
} else if (!(flag & 2)) {
if (opts->system_area_data == NULL) {
opts->system_area_data = calloc(32768, 1);
if (opts->system_area_data == NULL)
return ISO_OUT_OF_MEM;
}
memcpy(opts->system_area_data, data, 32768);
}
if (!(flag & 4))
opts->system_area_options = options & 3;
return ISO_SUCCESS;
}
int iso_write_opts_set_pvd_times(IsoWriteOpts *opts,
time_t vol_creation_time, time_t vol_modification_time,
time_t vol_expiration_time, time_t vol_effective_time,
char *vol_uuid)
{
opts->vol_creation_time = vol_creation_time;
opts->vol_modification_time = vol_modification_time;
opts->vol_expiration_time = vol_expiration_time;
opts->vol_effective_time = vol_effective_time;
strncpy(opts->vol_uuid, vol_uuid, 16);
opts->vol_uuid[16] = 0;
return ISO_SUCCESS;
}

View File

@ -3,8 +3,9 @@
* Copyright (c) 2009 Thomas Schmitt
*
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*/
#ifndef LIBISO_ECMA119_H_
@ -56,8 +57,10 @@ struct iso_write_opts {
/**
* Omit the version number (";1") at the end of the ISO-9660 identifiers.
* Version numbers are usually not used.
* bit0= ECMA-119 and Joliet (for historical reasons)
* bit1= Joliet
*/
unsigned int omit_version_numbers :1;
unsigned int omit_version_numbers :2;
/**
* Allow ISO-9660 directory hierarchy to be deeper than 8 levels.
@ -81,8 +84,10 @@ struct iso_write_opts {
* ISO-9660 forces filenames to have a ".", that separates file name from
* extension. libisofs adds it if original filename doesn't has one. Set
* this to 1 to prevent this behavior
* bit0= ECMA-119
* bit1= Joliet
*/
unsigned int no_force_dots :1;
unsigned int no_force_dots :2;
/**
* Allow lowercase characters in ISO-9660 filenames. By default, only
@ -297,6 +302,22 @@ struct iso_write_opts {
*/
char *scdbackup_tag_written;
/*
* See ecma119_image : System Area related information
*/
char *system_area_data;
int system_area_options;
/* User settable PVD time stamps */
time_t vol_creation_time;
time_t vol_modification_time;
time_t vol_expiration_time;
time_t vol_effective_time;
/* To eventually override vol_creation_time and vol_modification_time
* by unconverted string with timezone 0
*/
char vol_uuid[17];
};
typedef struct ecma119_image Ecma119Image;
@ -327,11 +348,11 @@ struct ecma119_image
unsigned int always_gmt :1;
/* relaxed constraints */
unsigned int omit_version_numbers :1;
unsigned int omit_version_numbers :2;
unsigned int allow_deep_paths :1;
unsigned int allow_longer_paths :1;
unsigned int max_37_char_filenames :1;
unsigned int no_force_dots :1;
unsigned int no_force_dots :2;
unsigned int allow_lowercase :1;
unsigned int allow_full_ascii :1;
@ -435,6 +456,25 @@ struct ecma119_image
IsoFileSrc *cat; /**< location of the boot catalog in the new image */
IsoFileSrc *bootimg; /**< location of the boot image in the new image */
/*
* System Area related information
*/
/* Content of an embedded boot image. Valid if not NULL.
* In that case it must point to a memory buffer at least 32 kB.
*/
char *system_area_data;
/*
* bit0= make bytes 446 - 512 of the system area a partition
* table which reserves partition 1 from byte 63*512 to the
* end of the ISO image. Assumed are 63 secs/hed, 255 head/cyl.
* (GRUB protective msdos label.)
* This works with and without system_area_data.
* bit1= apply isohybrid MBR patching to the system area.
* This works only with system_area_data plus ISOLINUX boot image
* and only if not bit0 is set.
*/
int system_area_options;
/*
* Number of pad blocks that we need to write. Padding blocks are blocks
* filled by 0s that we put between the directory structures and the file
@ -491,6 +531,16 @@ struct ecma119_image
/* writer thread descriptor */
pthread_t wthread;
pthread_attr_t th_attr;
/* User settable PVD time stamps */
time_t vol_creation_time;
time_t vol_modification_time;
time_t vol_expiration_time;
time_t vol_effective_time;
/* To eventually override vol_creation_time and vol_modification_time
* by unconverted string with timezone 0
*/
char vol_uuid[17];
};
#define BP(a,b) [(b) - (a) + 1]

View File

@ -3,8 +3,9 @@
* Copyright (c) 2009 Thomas Schmitt
*
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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 "ecma119_tree.h"
@ -63,18 +64,18 @@ int get_iso_name(Ecma119Image *img, IsoNode *iso, char **name)
} else {
if (img->max_37_char_filenames) {
isoname = iso_r_fileid(ascii_name, 36, relaxed,
img->no_force_dots ? 0 : 1);
(img->no_force_dots & 1) ? 0 : 1);
} else if (img->iso_level == 1) {
if (relaxed) {
isoname = iso_r_fileid(ascii_name, 11, relaxed,
img->no_force_dots ? 0 : 1);
(img->no_force_dots & 1) ? 0 : 1);
} else {
isoname = iso_1_fileid(ascii_name);
}
} else {
if (relaxed) {
isoname = iso_r_fileid(ascii_name, 30, relaxed,
img->no_force_dots ? 0 : 1);
(img->no_force_dots & 1) ? 0 : 1);
} else {
isoname = iso_2_fileid(ascii_name);
}

View File

@ -2,8 +2,9 @@
* Copyright (c) 2007 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*/
#ifndef LIBISO_ECMA119_TREE_H_

View File

@ -2,8 +2,9 @@
* Copyright (c) 2007 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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 "eltorito.h"
@ -332,9 +333,11 @@ int create_image(IsoImage *image, const char *image_path,
boot->image = (IsoFile*)imgfile;
iso_node_ref(imgfile); /* get our ref */
boot->bootable = 1;
boot->isolinux_options = 0;
boot->type = boot_media_type;
boot->load_size = load_sectors;
boot->partition_type = partition_type;
boot->load_seg = 0;
boot->load_size = load_sectors;
if (bootimg) {
*bootimg = boot;
@ -407,7 +410,7 @@ int iso_image_set_boot_image(IsoImage *image, const char *image_path,
}
/* creates the catalog with the given image */
catalog = malloc(sizeof(struct el_torito_boot_catalog));
catalog = calloc(1, sizeof(struct el_torito_boot_catalog));
if (catalog == NULL) {
ret = ISO_OUT_OF_MEM;
goto boot_image_cleanup;
@ -702,11 +705,11 @@ int catalog_stream_new(Ecma119Image *target, IsoStream **stream)
return ISO_NULL_POINTER;
}
str = malloc(sizeof(IsoStream));
str = calloc(1, sizeof(IsoStream));
if (str == NULL) {
return ISO_OUT_OF_MEM;
}
data = malloc(sizeof(struct catalog_stream));
data = calloc(1, sizeof(struct catalog_stream));
if (str == NULL) {
free(str);
return ISO_OUT_OF_MEM;
@ -740,7 +743,7 @@ int el_torito_catalog_file_src_create(Ecma119Image *target, IsoFileSrc **src)
return ISO_SUCCESS;
}
file = malloc(sizeof(IsoFileSrc));
file = calloc(1, sizeof(IsoFileSrc));
if (file == NULL) {
return ISO_OUT_OF_MEM;
}
@ -753,6 +756,7 @@ int el_torito_catalog_file_src_create(Ecma119Image *target, IsoFileSrc **src)
/* fill fields */
file->prev_img = 0; /* TODO allow copy of old img catalog???? */
file->checksum_index = 0;
file->nsections = 1;
file->sections = calloc(1, sizeof(struct iso_file_section));
file->sort_weight = 1000; /* slightly high */
@ -839,7 +843,7 @@ int eltorito_writer_compute_data_blocks(IsoImageWriter *writer)
IsoStream *new = NULL;
IsoStream *original = t->bootimg->stream;
size = (size_t) iso_stream_get_size(original);
buf = malloc(size);
buf = calloc(1, size);
if (buf == NULL) {
return ISO_OUT_OF_MEM;
}
@ -921,7 +925,7 @@ int eltorito_writer_create(Ecma119Image *target)
IsoFile *bootimg;
IsoFileSrc *src;
writer = malloc(sizeof(IsoImageWriter));
writer = calloc(1, sizeof(IsoImageWriter));
if (writer == NULL) {
return ISO_OUT_OF_MEM;
}

View File

@ -2,8 +2,9 @@
* Copyright (c) 2007 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*/
/**
@ -38,7 +39,8 @@ struct el_torito_boot_image {
/**
* isolinux options
* bit 0 -> whether to patch image
* bit 1 -> whether to create isolinux image
* bit 1 -> whether to put built-in isolinux 3.72 isohybrid-MBR into image
* System Area (deprecated)
*/
unsigned int isolinux_options:2;
unsigned char type; /**< The type of image */

View File

@ -2,8 +2,9 @@
* Copyright (c) 2007 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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 "filesrc.h"
@ -23,6 +24,11 @@
#include <limits.h>
#ifndef PATH_MAX
#define PATH_MAX Libisofs_default_path_maX
#endif
int iso_file_src_cmp(const void *n1, const void *n2)
{
int ret;
@ -132,11 +138,11 @@ int iso_file_src_create(Ecma119Image *img, IsoFile *file, IsoFileSrc **src)
if ((img->md5_file_checksums & 1) && !no_md5) {
img->checksum_idx_counter++;
if (img->checksum_idx_counter < 0x80000000) {
if (img->checksum_idx_counter < 0x7fffffff) {
fsrc->checksum_index = img->checksum_idx_counter;
} else {
fsrc->checksum_index= 0;
img->checksum_idx_counter= 0x80000000; /* keep from rolling over */
img->checksum_idx_counter= 0x7fffffff; /* keep from rolling over */
}
cret = iso_file_set_isofscx(file, (*src)->checksum_index, 0);
if (cret < 0)
@ -499,7 +505,8 @@ int filesrc_writer_write_data(IsoImageWriter *writer)
#ifdef Libisofs_with_checksumS
if (file->checksum_index > 0) {
if (file->checksum_index > 0 &&
file->checksum_index <= t->checksum_idx_counter) {
/* Obtain checksum and dispose checksum context */
res = iso_md5_end(&ctx, md5);
if (res <= 0)
@ -550,7 +557,7 @@ int iso_file_src_writer_create(Ecma119Image *target)
{
IsoImageWriter *writer;
writer = malloc(sizeof(IsoImageWriter));
writer = calloc(1, sizeof(IsoImageWriter));
if (writer == NULL) {
return ISO_OUT_OF_MEM;
}

View File

@ -2,8 +2,9 @@
* Copyright (c) 2007 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*/
#ifndef LIBISO_FILESRC_H_
#define LIBISO_FILESRC_H_

View File

@ -3,8 +3,9 @@
* Copyright (c) 2009 Thomas Schmitt
*
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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"

View File

@ -2,8 +2,9 @@
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*/
#ifndef LIBISO_FILTER_H_
#define LIBISO_FILTER_H_

View File

@ -2,8 +2,9 @@
* Copyright (c) 2009 Thomas Schmitt
*
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*
* It implements a filter facility which can pipe a IsoStream into an external
* process, read its output and forward it as IsoStream output to an IsoFile.

View File

@ -2,8 +2,9 @@
* Copyright (c) 2009 Thomas Schmitt
*
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*
* It implements a filter facility which can pipe a IsoStream into gzip
* compression resp. uncompression, read its output and forward it as IsoStream

View File

@ -2,8 +2,9 @@
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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"

View File

@ -2,8 +2,9 @@
* Copyright (c) 2009 Thomas Schmitt
*
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*
* It implements a filter facility which can pipe a IsoStream into zisofs
* compression resp. uncompression, read its output and forward it as IsoStream
@ -912,6 +913,8 @@ int ziso_filter_get_uncompressor(FilterContext *filter, IsoStream *original,
}
#ifdef Libisofs_with_zliB
/* Produce a parameter object suitable for iso_file_add_filter().
* It may be disposed by free() after all those calls are made.
*
@ -938,6 +941,7 @@ int ziso_create_context(FilterContext **filter, int flag)
return ISO_SUCCESS;
}
#endif /* Libisofs_with_zliB */
/*
* @param flag bit0= if_block_reduction rather than if_reduction

View File

@ -2,8 +2,9 @@
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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"

View File

@ -3,8 +3,9 @@
* Copyright (c) 2009 Thomas Schmitt
*
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*/
/*
@ -30,6 +31,11 @@
#include <stdio.h>
#ifndef PATH_MAX
#define PATH_MAX Libisofs_default_path_maX
#endif
/**
* Options for image reading.
* There are four kind of options:
@ -96,6 +102,12 @@ struct iso_read_opts
*/
int auto_input_charset;
/**
* Enable or disable loading of the first 32768 bytes of the session and
* submission by iso_write_opts_set_system_area(data, 0).
*/
int load_system_area;
};
/**
@ -2945,7 +2957,7 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
struct iso_read_opts *opts,
IsoReadImageFeatures **features)
{
int ret, hflag;
int ret, hflag, i;
IsoImageFilesystem *fs;
IsoFilesystem *fsback;
IsoNodeBuilder *blback;
@ -2953,9 +2965,9 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
IsoFileSource *newroot;
_ImageFsData *data;
struct el_torito_boot_catalog *oldbootcat;
uint8_t *rpt;
#ifdef Libisofs_with_checksumS
int i;
uint32_t old_checksum_start_lba;
uint32_t old_checksum_end_lba;
uint32_t old_checksum_idx_count;
@ -2963,7 +2975,6 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
char checksum_type[81];
uint32_t checksum_size;
size_t size;
uint8_t *rpt;
void *ctx = NULL;
char md5[16];
#endif
@ -2972,12 +2983,30 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
return ISO_NULL_POINTER;
}
ret = iso_image_filesystem_new(src, opts, image->id, &fs);
if (ret < 0) {
return ret;
}
data = fs->data;
if (opts->load_system_area) {
if (image->system_area_data != NULL)
free(image->system_area_data);
image->system_area_data = calloc(32768, 1);
if (image->system_area_data == NULL)
return ISO_OUT_OF_MEM;
image->system_area_options = 0;
/* Read 32768 bytes */
for (i = 0; i < 16; i++) {
rpt = (uint8_t *) (image->system_area_data + i * 2048);
ret = src->read_block(src, opts->block + i, rpt);
if (ret < 0)
return ret;
}
}
/* get root from filesystem */
ret = fs->get_root(fs, &newroot);
if (ret < 0) {
@ -3326,8 +3355,9 @@ int iso_read_opts_new(IsoReadOpts **opts, int profile)
ropts->file_mode = 0444;
ropts->dir_mode = 0555;
ropts->noaaip= 1;
ropts->nomd5= 1;
ropts->noaaip = 1;
ropts->nomd5 = 1;
ropts->load_system_area = 0;
*opts = ropts;
return ISO_SUCCESS;
@ -3463,6 +3493,15 @@ int iso_read_opts_auto_input_charset(IsoReadOpts *opts, int mode)
return ISO_SUCCESS;
}
int iso_read_opts_load_system_area(IsoReadOpts *opts, int mode)
{
if (opts == NULL) {
return ISO_NULL_POINTER;
}
opts->load_system_area = mode & 1;
return ISO_SUCCESS;
}
/**
* Destroy an IsoReadImageFeatures object obtained with iso_image_import.
*/

View File

@ -3,8 +3,9 @@
* Copyright (c) 2009 Thomas Schmitt
*
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*/
/*

View File

@ -2,8 +2,9 @@
* Copyright (c) 2007 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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 "fsource.h"

View File

@ -3,8 +3,9 @@
* Copyright (c) 2009 Thomas Schmitt
*
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*/
#ifndef LIBISO_FSOURCE_H_

View File

@ -3,8 +3,9 @@
* Copyright (c) 2009 Thomas Schmitt
*
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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"
@ -73,6 +74,8 @@ int iso_image_new(const char *name, IsoImage **image)
img->volset_id = strdup(name);
img->volume_id = strdup(name);
}
img->system_area_data = NULL;
img->system_area_options = 0;
img->builder_ignore_acl = 1;
img->builder_ignore_ea = 1;
img->inode_counter = 0;
@ -330,6 +333,16 @@ int iso_image_get_msg_id(IsoImage *image)
return image->id;
}
int iso_image_get_system_area(IsoImage *img, char system_area_data[32768],
int *options, int flag)
{
*options = img->system_area_options;
if (img->system_area_data == NULL)
return 0;
memcpy(system_area_data, img->system_area_data, 32768);
return 1;
}
static
int dir_update_size(IsoImage *image, IsoDir *dir)
{

View File

@ -3,8 +3,9 @@
* Copyright (c) 2009 Thomas Schmitt
*
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*/
#ifndef LIBISO_IMAGE_H_
#define LIBISO_IMAGE_H_
@ -52,6 +53,11 @@ struct Iso_Image
/* el-torito boot catalog */
struct el_torito_boot_catalog *bootcat;
/* Eventually loaded system area data, or NULL */
char *system_area_data;
/* Prescribed/detected options, see iso_write_opts_set_system_area() */
int system_area_options;
/* image identifier, for message origin identifier */
int id;

View File

@ -2,8 +2,9 @@
* Copyright (c) 2007 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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 "iso1999.h"

View File

@ -2,8 +2,9 @@
* Copyright (c) 2007 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*/
/**

View File

@ -3,8 +3,9 @@
* Copyright (c) 2007 Mario Danic
*
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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 "joliet.h"
@ -42,7 +43,7 @@ int get_joliet_name(Ecma119Image *t, IsoNode *iso, uint16_t **name)
if (iso->type == LIBISO_DIR) {
jname = iso_j_dir_id(ucs_name);
} else {
jname = iso_j_file_id(ucs_name);
jname = iso_j_file_id(ucs_name, !!(t->no_force_dots & 2));
}
free(ucs_name);
if (jname != NULL) {
@ -573,7 +574,7 @@ size_t calc_dirent_len(Ecma119Image *t, JolietNode *n)
{
/* note than name len is always even, so we always need the pad byte */
int ret = n->name ? ucslen(n->name) * 2 + 34 : 34;
if (n->type == JOLIET_FILE && !t->omit_version_numbers) {
if (n->type == JOLIET_FILE && !(t->omit_version_numbers & 3)) {
/* take into account version numbers */
ret += 4;
}
@ -721,7 +722,7 @@ void write_one_dir_record(Ecma119Image *t, JolietNode *node, int file_id,
memcpy(rec->file_id, name, len_fi);
if (node->type == JOLIET_FILE && !t->omit_version_numbers) {
if (node->type == JOLIET_FILE && !(t->omit_version_numbers & 3)) {
len_dr += 4;
rec->file_id[len_fi++] = 0;
rec->file_id[len_fi++] = ';';
@ -898,7 +899,7 @@ int write_one_dir(Ecma119Image *t, JolietNode *dir)
/* compute len of directory entry */
fi_len = ucslen(child->name) * 2;
len = fi_len + 34;
if (child->type == JOLIET_FILE && !t->omit_version_numbers) {
if (child->type == JOLIET_FILE && !(t->omit_version_numbers & 3)) {
len += 4;
}

View File

@ -3,8 +3,9 @@
* Copyright (c) 2007 Mario Danic
*
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*/
/**

View File

@ -2,7 +2,7 @@
/* libiso_msgs (generated from libdax_msgs : Fri Feb 22 19:42:52 CET 2008)
Message handling facility of libisofs.
Copyright (C) 2006 - 2008 Thomas Schmitt <scdbackup@gmx.net>,
provided under GPL version 2
provided under GPL version 2 or later
*/
#include <stdio.h>

View File

@ -2,7 +2,7 @@
/* libiso_msgs (generated from libdax_msgs : Fri Feb 22 19:42:52 CET 2008)
Message handling facility of libisofs.
Copyright (C) 2006-2008 Thomas Schmitt <scdbackup@gmx.net>,
provided under GPL version 2
provided under GPL version 2 or later
*/

View File

@ -3,13 +3,14 @@
* Copyright (c) 2009 Thomas Schmitt
*
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*/
/*
*
* Applications must use 64 bit off_t, e.g. on 32-bit Linux by defining
* Applications must use 64 bit off_t, e.g. on 32-bit GNU/Linux by defining
* #define _LARGEFILE_SOURCE
* #define _FILE_OFFSET_BITS 64
* or take special precautions to interface with the library by 64 bit integers
@ -373,7 +374,7 @@ extern unsigned int iso_fs_global_id;
* access and read file contents. Note that this doesn't need to be tied
* to the disc filesystem used in the partition being accessed. For example,
* we have an IsoFilesystem implementation to access any mounted filesystem,
* using standard Linux functions. It is also legal, of course, to implement
* using standard POSIX functions. It is also legal, of course, to implement
* an IsoFilesystem to deal with a specific filesystem over raw partitions.
* That is what we do, for example, to access an ISO Image.
*
@ -483,7 +484,7 @@ struct IsoFileSource_Iface
int version;
/**
* Get the path, relative to the filesystem this file source belongs to.
* Get the absolute path in the filesystem this file source belongs to.
*
* @return
* the path of the FileSource inside the filesystem, it should be
@ -1090,7 +1091,7 @@ int iso_lib_is_compatible(int major, int minor, int micro);
*/
#define iso_lib_header_version_major 0
#define iso_lib_header_version_minor 6
#define iso_lib_header_version_micro 24
#define iso_lib_header_version_micro 30
/**
* Usage discussion:
@ -1285,7 +1286,9 @@ int iso_write_opts_set_aaip(IsoWriteOpts *opts, int enable);
* Omit the version number (";1") at the end of the ISO-9660 identifiers.
* This breaks ECMA-119 specification, but version numbers are usually not
* used, so it should work on most systems. Use with caution.
*
* @param omit
* bit0= omit version number with ECMA-119 and Joliet
* bit1= omit version number with Joliet alone (@since 0.6.30)
* @since 0.6.2
*/
int iso_write_opts_set_omit_version_numbers(IsoWriteOpts *opts, int omit);
@ -1323,6 +1326,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
* this to 1 to prevent this behavior.
* This breaks ECMA-119 specification. Use with caution.
* @param no
* bit0= no forced dot with ECMA-119
* bit1= no forced dot with Joliet (@since 0.6.30)
*
* @since 0.6.2
*/
@ -1679,6 +1685,75 @@ int iso_write_opts_set_overwrite_buf(IsoWriteOpts *opts, uint8_t *overwrite);
*/
int iso_write_opts_set_fifo_size(IsoWriteOpts *opts, size_t fifo_size);
/*
* Attach 32 kB of binary data which shall get written to the first 32 kB
* of the ISO image, the ECMA-119 System Area. This space is intended for
* system dependent boot software, e.g. a Master Boot Record which allows to
* boot from USB sticks or hard disks. ECMA-119 makes no own assumptions or
* prescriptions about the byte content.
*
* If system area data are given or options bit0 is set, then bit1 of
* el_torito_set_isolinux_options() is automatically disabled.
* @param data
* Either NULL or 32 kB of data. Do not submit less bytes !
* @param options
* Can cause manipulations of submitted data before they get written:
* bit0= apply a --protective-msdos-label as of grub-mkisofs.
* This means to patch bytes 446 to 512 of the system area so
* that one partition is defined which begins at the second
* 512-byte block of the image and ends where the image ends.
* This works with and without system_area_data.
* bit1= apply isohybrid MBR patching to the system area.
* This works only with system area data from SYSLINUX plus an
* ISOLINUX boot image (see iso_image_set_boot_image()) and
* only if not bit0 is set.
* @param flag
* bit0 = invalidate any attached system area data. Same as data == NULL
* (This re-activates eventually loaded image System Area data.
* To erase those, submit 32 kB of zeros without flag bit0.)
* bit1 = keep data unaltered
* bit2 = keep options unaltered
* @return
* ISO_SUCCESS or error
* @since 0.6.30
*/
int iso_write_opts_set_system_area(IsoWriteOpts *opts, char data[32768],
int options, int flag);
/**
* Explicitely set the four timestamps of the emerging Primary Volume
* Descriptor. Default with all parameters is 0.
* ECMA-119 defines them as:
* @param vol_creation_time
* When "the information in the volume was created."
* A value of 0 means that the timepoint of write start is to be used.
* @param vol_modification_time
* When "the information in the volume was last modified."
* A value of 0 means that the timepoint of write start is to be used.
* @param vol_expiration_time
* When "the information in the volume may be regarded as obsolete."
* A value of 0 means that the information never shall expire.
* @param vol_effective_time
* When "the information in the volume may be used."
* A value of 0 means that not such retention is intended.
* @param uuid
* If this text is not empty, then it overrides vol_creation_time and
* vol_modification_time by copying the first 16 decimal digits from
* uuid, eventually padding up with decimal '1', and writing a NUL-byte
* as timezone.
* Other than with vol_*_time the resulting string in the ISO image
* is fully predictable and free of timezone pitfalls.
* It should express a reasonable time in form YYYYMMDDhhmmsscc
* E.g.: "2010040711405800" = 7 Apr 2010 11:40:58 (+0 centiseconds)
*
* @since 0.6.30
*/
int iso_write_opts_set_pvd_times(IsoWriteOpts *opts,
time_t vol_creation_time, time_t vol_modification_time,
time_t vol_expiration_time, time_t vol_effective_time,
char *vol_uuid);
/**
* Inquire the start address of the file data blocks after having used
* IsoWriteOpts with iso_image_create_burn_source().
@ -1921,6 +1996,20 @@ int iso_read_opts_set_input_charset(IsoReadOpts *opts, const char *charset);
*/
int iso_read_opts_auto_input_charset(IsoReadOpts *opts, int mode);
/**
* Enable or disable loading of the first 32768 bytes of the session.
*
* @param mode
* Bitfield for control purposes:
* bit0= Load System Area data and attach them to the image so that they
* get written by the next session, if not overridden by
* iso_write_opts_set_system_area().
* Submit any other bits with value 0.
*
* @since 0.6.30
*
*/
int iso_read_opts_load_system_area(IsoReadOpts *opts, int mode);
/**
* Import a previous session or image, for growing or modify.
@ -2202,8 +2291,8 @@ const char *iso_image_get_biblio_file_id(const IsoImage *image);
* The image to make bootable. If it was already bootable this function
* returns an error and the image remains unmodified.
* @param image_path
* The path on the image tree of a regular file to use as default boot
* image.
* The absolute path on the image tree of a regular file to use as
* default boot image.
* @param type
* The boot media type. This can be one of 3 types:
* - Floppy emulation: Boot image file must be exactly
@ -2213,9 +2302,9 @@ const char *iso_image_get_biblio_file_id(const IsoImage *image);
* - No emulation. You should specify load segment and load size
* of image.
* @param catalog_path
* The path on the image tree where the catalog will be stored. The
* directory component of this path must be a directory existent on the
* image tree, and the filename component must be unique among all
* The absolute path in the image tree where the catalog will be stored.
* The directory component of this path must be a directory existent on
* the image tree, and the filename component must be unique among all
* children of that directory on image. Otherwise a correspodent error
* code will be returned. This function will add an IsoBoot node that acts
* as a placeholder for the real catalog, that will be generated at image
@ -2324,19 +2413,27 @@ void el_torito_set_no_bootable(ElToritoBootImage *bootimg);
void el_torito_patch_isolinux_image(ElToritoBootImage *bootimg);
/**
* Specifies options for IsoLinux boot images. This should only be used with
* isolinux boot images.
* Specifies options for ISOLINUX or GRUB boot images. This should only be used
* if the type of boot image is known.
*
* @param options
* bitmask style flag. The following values are defined:
*
* bit 0 -> 1 to path the image, 0 to not
* Patching the image involves the writing of a 56 bytes
* boot information table at offset 8 of the boot image file.
* The original boot image file will not be modified. This is
* needed to allow isolinux images to be bootable.
* bit 1 -> 1 to generate an hybrid image with MBR, 0 to not
* An hybrid image is a boot image that boots from either
* bit 0 -> 1 to patch the boot info table of the boot image.
* 1 does the same as mkisofs option -boot-info-table.
* Needed for ISOLINUX and for GRUB rescue boot images.
* The table is located at byte 8 of the boot image file.
* Its size is 56 bytes.
* The original boot image file on disk will not be modified.
*
* bit 1 -> 1 to generate a ISOLINUX isohybrid image with MBR.
* ----------------------------------------------------------
* @deprecated since 31 Mar 2010:
* The author of syslinux, H. Peter Anvin requested that this
* feature shall not be used any more. He intends to cease
* support for the MBR template that is included in libisofs.
* ----------------------------------------------------------
* A hybrid image is a boot image that boots from either
* CD/DVD media or from disk-like media, e.g. USB stick.
* For that you need isolinux.bin from SYSLINUX 3.72 or later.
* IMPORTANT: The application has to take care that the image
@ -2349,6 +2446,28 @@ void el_torito_patch_isolinux_image(ElToritoBootImage *bootimg);
*/
int el_torito_set_isolinux_options(ElToritoBootImage *bootimg, int options, int flag);
/**
* Obtain a copy of the eventually loaded first 32768 bytes of the imported
* session, the System Area.
* It will be written to the start of the next session unless it gets
* overwritten by iso_write_opts_set_system_area().
*
* @param img
* The image to be inquired.
* @param data
* A byte array of at least 32768 bytesi to take the loaded bytes.
* @param options
* The option bits which will be applied if not overridden by
* iso_write_opts_set_system_area(). See there.
* @param flag
* Bitfield for control purposes, unused yet, submit 0
* @return
* 1 on success, 0 if no System Area was loaded, < 0 error.
* @since 0.6.30
*/
int iso_image_get_system_area(IsoImage *img, char data[32768],
int *options, int flag);
/**
* Increments the reference counting of the given node.
*
@ -2575,14 +2694,14 @@ time_t iso_node_get_ctime(const IsoNode *node);
/**
* Set if the node will be hidden in RR/ISO tree, Joliet tree or both.
*
* If the file is set as hidden in one tree, it won't be included there, so
* If the file is set as hidden in one tree, it wil not be included there, so
* it won't be visible in a OS accessing CD using that tree. For example,
* GNU/Linux systems access to Rock Ridge / ISO9960 tree in order to see
* what is recorded on CD, while MS Windows make use of the Joliet tree. If a
* file is hidden only in Joliet, it won't be visible in Windows systems,
* while still visible in Linux.
* 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 won't be written to image.
* If a file is hidden in both trees, it will not be written to image.
*
* @param node
* The node that is to be hidden.
@ -3346,8 +3465,8 @@ void iso_tree_set_ignore_special(IsoImage *image, int skip);
int iso_tree_get_ignore_special(IsoImage *image);
/**
* Add a excluded path. These are paths that won't never added to image,
* and will be excluded even when adding recursively its parent directory.
* Add a excluded path. These are paths that won't never added to image, and
* will be excluded even when adding recursively its parent directory.
*
* For example, in
*
@ -3439,7 +3558,9 @@ void iso_tree_set_report_callback(IsoImage *image,
* @param parent
* The directory in the image tree where the node will be added.
* @param path
* The path of the file to add in the filesystem.
* The absolute path of the file in the local filesystem.
* The node will have the same leaf name as the file on disk.
* Its directory path depends on the parent node.
* @param node
* place where to store a pointer to the newly added file. No
* extra ref is addded, so you will need to call iso_node_ref() if you
@ -3469,9 +3590,10 @@ int iso_tree_add_node(IsoImage *image, IsoDir *parent, const char *path,
* @param parent
* The directory in the image tree where the node will be added.
* @param name
* The name that the node will have on image.
* The leaf name that the node will have on image.
* Its directory path depends on the parent node.
* @param path
* The path of the file to add in the filesystem.
* The absolute path of the file in the local filesystem.
* @param node
* place where to store a pointer to the newly added file. No
* extra ref is addded, so you will need to call iso_node_ref() if you
@ -3490,24 +3612,25 @@ int iso_tree_add_new_node(IsoImage *image, IsoDir *parent, const char *name,
const char *path, IsoNode **node);
/**
* Add a new node to the image tree, from an existing file, and with the
* given name, that must not exist on dir. The node will be cut-out to the
* submitted size, and its contents will be read from the given offset. This
* function is thus suitable for adding only a piece of a file to the image.
* Add a new node to the image tree with the given name that must not exist
* on dir. The node data content will be a byte interval out of the data
* content of a file in the local filesystem.
*
* @param image
* The image
* @param parent
* The directory in the image tree where the node will be added.
* @param name
* The name that the node will have on image.
* The leaf name that the node will have on image.
* Its directory path depends on the parent node.
* @param path
* The path of the file to add in the filesystem. For now only regular
* files and symlinks to regular files are supported.
* The absolute path of the file in the local filesystem. For now
* only regular files and symlinks to regular files are supported.
* @param offset
* Offset on the given file from where to start reading data.
* Byte number in the given file from where to start reading data.
* @param size
* Max size of the file.
* Max size of the file. This may be more than actually available from
* byte offset to the end of the file in the local filesystem.
* @param node
* place where to store a pointer to the newly added file. No
* extra ref is addded, so you will need to call iso_node_ref() if you
@ -3550,7 +3673,7 @@ int iso_tree_add_new_cut_out_node(IsoImage *image, IsoDir *parent,
int iso_tree_add_dir_rec(IsoImage *image, IsoDir *parent, const char *dir);
/**
* Locate a node by its path on image.
* Locate a node by its absolute path on image.
*
* @param node
* Location for a pointer to the node, it will filled with NULL if the
@ -3567,7 +3690,7 @@ int iso_tree_add_dir_rec(IsoImage *image, IsoDir *parent, const char *dir);
int iso_tree_path_to_node(IsoImage *image, const char *path, IsoNode **node);
/**
* Get the path on image of the given node.
* Get the absolute path on image of the given node.
*
* @return
* The path on the image, that must be freed when no more needed. If the
@ -3593,11 +3716,10 @@ void iso_data_source_unref(IsoDataSource *src);
/**
* Create a new IsoDataSource from a local file. This is suitable for
* accessing regular .iso images, or to acces drives via its block device
* and standard POSIX I/O calls.
* accessing regular files or block devices with ISO images.
*
* @param path
* The path of the file
* The absolute path of the file
* @param src
* Will be filled with the pointer to the newly created data source.
* @return
@ -3832,8 +3954,7 @@ void iso_file_source_unref(IsoFileSource *src);
*/
/**
* Get the path, relative to the filesystem this file source
* belongs to.
* Get the absolute path in the filesystem this file source belongs to.
*
* @return
* the path of the FileSource inside the filesystem, it should be
@ -4361,7 +4482,7 @@ int aaip_xinfo_func(void *data, int flag);
* @param default_text
* Will return a pointer to the eventual "default" ACL or NULL if it
* is not available.
* (Linux directories can have a "default" ACL which influences
* (GNU/Linux directories can have a "default" ACL which influences
* the permissions of newly created files.)
* @param flag
* Bitfield for control purposes
@ -4398,7 +4519,7 @@ int iso_node_get_acl_text(IsoNode *node,
* @param default_text
* The text to be set into effect as "default" ACL. NULL will delete an
* eventually existing "default" ACL of the node.
* (Linux directories can have a "default" ACL which influences
* (GNU/Linux directories can have a "default" ACL which influences
* the permissions of newly created files.)
* @param flag
* Bitfield for control purposes
@ -4549,7 +4670,7 @@ int iso_node_set_attrs(IsoNode *node, size_t num_attrs, char **names,
* Get an ACL of the given file in the local filesystem in long text form.
*
* @param disk_path
* Path to the file
* Absolute path to the file
* @param text
* Will return a pointer to the ACL text. If not NULL the text will be
* 0 terminated and finally has to be disposed by a call to this function
@ -4564,7 +4685,7 @@ int iso_node_set_attrs(IsoNode *node, size_t num_attrs, char **names,
* @return
* 1 ok
* 2 ok, trivial ACL found while bit4 is set, *text is NULL
* 0 no ACL manipulation adapter available
* 0 no ACL manipulation adapter available / ACL not supported on fs
* -1 failure of system ACL service (see errno)
* -2 attempt to inquire ACL of a symbolic link without bit4 or bit5
* resp. with no suitable link target
@ -4579,7 +4700,7 @@ int iso_local_get_acl_text(char *disk_path, char **text, int flag);
* in long text form.
*
* @param disk_path
* Path to the file
* Absolute path to the file
* @param text
* The input text (0 terminated, ACL long text form)
* @param flag
@ -4604,7 +4725,7 @@ int iso_local_set_acl_text(char *disk_path, char *text, int flag);
* necessary if the permissions of a disk file with ACL shall be copied to
* an object which has no ACL.
* @param disk_path
* Path to the local file which may have an "access" ACL or not.
* Absolute path to the local file which may have an "access" ACL or not.
* @param flag
* Bitfield for control purposes
* bit5= in case of symbolic link: inquire link target
@ -4629,7 +4750,7 @@ int iso_local_get_perms_wo_acl(char *disk_path, mode_t *st_mode, int flag);
* will not be put into the result.
*
* @param disk_path
* Path to the file
* Absolute path to the file
* @param num_attrs
* Will return the number of name-value pairs
* @param names
@ -4662,7 +4783,7 @@ int iso_local_get_attrs(char *disk_path, size_t *num_attrs, char ***names,
* Eventual ACLs have to be encoded as attribute pair with empty name.
*
* @param disk_path
* Path to the file
* Absolute path to the file
* @param num_attrs
* Number of attributes
* @param names
@ -4687,6 +4808,11 @@ int iso_local_set_attrs(char *disk_path, size_t num_attrs, char **names,
size_t *value_lengths, char **values, int flag);
/* Default in case that the compile environment has no macro PATH_MAX.
*/
#define Libisofs_default_path_maX 4096
/* --------------------------- Filters in General -------------------------- */
/*

View File

@ -10,6 +10,7 @@
/* for gettimeofday() */
#include <sys/time.h>
/* This code stems from syslinux-3.72/utils/isohybrid, a perl script
under GPL which is Copyright 2002-2008 H. Peter Anvin.
@ -25,13 +26,13 @@ and is now under the licenses to which H.Peter Anvin agreed:
or both, at your option.
Sincerely, H. Peter Anvin
In the context of xorriso-standalone, this code is under GPLv2 derived from
LGPL. In the context of libisofs this code derives its matching open source
In the context of GNU xorriso, this code is under GPLv3+ derived from LGPL.
In the context of libisofs this code derives its matching free software
license from above stem licenses, typically from LGPL.
In case its generosity is needed, here is the 2-clause BSD license:
make_isohybrid_mbr.c is copyright 2002-2008 H. Peter Anvin
and 2008-2009 libburnia project.
and 2008-2010 Thomas Schmitt
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
@ -51,8 +52,9 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* A helper function. One could replace it by one or two macros. */
static int lsb_to_buf(char **wpt, int value, int bits, int flag)
static int lsb_to_buf(char **wpt, uint32_t value, int bits, int flag)
{
int b;
@ -61,6 +63,11 @@ static int lsb_to_buf(char **wpt, int value, int bits, int flag)
return (1);
}
/* ====================================================================== */
/* Deprecated Function */
/* ====================================================================== */
/*
* Create a MBR for an isohybrid enabled ISOLINUX boot image.
*
@ -228,3 +235,214 @@ int make_isohybrid_mbr(int bin_lba, int *img_blocks, char *mbr, int flag)
return (1);
}
/* ====================================================================== */
/* The New MBR Producer */
/* ====================================================================== */
/* The new MBR producer for isohybrid is a slightly generalized version of
the deprecated function make_isohybrid_mbr(). It complies to the urge
of H.Peter Anvin not to hardcode MBR templates but rather to read a
file from the Syslinux tree, and to patch it as was done with the old
MBR producer.
The old algorithm was clarified publicly by the following mail.
Changes towards the old algorithm:
- 512-byte LBA of boot image is extended to 64 bit (we stay with 32)
- check for a magic number is now gone
The new implementation tries to use similar terms as the mail in order
to facilitate its future discussion with Syslinux developers.
From hpa@zytor.com Thu Apr 1 08:32:52 2010
Date: Wed, 31 Mar 2010 14:53:51 -0700
From: H. Peter Anvin <hpa@zytor.com>
To: For discussion of Syslinux and tftp-hpa <syslinux@zytor.com>
Cc: Thomas Schmitt <scdbackup@gmx.net>
Subject: Re: [syslinux] port syslinux isohybrid perl script to C
[...]
[me:]
> Currently i lack of blob and prescriptions.
The blobs are available in the Syslinux build tree under the names:
mbr/isohdp[fp]x*.bin
The default probably should be mbr/isohdppx.bin, but it's ultimately up
to the user.
User definable parameters:
-> MBR ID (default random 32-bit number,
or preserved from previous instance)
-> Sector count (default 32, range 1-63)
-> Head count (default 64, range 1-256)
-> Partition offset (default 0, range 0-64)
-> Partition number (default 1, range 1-4)
-> Filesystem type (default 0x17, range 1-255)
Note: the filesystem type is largely arbitrary, in theory it can be any
value other than 0x00, 0x05, 0x0f, 0x85, 0xee, or 0xef. 0x17 ("Windows
IFS Hidden") seems safeish, some people believe 0x83 (Linux) is better.
Here is the prescriptions for how to install it:
All numbers are littleendian. "word" means 16 bits, "dword" means 32
bits, "qword" means 64 bits.
Common subroutine LBA_to_CHS():
s = (lba % sector_count) + 1
t = (lba / sector_count)
h = (t % head_count)
c = (t / head_count)
if (c >= 1024):
c = 1023
h = head_count
s = sector_count
s = s | ((c & 0x300) >> 2)
c = c & 0xff
write byte h
write byte s
write byte c
Main:
Pad image_size to a multiple of sector_count*head_count
Use the input file unmodified for bytes 0..431
write qword boot_lba # Offset 432
write dword mbr_id # Offset 440
write word 0 # Offset 444
# Offset 446
For each partition entry 1..4:
if this_partition != partition_number:
write 16 zero bytes
else:
write byte 0x80
write LBA_to_CHS(partition_offset)
write byte filesystem_type
write LBA_to_CHS(image_size-1)
write dword partition_offset
write dword image_size
# Offset 510
write word 0xaa55
Use the input file unmodified for bytes 512..32767
(pad with zero as necessary)
[...]
-hpa
*/
static
int lba512chs_to_buf(char **wpt, off_t lba, int head_count, int sector_count)
{
int s, t, h, c;
s = (lba % sector_count) + 1;
t = (lba / sector_count);
h = (t % head_count);
c = (t / head_count);
if (c >= 1024) {
c = 1023;
h = head_count; /* >>> not -1 ? Limits head_count to 255 */
s = sector_count;
}
s = s | ((c & 0x300) >> 2);
c = c & 0xff;
(*((unsigned char **) wpt))[0] = h;
(*((unsigned char **) wpt))[1] = s;
(*((unsigned char **) wpt))[2] = c;
(*wpt)+= 3;
return(1);
}
/*
* @param flag bit0= make own random MBR Id from current time
*/
int make_isolinux_mbr(int32_t *img_blocks, uint32_t boot_lba,
uint32_t mbr_id, int head_count, int sector_count,
int part_offset, int part_number, int fs_type,
uint8_t *buf, int flag)
{
uint32_t spc, id, part, nominal_part_size;
off_t hd_img_blocks, hd_boot_lba;
char *wpt;
/* For generating a weak random number */
struct timeval tv;
struct timezone tz;
/* Pad image_size to a multiple of sector_count*head_count
*/
spc = head_count * sector_count;
hd_img_blocks = ((off_t) *img_blocks) * (off_t) 4;
if (hd_img_blocks % spc) {
hd_img_blocks += spc - (hd_img_blocks % spc);
*img_blocks = hd_img_blocks / 4 + !!(hd_img_blocks % 4);
}
wpt = (char *) buf + 432;
/* write qword boot_lba # Offset 432
*/
hd_boot_lba = ((off_t) boot_lba) * (off_t) 4;
lsb_to_buf(&wpt, hd_boot_lba & 0xffffffff, 32, 0);
lsb_to_buf(&wpt, hd_boot_lba >> 32, 32, 0);
/* write dword mbr_id # Offset 440
(here some 32-bit random value with no crypto strength)
*/
if (flag & 1) {
gettimeofday(&tv, &tz);
id = 0xffffffff & (tv.tv_sec ^ (tv.tv_usec * 2000));
lsb_to_buf(&wpt, id, 32, 0);
}
/* write word 0 # Offset 444
*/
lsb_to_buf(&wpt, 0, 16, 0);
/* # Offset 446
*/
for (part = 1 ; part <= 4; part++) {
if (part != part_number) {
/* if this_partition != partition_number: write 16 zero bytes */
memset(wpt, 0, 16);
wpt+= 16;
continue;
}
/* write byte 0x80
write LBA_to_CHS(partition_offset)
write byte filesystem_type
write LBA_to_CHS(image_size-1)
write dword partition_offset
write dword image_size
*/
lsb_to_buf(&wpt, 0x80, 8, 0);
lba512chs_to_buf(&wpt, part_offset, head_count, sector_count);
lsb_to_buf(&wpt, fs_type, 8, 0);
lba512chs_to_buf(&wpt, hd_img_blocks - 1, head_count, sector_count);
lsb_to_buf(&wpt, part_offset, 32, 0);
if (hd_img_blocks - (off_t) part_offset > (off_t) 0xffffffff)
nominal_part_size = 0xffffffff;
else
nominal_part_size = hd_img_blocks - (off_t) part_offset;
lsb_to_buf(&wpt, nominal_part_size, 32, 0);
}
/* write word 0xaa55 # Offset 510
*/
lsb_to_buf(&wpt, 0xaa55, 16, 0);
return(1);
}

View File

@ -2,8 +2,9 @@
* Copyright (c) 2009 Thomas Schmitt
*
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*/

View File

@ -2,8 +2,9 @@
* Copyright (c) 2009 Thomas Schmitt
*
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*/
#ifndef LIBISO_MD5_H_

View File

@ -2,8 +2,9 @@
* Copyright (c) 2007 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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 <stdlib.h>
#include <sys/types.h>

View File

@ -2,8 +2,9 @@
* Copyright (c) 2007 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*/
/*

View File

@ -3,8 +3,9 @@
* Copyright (c) 2009 Thomas Schmitt
*
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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"
@ -22,6 +23,12 @@
#include <limits.h>
#include <stdio.h>
#ifndef PATH_MAX
#define PATH_MAX Libisofs_default_path_maX
#endif
struct dir_iter_data
{
/* points to the last visited child, to NULL before start */
@ -201,6 +208,7 @@ int iso_node_get_xinfo(IsoNode *node, iso_node_xinfo_func proc, void **data)
return ISO_NULL_POINTER;
}
*data = NULL;
pos = node->xinfo;
while (pos != NULL) {
if (pos->process == proc) {

View File

@ -3,8 +3,9 @@
* Copyright (c) 2009 Thomas Schmitt
*
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*/
#ifndef LIBISO_NODE_H_
#define LIBISO_NODE_H_

View File

@ -4,8 +4,9 @@
* Copyright (c) 2009 Thomas Schmitt
*
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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 "rockridge.h"

View File

@ -4,8 +4,9 @@
* Copyright (c) 2009 Thomas Schmitt
*
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*/
/**

View File

@ -3,8 +3,9 @@
* Copyright (c) 2009 Thomas Schmitt
*
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*/
/*

View File

@ -3,8 +3,9 @@
* Copyright (c) 2009 Thomas Schmitt
*
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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"
@ -17,6 +18,12 @@
#include <limits.h>
#include <stdio.h>
#ifndef PATH_MAX
#define PATH_MAX Libisofs_default_path_maX
#endif
ino_t serial_id = (ino_t)1;
ino_t mem_serial_id = (ino_t)1;
ino_t cut_out_serial_id = (ino_t)1;

View File

@ -3,8 +3,9 @@
* Copyright (c) 2009 Thomas Schmitt
*
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*/
#ifndef LIBISO_STREAM_H_
#define LIBISO_STREAM_H_

View File

@ -1,9 +1,11 @@
/*
* Copyright (c) 2008 Vreixo Formoso
* Copyright (c) 2010 Thomas Schmitt
*
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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 "system_area.h"
@ -11,28 +13,114 @@
#include "filesrc.h"
#include <string.h>
#include <stdio.h>
/*
* Create a MBR for an isohybrid enabled ISOLINUX boot image.
*
* It is assumed that the caller has verified the readiness of the boot image
* by checking for 0xfb 0xc0 0x78 0x70 at bytes 0x40 to 0x43 of isolinux.bin.
*
* @param bin_lba The predicted LBA of isolinux.bin within the emerging ISO.
* @param img_blocks The predicted number of 2048 byte blocks in the ISO.
* It will get rounded up to full MBs and that many blocks
* must really be written as ISO 9660 image.
* @param mbr A buffer of at least 512 bytes to take the result which is
* to be written as the very beginning of the ISO.
* @param flag unused yet, submit 0
* @return <0 = fatal, 0 = failed , 1 = ok , 2 = ok with size warning
* See libisofs/make_isohybrid_mbr.c
* Deprecated.
*/
int make_isohybrid_mbr(int bin_lba, int *img_blocks, char *mbr, int flag);
/*
* The New ISOLINUX MBR Producer.
* Be cautious with changing parameters. Only few combinations are tested.
*
*/
int make_isolinux_mbr(int32_t *img_blocks, uint32_t boot_lba,
uint32_t mbr_id, int head_count, int sector_count,
int part_offset, int part_number, int fs_type,
uint8_t *buf, int flag);
/* 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
"Currently we use first and not last entry. You need to:
1) Zero-fill 446-510
2) Put 0x55, 0xAA into 510-512
3) Put 0x80 (for bootable partition), 0, 2, 0 (C/H/S of the start), 0xcd
(partition type), [3 bytes of C/H/S end], 0x01, 0x00, 0x00, 0x00 (LBA
start in little endian), [LBA end in little endian] at 446-462
"
"C/H/S end" means the CHS address of the last block in the partition.
It seems that not "[LBA end in little endian]" but "number of blocks"
should go into bytes 458-461. But with a start lba of 1, this is the
same number.
See also http://en.wikipedia.org/wiki/Master_boot_record
*/
static
int make_grub_msdos_label(int img_blocks, uint8_t *buf, int flag)
{
uint8_t *wpt;
unsigned long end_lba, secs, end_sec, end_head, end_cyl;
int sph = 63, hpc = 255, i;
/* 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 */
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 */
wpt = buf + 446;
memset(wpt, 0, 64);
/* 2) Put 0x55, 0xAA into 510-512 (actually 510-511) */
buf[510] = 0x55;
buf[511] = 0xAA;
/* 3) Put 0x80 (for bootable partition), */
*(wpt++) = 0x80;
/* 0, 2, 0 (C/H/S of the start), */
*(wpt++) = 0;
*(wpt++) = 2;
*(wpt++) = 0;
/* 0xcd (partition type) */
*(wpt++) = 0xcd;
/* [3 bytes of C/H/S end], */
*(wpt++) = end_head;
*(wpt++) = end_sec | ((end_cyl & 0x300) >> 2);
*(wpt++) = end_cyl & 0xff;
/* 0x01, 0x00, 0x00, 0x00 (LBA start in little endian), */
*(wpt++) = 0x01;
*(wpt++) = 0x00;
*(wpt++) = 0x00;
*(wpt++) = 0x00;
/* [LBA end in little endian] */
for (i = 0; i < 4; i++)
*(wpt++) = (end_lba >> (8 * i)) & 0xff;
/* at 446-462 */
if (wpt - buf != 462) {
fprintf(stderr,
"libisofs: program error in make_grub_msdos_label: \"assert 462\"\n");
return ISO_ASSERT_FAILURE;
}
return ISO_SUCCESS;
}
int iso_write_system_area(Ecma119Image *t, uint8_t *buf)
{
int ret;
int img_blocks;
if ((t == NULL) || (buf == NULL)) {
return ISO_NULL_POINTER;
}
@ -40,26 +128,41 @@ int iso_write_system_area(Ecma119Image *t, uint8_t *buf)
/* set buf to 0s */
memset(buf, 0, 16 * BLOCK_SIZE);
if (t->catalog != NULL && t->catalog->image->isolinux_options & 0x02) {
/* We need to write a MBR for an hybrid image */
int ret;
int img_blocks;
img_blocks = t->curblock;
ret = make_isohybrid_mbr(t->bootimg->sections[0].block, &img_blocks, (char*)buf, 0);
/*
API description of el_torito_set_isolinux_options() prescribes
to pad to full MB.
So this is not urgent any more :
// FIXME the new img_blocks size should be taken into account
*/
img_blocks = t->curblock;
if (t->system_area_data != NULL) {
/* Write more or less opaque boot image */
memcpy(buf, t->system_area_data, 16 * BLOCK_SIZE);
} else if (t->catalog != NULL &&
(t->catalog->image->isolinux_options & 0x0a) == 0x02) {
/* Check for isolinux image with magic number of 3.72 and produce
an MBR from our built-in template. (Deprecated since 31 Mar 2010)
*/
ret = make_isohybrid_mbr(t->bootimg->sections[0].block,
&img_blocks, (char*)buf, 0);
if (ret != 1) {
/* error, it should never happen */
return ISO_ASSERT_FAILURE;
}
return ISO_SUCCESS;
}
if (t->system_area_options & 1) {
/* Write GRUB protective msdos label, i.e. a isimple partition table */
ret = make_grub_msdos_label(img_blocks, buf, 0);
if (ret != 1) /* error should never happen */
return ISO_ASSERT_FAILURE;
} else if(t->system_area_options & 2) {
/* Patch externally provided system area as isohybrid MBR */
if (t->catalog == NULL || t->system_area_data == NULL) {
/* isohybrid makes only sense together with ISOLINUX boot image
and externally provided System Area.
*/
return ISO_ISOLINUX_CANT_PATCH;
}
ret = make_isolinux_mbr(&img_blocks, t->bootimg->sections[0].block,
(uint32_t) 0, 64, 32, 0, 1, 0x17, buf, 1);
if (ret != 1)
return ret;
}
return ISO_SUCCESS;
}

View File

@ -2,8 +2,9 @@
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*/
/*

View File

@ -2,8 +2,9 @@
* Copyright (c) 2007 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*/
/*
@ -25,6 +26,12 @@
#include <stdio.h>
#include <fnmatch.h>
#ifndef PATH_MAX
#define PATH_MAX Libisofs_default_path_maX
#endif
/**
* Add a new directory to the iso tree.
*
@ -914,7 +921,7 @@ int iso_tree_path_to_node(IsoImage *image, const char *path, IsoNode **node)
int result;
IsoNode *n;
IsoDir *dir;
char *ptr, *brk_info, *component;
char *ptr, *brk_info = NULL, *component;
if (image == NULL || path == NULL) {
return ISO_NULL_POINTER;

View File

@ -2,8 +2,9 @@
* Copyright (c) 2007 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*/
#ifndef LIBISO_IMAGE_TREE_H_
#define LIBISO_IMAGE_TREE_H_

View File

@ -1,10 +1,12 @@
/*
* Copyright (c) 2007 Vreixo Formoso
* Copyright (c) 2007 Mario Danic
* Copyright (c) 2009 Thomas Schmitt
*
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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 "util.h"
@ -906,7 +908,10 @@ ex:;
return retval;
}
uint16_t *iso_j_file_id(const uint16_t *src)
/*
bit0= no_force_dots
*/
uint16_t *iso_j_file_id(const uint16_t *src, int flag)
{
uint16_t *dot;
size_t lname, lext, lnname, lnext, pos, i;
@ -952,6 +957,10 @@ uint16_t *iso_j_file_id(const uint16_t *src)
pos++;
}
}
if ((flag & 1) && lnext <= 0)
goto is_done;
set_ucsbe(dest + pos, '.');
pos++;
@ -965,6 +974,8 @@ uint16_t *iso_j_file_id(const uint16_t *src)
pos++;
}
}
is_done:;
set_ucsbe(dest + pos, '\0');
return ucsdup(dest);
}
@ -1204,7 +1215,7 @@ void iso_datetime_7(unsigned char *buf, time_t t, int always_gmt)
}
memset(&tm, 0, sizeof(tm));
tm.tm_isdst = -1; /* some Linuxes change tm_isdst only if it is -1 */
tm.tm_isdst = -1; /* some OSes change tm_isdst only if it is -1 */
localtime_r(&t, &tm);
#ifdef HAVE_TM_GMTOFF
@ -1248,7 +1259,7 @@ void iso_datetime_17(unsigned char *buf, time_t t, int always_gmt)
}
memset(&tm, 0, sizeof(tm));
tm.tm_isdst = -1; /* some Linuxes change tm_isdst only if it is -1 */
tm.tm_isdst = -1; /* some OSes change tm_isdst only if it is -1 */
localtime_r(&t, &tm);
localtime_r(&t, &tm);

View File

@ -1,9 +1,11 @@
/*
* Copyright (c) 2007 Vreixo Formoso
* Copyright (c) 2009 Thomas Schmitt
*
* 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*/
#ifndef LIBISO_UTIL_H_
@ -149,11 +151,12 @@ char *iso_r_fileid(const char *src, size_t len, int relaxed, int forcedot);
* 2 bytes and the resulting string is NULL-terminated by a 2-byte NULL.
*
* Note that version number and (;1) is not appended.
*
* @param flag
* bit0= no_force_dots
* @return
* NULL if the original name and extension both are of length 0.
*/
uint16_t *iso_j_file_id(const uint16_t *src);
uint16_t *iso_j_file_id(const uint16_t *src, int flag);
/**
* Create a Joliet directory identifier that consists of name and optionally
@ -246,20 +249,6 @@ time_t iso_datetime_read_17(const uint8_t *buf);
*/
int iso_eaccess(const char *path);
#ifdef NIX
/* <<< Buggy and not used any more */
/**
* Copy up to \p len chars from \p buf and return this newly allocated
* string. The new string is null-terminated.
* Note:
* Trailing blanks will be removed. But the first one of an all blank string
* persists. It is unclear whether this is a bug or a feature.
*/
char *strcopy(const char *buf, size_t len);
#endif /* NIX */
/**
* Copy up to \p len chars from \p buf and return this newly allocated
* string. The new string is null-terminated.

View File

@ -2,8 +2,9 @@
* Copyright (c) 2007 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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 "util.h"

View File

@ -2,8 +2,9 @@
* Copyright (c) 2007 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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 "util.h"

View File

@ -2,8 +2,9 @@
* Copyright (c) 2007 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 as
* published by the Free Software Foundation. See COPYING file for details.
* 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.
*/
#ifndef LIBISO_IMAGE_WRITER_H_
#define LIBISO_IMAGE_WRITER_H_