Compare commits
7 Commits
ZeroTwoEig
...
ZeroTwoEig
Author | SHA1 | Date | |
---|---|---|---|
07fe40d1d5 | |||
3f65df735c | |||
b904e14de8 | |||
9eaf85691e | |||
114b18c936 | |||
47b64b9ba9 | |||
9d08c115fd |
53
README
53
README
@ -6,7 +6,7 @@ This all is under GPL.
|
||||
------------------------------------------------------------------------------
|
||||
libburnia.pykix.org
|
||||
By Mario Danic <mario.danic@gmail.com> and Thomas Schmitt <scdbackup@gmx.net>
|
||||
Copyright (C) 2006 Mario Danic, Thomas Schmitt
|
||||
Copyright (C) 2006-2007 Mario Danic, Thomas Schmitt
|
||||
|
||||
Still containing parts of
|
||||
Libburn. By Derek Foreman <derek@signalmarketing.com> and
|
||||
@ -19,7 +19,7 @@ commitment as written at the end of this text.
|
||||
The rights and merits of the Libburn-copyright holders Derek Foreman and
|
||||
Ben Jansens will be duely respected.
|
||||
|
||||
This libburnia.pykix.org toplevel README (C) 2006 Thomas Schmitt
|
||||
This libburnia.pykix.org toplevel README (C) 2006-2007 Thomas Schmitt
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Build and Installation
|
||||
@ -54,7 +54,8 @@ See README file there.
|
||||
Overview of libburnia.pykix.org
|
||||
|
||||
libburnia.pykix.org is an open-source software project for reading, mastering
|
||||
and writing optical discs. For now this means only CD-R and CD-RW.
|
||||
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.
|
||||
@ -66,10 +67,10 @@ 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 do have a workable code base for burning data CDs, though. The burn API is
|
||||
quite comprehensively documented and can be used to build a presentable
|
||||
application.
|
||||
We do have a functional binary which emulates parts of cdrecord in order to
|
||||
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.
|
||||
|
||||
@ -78,20 +79,25 @@ 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.
|
||||
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 CD via libburn.
|
||||
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.
|
||||
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 for more.
|
||||
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
|
||||
@ -121,7 +127,7 @@ Project history as far as known to me:
|
||||
It has meanwhile moved to use vanilla libburn.pykix.org , though.
|
||||
Version 0.1.4 constitutes the first release of this kind.
|
||||
|
||||
- In Juli 2006 our team mate Mario Danic announced a revival of libburn
|
||||
- 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.
|
||||
@ -178,13 +184,32 @@ Project history as far as known to me:
|
||||
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.
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
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; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
the Free Software Foundation. To be exact: version 2 of that License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
@ -1,17 +0,0 @@
|
||||
libisofs python bindings
|
||||
========================
|
||||
|
||||
The Python bindings are layered on two levels. The low-level 1:1 mapping of
|
||||
the C API is done through ctypes. The higher level bindings build a
|
||||
pythonic API on that mapping.
|
||||
|
||||
The low-level API is in isofs.core. That file is autogenerated using
|
||||
pyglet's ctypes code generator, which can be found at:
|
||||
|
||||
http://pyglet.googlecode.com/svn/trunk/tools/wraptypes/
|
||||
|
||||
Note that this is not a permanent solution. Right now the generated code
|
||||
is committed to the repository, to facilitate development. In the longer
|
||||
term, the wraptypes tool should be added to the libburnia repository and
|
||||
the core binding generated by the build system.
|
||||
|
@ -1,2 +0,0 @@
|
||||
from defines import *
|
||||
from isofs import IsoFS
|
@ -1,185 +0,0 @@
|
||||
'''Wrapper for isofs
|
||||
|
||||
Generated with:
|
||||
../wraptypes/wrap.py -ocore.py -lisofs ../../../libisofs/libisofs.h
|
||||
|
||||
Do not modify this file.
|
||||
'''
|
||||
|
||||
__docformat__ = 'restructuredtext'
|
||||
__version__ = '$Id: wrap.py 738 2007-03-12 04:53:42Z Alex.Holkner $'
|
||||
|
||||
import ctypes
|
||||
from ctypes import *
|
||||
from ctypes.util import find_library as _find_library
|
||||
|
||||
#_libpath = _find_library('isofs')
|
||||
#if not _libpath:
|
||||
# raise ImportError('Could not locate isofs library')
|
||||
|
||||
# If you are a developer, comment the above three lines and uncomment
|
||||
# the following line, to hardcode the library path.
|
||||
_libpath = 'libisofs.so'
|
||||
|
||||
_lib = cdll.LoadLibrary(_libpath)
|
||||
|
||||
_int_types = (c_int16, c_int32)
|
||||
if hasattr(ctypes, 'c_int64'):
|
||||
# Some builds of ctypes apparently do not have c_int64
|
||||
# defined; it's a pretty good bet that these builds do not
|
||||
# have 64-bit pointers.
|
||||
_int_types += (ctypes.c_int64,)
|
||||
for t in _int_types:
|
||||
if sizeof(t) == sizeof(c_size_t):
|
||||
c_ptrdiff_t = t
|
||||
|
||||
class c_void(Structure):
|
||||
# c_void_p is a buggy return type, converting to int, so
|
||||
# POINTER(None) == c_void_p is actually written as
|
||||
# POINTER(c_void), so it can be treated as a real pointer.
|
||||
_fields_ = [('dummy', c_int)]
|
||||
|
||||
|
||||
|
||||
class struct_iso_volume(Structure):
|
||||
__slots__ = [
|
||||
]
|
||||
struct_iso_volume._fields_ = [
|
||||
('_opaque_struct', c_int)
|
||||
]
|
||||
|
||||
class struct_iso_tree_node(Structure):
|
||||
__slots__ = [
|
||||
]
|
||||
struct_iso_tree_node._fields_ = [
|
||||
('_opaque_struct', c_int)
|
||||
]
|
||||
|
||||
class struct_iso_volset(Structure):
|
||||
__slots__ = [
|
||||
]
|
||||
struct_iso_volset._fields_ = [
|
||||
('_opaque_struct', c_int)
|
||||
]
|
||||
|
||||
class struct_burn_source(Structure):
|
||||
__slots__ = [
|
||||
]
|
||||
struct_burn_source._fields_ = [
|
||||
('_opaque_struct', c_int)
|
||||
]
|
||||
|
||||
# ../../../libisofs/libisofs.h:45
|
||||
iso_volume_new = _lib.iso_volume_new
|
||||
iso_volume_new.restype = POINTER(struct_iso_volume)
|
||||
iso_volume_new.argtypes = [c_char_p, c_char_p, c_char_p]
|
||||
|
||||
# ../../../libisofs/libisofs.h:49
|
||||
iso_volume_new_with_root = _lib.iso_volume_new_with_root
|
||||
iso_volume_new_with_root.restype = POINTER(struct_iso_volume)
|
||||
iso_volume_new_with_root.argtypes = [c_char_p, c_char_p, c_char_p, POINTER(struct_iso_tree_node)]
|
||||
|
||||
# ../../../libisofs/libisofs.h:57
|
||||
iso_volume_free = _lib.iso_volume_free
|
||||
iso_volume_free.restype = None
|
||||
iso_volume_free.argtypes = [POINTER(struct_iso_volume)]
|
||||
|
||||
# ../../../libisofs/libisofs.h:62
|
||||
iso_volset_free = _lib.iso_volset_free
|
||||
iso_volset_free.restype = None
|
||||
iso_volset_free.argtypes = [POINTER(struct_iso_volset)]
|
||||
|
||||
# ../../../libisofs/libisofs.h:67
|
||||
iso_volume_get_root = _lib.iso_volume_get_root
|
||||
iso_volume_get_root.restype = POINTER(struct_iso_tree_node)
|
||||
iso_volume_get_root.argtypes = [POINTER(struct_iso_volume)]
|
||||
|
||||
# ../../../libisofs/libisofs.h:72
|
||||
iso_volume_set_volume_id = _lib.iso_volume_set_volume_id
|
||||
iso_volume_set_volume_id.restype = None
|
||||
iso_volume_set_volume_id.argtypes = [POINTER(struct_iso_volume), c_char_p]
|
||||
|
||||
# ../../../libisofs/libisofs.h:78
|
||||
iso_volume_set_publisher_id = _lib.iso_volume_set_publisher_id
|
||||
iso_volume_set_publisher_id.restype = None
|
||||
iso_volume_set_publisher_id.argtypes = [POINTER(struct_iso_volume), c_char_p]
|
||||
|
||||
# ../../../libisofs/libisofs.h:84
|
||||
iso_volume_set_data_preparer_id = _lib.iso_volume_set_data_preparer_id
|
||||
iso_volume_set_data_preparer_id.restype = None
|
||||
iso_volume_set_data_preparer_id.argtypes = [POINTER(struct_iso_volume), c_char_p]
|
||||
|
||||
# ../../../libisofs/libisofs.h:96
|
||||
iso_tree_volume_path_to_node = _lib.iso_tree_volume_path_to_node
|
||||
iso_tree_volume_path_to_node.restype = POINTER(struct_iso_tree_node)
|
||||
iso_tree_volume_path_to_node.argtypes = [POINTER(struct_iso_volume), c_char_p]
|
||||
|
||||
# ../../../libisofs/libisofs.h:107
|
||||
iso_tree_volume_add_path = _lib.iso_tree_volume_add_path
|
||||
iso_tree_volume_add_path.restype = POINTER(struct_iso_tree_node)
|
||||
iso_tree_volume_add_path.argtypes = [POINTER(struct_iso_volume), c_char_p, c_char_p]
|
||||
|
||||
# ../../../libisofs/libisofs.h:119
|
||||
iso_tree_volume_add_new_dir = _lib.iso_tree_volume_add_new_dir
|
||||
iso_tree_volume_add_new_dir.restype = POINTER(struct_iso_tree_node)
|
||||
iso_tree_volume_add_new_dir.argtypes = [POINTER(struct_iso_volume), c_char_p]
|
||||
|
||||
# ../../../libisofs/libisofs.h:128
|
||||
iso_volset_new = _lib.iso_volset_new
|
||||
iso_volset_new.restype = POINTER(struct_iso_volset)
|
||||
iso_volset_new.argtypes = [POINTER(struct_iso_volume), c_char_p]
|
||||
|
||||
# ../../../libisofs/libisofs.h:141
|
||||
iso_tree_add_node = _lib.iso_tree_add_node
|
||||
iso_tree_add_node.restype = POINTER(struct_iso_tree_node)
|
||||
iso_tree_add_node.argtypes = [POINTER(struct_iso_tree_node), c_char_p]
|
||||
|
||||
# ../../../libisofs/libisofs.h:157
|
||||
iso_tree_radd_dir = _lib.iso_tree_radd_dir
|
||||
iso_tree_radd_dir.restype = POINTER(struct_iso_tree_node)
|
||||
iso_tree_radd_dir.argtypes = [POINTER(struct_iso_tree_node), c_char_p]
|
||||
|
||||
# ../../../libisofs/libisofs.h:166
|
||||
iso_exclude_add_path = _lib.iso_exclude_add_path
|
||||
iso_exclude_add_path.restype = None
|
||||
iso_exclude_add_path.argtypes = [c_char_p]
|
||||
|
||||
# ../../../libisofs/libisofs.h:173
|
||||
iso_exclude_remove_path = _lib.iso_exclude_remove_path
|
||||
iso_exclude_remove_path.restype = None
|
||||
iso_exclude_remove_path.argtypes = [c_char_p]
|
||||
|
||||
# ../../../libisofs/libisofs.h:178
|
||||
iso_exclude_empty = _lib.iso_exclude_empty
|
||||
iso_exclude_empty.restype = None
|
||||
iso_exclude_empty.argtypes = []
|
||||
|
||||
# ../../../libisofs/libisofs.h:191
|
||||
iso_tree_add_new_dir = _lib.iso_tree_add_new_dir
|
||||
iso_tree_add_new_dir.restype = POINTER(struct_iso_tree_node)
|
||||
iso_tree_add_new_dir.argtypes = [POINTER(struct_iso_tree_node), c_char_p]
|
||||
|
||||
# ../../../libisofs/libisofs.h:197
|
||||
iso_tree_node_set_name = _lib.iso_tree_node_set_name
|
||||
iso_tree_node_set_name.restype = None
|
||||
iso_tree_node_set_name.argtypes = [POINTER(struct_iso_tree_node), c_char_p]
|
||||
|
||||
# ../../../libisofs/libisofs.h:204
|
||||
iso_tree_print = _lib.iso_tree_print
|
||||
iso_tree_print.restype = None
|
||||
iso_tree_print.argtypes = [POINTER(struct_iso_tree_node), c_int]
|
||||
|
||||
# ../../../libisofs/libisofs.h:220
|
||||
iso_source_new_ecma119 = _lib.iso_source_new_ecma119
|
||||
iso_source_new_ecma119.restype = POINTER(struct_burn_source)
|
||||
iso_source_new_ecma119.argtypes = [POINTER(struct_iso_volset), c_int, c_int, c_int]
|
||||
|
||||
|
||||
__all__ = ['iso_volume_new', 'iso_volume_new_with_root', 'iso_volume_free',
|
||||
'iso_volset_free', 'iso_volume_get_root', 'iso_volume_set_volume_id',
|
||||
'iso_volume_set_publisher_id', 'iso_volume_set_data_preparer_id',
|
||||
'iso_tree_volume_path_to_node', 'iso_tree_volume_add_path',
|
||||
'iso_tree_volume_add_new_dir', 'iso_volset_new', 'iso_tree_add_node',
|
||||
'iso_tree_radd_dir', 'iso_exclude_add_path', 'iso_exclude_remove_path',
|
||||
'iso_exclude_empty', 'iso_tree_add_new_dir', 'iso_tree_node_set_name',
|
||||
'iso_tree_print', 'iso_source_new_ecma119']
|
@ -1,9 +0,0 @@
|
||||
# The automatic code generator does not wrap enums into python. As
|
||||
# isofs has only two enum values publicly defined, they are hardcoded
|
||||
# here.
|
||||
|
||||
# from enum ecma119_extension_flag
|
||||
ECMA119_ROCKRIDGE = 1
|
||||
ECMA119_JOLIET = 2
|
||||
|
||||
__all__ = ['ECMA119_ROCKRIDGE', 'ECMA119_JOLIET']
|
@ -1,58 +0,0 @@
|
||||
# High level interface to the isofs library.
|
||||
|
||||
import core
|
||||
import defines
|
||||
import os.path
|
||||
|
||||
def _wrap_volume_property(var_name, core_setter):
|
||||
def get(self):
|
||||
return getattr(self, var_name)
|
||||
def set(self, value):
|
||||
setattr(self, var_name, value)
|
||||
core_setter(self._volume, value)
|
||||
return property(get, set)
|
||||
|
||||
class IsoFS(object):
|
||||
def __init__(self, volume_id='', publisher_id='',
|
||||
data_preparer_id=''):
|
||||
self._volume_id = volume_id
|
||||
self._publisher_id = publisher_id
|
||||
self._data_preparer_id = data_preparer_id
|
||||
|
||||
self._volume = core.iso_volume_new(
|
||||
volume_id, publisher_id, data_preparer_id)
|
||||
self._volset = core.iso_volset_new(self._volume, volume_id)
|
||||
|
||||
def __del__(self):
|
||||
core.iso_volume_free(self._volume)
|
||||
core.iso_volset_free(self._volset)
|
||||
|
||||
volume_id = _wrap_volume_property(
|
||||
'_volume_id', core.iso_volume_set_volume_id)
|
||||
publisher_id = _wrap_volume_property(
|
||||
'_publisher_id', core.iso_volume_set_publisher_id)
|
||||
data_preparer_id = _wrap_volume_property(
|
||||
'_data_preparer_id', core.iso_volume_set_data_preparer_id)
|
||||
|
||||
def add(self, disc_path, path, exclude=None): #, make_parents=False):
|
||||
disc_path = os.path.normpath(disc_path)
|
||||
path = os.path.abspath(os.path.normpath(path))
|
||||
exclude = exclude or []
|
||||
|
||||
# Does the disc parent exist?
|
||||
disc_parent, _ = os.path.split(disc_path)
|
||||
if not core.iso_tree_volume_path_to_node(self._volume, disc_parent):
|
||||
print "No such parent"
|
||||
return # TODO: Raise exception and/or create all missing
|
||||
# parents.
|
||||
|
||||
# Flush all ignores that may have stayed over.
|
||||
core.iso_exclude_empty()
|
||||
for exclude_path in exclude:
|
||||
core.iso_exclude_add_path(exclude_path)
|
||||
|
||||
core.iso_tree_volume_add_path(self._volume, disc_path, path)
|
||||
|
||||
def display(self):
|
||||
root = core.iso_volume_get_root(self._volume)
|
||||
core.iso_tree_print(root, 0)
|
@ -1,4 +1,4 @@
|
||||
AC_INIT([libisofs], [0.2.4], [http://libburnia.pykix.org])
|
||||
AC_INIT([libisofs], [0.2.8], [http://libburnia-project.org])
|
||||
AC_PREREQ([2.50])
|
||||
dnl AC_CONFIG_HEADER([config.h])
|
||||
|
||||
@ -25,7 +25,7 @@ dnl if MAJOR or MINOR version changes, be sure to change AC_INIT above to match
|
||||
dnl
|
||||
BURN_MAJOR_VERSION=0
|
||||
BURN_MINOR_VERSION=2
|
||||
BURN_MICRO_VERSION=4
|
||||
BURN_MICRO_VERSION=8
|
||||
BURN_INTERFACE_AGE=0
|
||||
BURN_BINARY_AGE=0
|
||||
BURN_VERSION=$BURN_MAJOR_VERSION.$BURN_MINOR_VERSION.$BURN_MICRO_VERSION
|
||||
@ -39,7 +39,7 @@ AC_SUBST(BURN_VERSION)
|
||||
|
||||
dnl Libtool versioning
|
||||
LT_RELEASE=$BURN_MAJOR_VERSION.$BURN_MINOR_VERSION
|
||||
LT_CURRENT=`expr $BURN_MICRO_VERSION - $BURN_INTERFACE_AGE`
|
||||
LT_CURRENT=5
|
||||
LT_REVISION=$BURN_INTERFACE_AGE
|
||||
LT_AGE=`expr $BURN_BINARY_AGE - $BURN_INTERFACE_AGE`
|
||||
LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
|
||||
|
@ -18,6 +18,12 @@ static size_t calc_dirent_len(struct ecma119_tree_node *n)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the file permissions and user/group id of an ECMA-119 node.
|
||||
* This is used when a replace mode is selected, i.e., when we want to
|
||||
* create a disc where the mode of each file or directory will be
|
||||
* different than the mode in the original source.
|
||||
*/
|
||||
static void
|
||||
replace_node_mode(struct ecma119_write_target *t, struct stat *st)
|
||||
{
|
||||
@ -65,6 +71,19 @@ replace_node_mode(struct ecma119_write_target *t, struct stat *st)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new ECMA-119 node from the given iso tree node, and initializes
|
||||
* the fields that are common to all kind of nodes (dir, reg file, symlink...).
|
||||
*
|
||||
* @param t
|
||||
* The options for the ECMA-119 tree that is being created
|
||||
* @param parent
|
||||
* The parent of the node, or NULL if it's the root.
|
||||
* @param iso
|
||||
* The node from which this function creates a ECMA-119 node
|
||||
* @return
|
||||
* The created node.
|
||||
*/
|
||||
static struct ecma119_tree_node*
|
||||
create_ecma119_node(struct ecma119_write_target *t,
|
||||
struct ecma119_tree_node *parent,
|
||||
@ -92,13 +111,22 @@ create_ecma119_node(struct ecma119_write_target *t,
|
||||
iso_name(iso->name, t->input_charset)
|
||||
) : NULL;
|
||||
ret->dirent_len = calc_dirent_len(ret);
|
||||
|
||||
/* iso node keeps the same file attribs as the original file. */
|
||||
ret->attrib = iso->attrib;
|
||||
|
||||
/*
|
||||
* When using RR extension and replace mode, we will replace the
|
||||
* permissions and uid/gid of each file with those previously selected
|
||||
* by the user.
|
||||
*/
|
||||
if ( t->rockridge && t->replace_mode )
|
||||
replace_node_mode(t, &ret->attrib);
|
||||
|
||||
if (!iso->name)
|
||||
ret->full_name = NULL;
|
||||
else if ( strcmp(t->input_charset,t->ouput_charset) )
|
||||
/* convert the file name charset */
|
||||
ret->full_name = convert_str(iso->name, t->input_charset,
|
||||
t->ouput_charset);
|
||||
else
|
||||
@ -108,6 +136,10 @@ create_ecma119_node(struct ecma119_write_target *t,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new ECMA-119 node representing a directory from a iso directory
|
||||
* node.
|
||||
*/
|
||||
static struct ecma119_tree_node*
|
||||
create_dir(struct ecma119_write_target *t,
|
||||
struct ecma119_tree_node *parent,
|
||||
@ -127,6 +159,10 @@ create_dir(struct ecma119_write_target *t,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new ECMA-119 node representing a regular file from a iso file
|
||||
* node.
|
||||
*/
|
||||
static struct ecma119_tree_node*
|
||||
create_file(struct ecma119_write_target *t,
|
||||
struct ecma119_tree_node *parent,
|
||||
@ -143,6 +179,10 @@ create_file(struct ecma119_write_target *t,
|
||||
/* get iso_file struct */
|
||||
file = iso_file_table_lookup(t->file_table, iso);
|
||||
if ( file == NULL ) {
|
||||
/*
|
||||
* If the file is not already added to the disc, we add it now
|
||||
* to the file table, and get a new inode number for it.
|
||||
*/
|
||||
file = iso_file_new(iso);
|
||||
iso_file_table_add_file(t->file_table, file);
|
||||
file->ino = ++t->ino;
|
||||
@ -157,6 +197,12 @@ create_file(struct ecma119_write_target *t,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new ECMA-119 node representing a placeholder for a relocated
|
||||
* dir.
|
||||
*
|
||||
* See IEEE P1282, section 4.1.5 for details
|
||||
*/
|
||||
static struct ecma119_tree_node*
|
||||
create_placeholder(struct ecma119_write_target *t,
|
||||
struct ecma119_tree_node *parent,
|
||||
@ -191,6 +237,10 @@ create_placeholder(struct ecma119_write_target *t,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new ECMA-119 node representing a symbolic link from a iso symlink
|
||||
* node.
|
||||
*/
|
||||
static struct ecma119_tree_node*
|
||||
create_symlink(struct ecma119_write_target *t,
|
||||
struct ecma119_tree_node *parent,
|
||||
@ -212,6 +262,14 @@ create_symlink(struct ecma119_write_target *t,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new ECMA-119 node representing a boot catalog. This is like a
|
||||
* regular file, but its contents are taken from a El-Torito boot catalog,
|
||||
* and not from a file in the local filesystem.
|
||||
*
|
||||
* See "El Torito" Bootable CD-ROM Format Specification Version 1.0 for
|
||||
* more details.
|
||||
*/
|
||||
static struct ecma119_tree_node*
|
||||
create_boot_catalog(struct ecma119_write_target *t,
|
||||
struct ecma119_tree_node *parent,
|
||||
@ -239,6 +297,11 @@ create_boot_catalog(struct ecma119_write_target *t,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new ECMA-119 node that corresponds to the given iso tree node.
|
||||
* If that node is a dir, this function recurses over all their children,
|
||||
* thus creating a ECMA-119 tree whose root is the given iso dir.
|
||||
*/
|
||||
static struct ecma119_tree_node*
|
||||
create_tree(struct ecma119_write_target *t,
|
||||
struct ecma119_tree_node *parent,
|
||||
@ -316,6 +379,12 @@ max_child_name_len(struct ecma119_tree_node *root)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Relocates a directory, as specified in Rock Ridge Specification
|
||||
* (see IEEE P1282, section 4.1.5). This is needed when the number of levels
|
||||
* on a directory hierarchy exceeds 8, or the length of a path is higher
|
||||
* than 255 characters, as specified in ECMA-119, section 6.8.2.1
|
||||
*/
|
||||
static void
|
||||
reparent(struct ecma119_tree_node *child,
|
||||
struct ecma119_tree_node *parent)
|
||||
@ -350,6 +419,8 @@ reparent(struct ecma119_tree_node *child,
|
||||
* Reorder the tree, if necessary, to ensure that
|
||||
* - the depth is at most 8
|
||||
* - each path length is at most 255 characters
|
||||
* This restriction is imposed by ECMA-119 specification (see ECMA-119,
|
||||
* 6.8.2.1).
|
||||
*/
|
||||
static void
|
||||
reorder_tree(struct ecma119_write_target *t,
|
||||
@ -400,6 +471,9 @@ reorder_tree(struct ecma119_write_target *t,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare the iso name of two ECMA-119 nodes
|
||||
*/
|
||||
static int
|
||||
cmp_node(const void *f1, const void *f2)
|
||||
{
|
||||
@ -408,6 +482,10 @@ cmp_node(const void *f1, const void *f2)
|
||||
return strcmp(f->iso_name, g->iso_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts a the children of each directory in the ECMA-119 tree represented
|
||||
* by \p root, acording to the order specified in ECMA-119, section 9.3.
|
||||
*/
|
||||
static void
|
||||
sort_tree(struct ecma119_tree_node *root)
|
||||
{
|
||||
@ -470,6 +548,10 @@ mangle_name(char **name, int num_change, int level, int seq_num)
|
||||
sprintf(*name, fmt, base, seq_num, ext);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that the ISO name of each children of the given dir is unique,
|
||||
* changing some of them if needed.
|
||||
*/
|
||||
static void
|
||||
mangle_all(struct ecma119_tree_node *dir)
|
||||
{
|
||||
|
@ -14,6 +14,30 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
/** See IEEE P1281 Draft Version 1.12/5.5 FIXME: this is rockridge */
|
||||
void
|
||||
rrip_add_ER(struct ecma119_write_target *t, struct ecma119_tree_node *dir)
|
||||
{
|
||||
unsigned char *ER = malloc(182);
|
||||
|
||||
assert(dir->type == ECMA119_DIR);
|
||||
|
||||
ER[0] = 'E';
|
||||
ER[1] = 'R';
|
||||
ER[2] = 182;
|
||||
ER[3] = 1;
|
||||
ER[4] = 9;
|
||||
ER[5] = 72;
|
||||
ER[6] = 93;
|
||||
ER[7] = 1;
|
||||
memcpy(&ER[8], "IEEE_1282", 9);
|
||||
memcpy(&ER[17], "THE IEEE 1282 PROTOCOL PROVIDES SUPPORT FOR POSIX "
|
||||
"FILE SYSTEM SEMANTICS.", 72);
|
||||
memcpy(&ER[89], "PLEASE CONTACT THE IEEE STANDARDS DEPARTMENT, "
|
||||
"PISCATAWAY, NJ, USA FOR THE 1282 SPECIFICATION.", 93);
|
||||
susp_append(t, &dir->info.dir.self_susp, ER);
|
||||
}
|
||||
|
||||
/* create a PX field from the permissions on the current node. */
|
||||
uint8_t *rrip_make_PX(struct ecma119_write_target *t,
|
||||
struct ecma119_tree_node *node)
|
||||
|
@ -1,6 +1,11 @@
|
||||
/* vim: set noet ts=8 sts=8 sw=8 : */
|
||||
|
||||
/** Functions and structures used for Rock Ridge support. */
|
||||
/**
|
||||
* Functions and structures used for Rock Ridge support.
|
||||
*
|
||||
* See IEEE P1282, Rock Ridge Interchange Protocol, Draft Standard version
|
||||
* 1.12 for further details.
|
||||
*/
|
||||
|
||||
#ifndef ISO_ROCKRIDGE_H
|
||||
#define ISO_ROCKRIDGE_H
|
||||
@ -8,18 +13,99 @@
|
||||
struct ecma119_write_target;
|
||||
struct ecma119_tree_node;
|
||||
|
||||
/**
|
||||
* Add a SUSP "ER" System Use Entry to identify the Rock Ridge specification.
|
||||
*
|
||||
* The "ER" System Use Entry is used to uniquely identify a specification
|
||||
* compliant with SUSP. This method adds to the given tree node "." entry
|
||||
* the "ER" corresponding to the RR protocol.
|
||||
*
|
||||
* See IEEE P1281, section 5.5 and IEEE P1282, section 4.3 for more details.
|
||||
*/
|
||||
void rrip_add_ER(struct ecma119_write_target *, struct ecma119_tree_node *);
|
||||
|
||||
/**
|
||||
* Add a PX System Use Entry to the given tree node and, if that node is
|
||||
* a directory, to its "." and ".." entries. The PX System Use Entry is
|
||||
* used to add POSIX file attributes, such as access permissions or user and
|
||||
* group id, to a ECMA 119 directory record.
|
||||
*
|
||||
* See IEEE P1282, section 4.1.1 for more details.
|
||||
*/
|
||||
void rrip_add_PX(struct ecma119_write_target *, struct ecma119_tree_node *);
|
||||
|
||||
/**
|
||||
* Add a PN System Use Entry to the given tree node.
|
||||
* The PN System Use Entry is used to store the device number, and it's
|
||||
* mandatory if the tree node corresponds to a character or block device.
|
||||
*
|
||||
* See IEEE P1282, section 4.1.2 for more details.
|
||||
*/
|
||||
void rrip_add_PN(struct ecma119_write_target *, struct ecma119_tree_node *);
|
||||
|
||||
/**
|
||||
* Add a SL System Use Entry to the given tree node. This is used to store
|
||||
* the content of a symbolic link, and is mandatory if the tree node
|
||||
* indicates a symbolic link.
|
||||
*
|
||||
* See IEEE P1282, section 4.1.3 for more details.
|
||||
*/
|
||||
void rrip_add_SL(struct ecma119_write_target *, struct ecma119_tree_node *);
|
||||
|
||||
/**
|
||||
* Add a NM System Use Entry to the given tree node. The purpose of this
|
||||
* System Use Entry is to store the content of an Alternate Name to support
|
||||
* POSIX-style or other names.
|
||||
*
|
||||
* See IEEE P1282, section 4.1.4 for more details.
|
||||
*/
|
||||
void rrip_add_NM(struct ecma119_write_target *, struct ecma119_tree_node *);
|
||||
|
||||
/*
|
||||
* The next 3 System Use Entries are used to handle Deep Directory
|
||||
* Hierarchies, i.e., hierarchies where the number of directory levels
|
||||
* exceed the eight limit of ECMA-119.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Add to the given tree node a CL System Use Entry, that is used to record
|
||||
* the new location of a directory which has been relocated.
|
||||
*
|
||||
* See IEEE P1282, section 4.1.5.1 for more details.
|
||||
*/
|
||||
void rrip_add_CL(struct ecma119_write_target *, struct ecma119_tree_node *);
|
||||
|
||||
/**
|
||||
* Add a PL System Use Entry, used to record the location of the original
|
||||
* parent directory of a directory which has been relocated.
|
||||
*
|
||||
* This is special because it doesn't modify the susp fields of the directory
|
||||
* that gets passed to it; it modifies the susp fields of the ".." entry in
|
||||
* that directory.
|
||||
*
|
||||
* See IEEE P1282, section 4.1.5.2 for more details.
|
||||
*/
|
||||
void rrip_add_PL(struct ecma119_write_target *, struct ecma119_tree_node *);
|
||||
|
||||
/**
|
||||
* Add a RE System Use Entry to the given tree node. The purpose of the
|
||||
* this System Use Entry is to indicate to an RRIP-compliant receiving
|
||||
* system that the Directory Record in which an "RE" System Use Entry is
|
||||
* recorded has been relocated from another position in the original
|
||||
* Directory Hierarchy.
|
||||
*
|
||||
* See IEEE P1282, section 4.1.5.3 for more details.
|
||||
*/
|
||||
void rrip_add_RE(struct ecma119_write_target *, struct ecma119_tree_node *);
|
||||
|
||||
/**
|
||||
* Add to the given tree node a TF System Use Entry, used to record some
|
||||
* time stamps related to the file.
|
||||
*
|
||||
* See IEEE P1282, section 4.1.6 for more details.
|
||||
*/
|
||||
void rrip_add_TF(struct ecma119_write_target *, struct ecma119_tree_node *);
|
||||
|
||||
/* This is special because it doesn't modify the susp fields of the directory
|
||||
* that gets passed to it; it modifies the susp fields of the ".." entry in
|
||||
* that directory. */
|
||||
void rrip_add_PL(struct ecma119_write_target *, struct ecma119_tree_node *);
|
||||
|
||||
void rrip_finalize(struct ecma119_write_target *, struct ecma119_tree_node *);
|
||||
|
||||
|
@ -155,30 +155,6 @@ static void susp_add_ST(struct ecma119_write_target *t,
|
||||
}
|
||||
#endif
|
||||
|
||||
/** See IEEE P1281 Draft Version 1.12/5.5 FIXME: this is rockridge */
|
||||
void
|
||||
rrip_add_ER(struct ecma119_write_target *t, struct ecma119_tree_node *dir)
|
||||
{
|
||||
unsigned char *ER = malloc(182);
|
||||
|
||||
assert(dir->type == ECMA119_DIR);
|
||||
|
||||
ER[0] = 'E';
|
||||
ER[1] = 'R';
|
||||
ER[2] = 182;
|
||||
ER[3] = 1;
|
||||
ER[4] = 9;
|
||||
ER[5] = 72;
|
||||
ER[6] = 93;
|
||||
ER[7] = 1;
|
||||
memcpy(&ER[8], "IEEE_1282", 9);
|
||||
memcpy(&ER[17], "THE IEEE 1282 PROTOCOL PROVIDES SUPPORT FOR POSIX "
|
||||
"FILE SYSTEM SEMANTICS.", 72);
|
||||
memcpy(&ER[89], "PLEASE CONTACT THE IEEE STANDARDS DEPARTMENT, "
|
||||
"PISCATAWAY, NJ, USA FOR THE 1282 SPECIFICATION.", 93);
|
||||
susp_append(t, &dir->info.dir.self_susp, ER);
|
||||
}
|
||||
|
||||
/* calculate the location of the CE areas. Since CE areas don't need to be
|
||||
* aligned to a block boundary, we contatenate all CE areas from a single
|
||||
* directory and dump them immediately after all the directory records.
|
||||
|
@ -1,6 +1,10 @@
|
||||
/* vim: set noet ts=8 sts=8 sw=8 : */
|
||||
|
||||
/** Functions and structures used for SUSP (IEEE 1281).
|
||||
/**
|
||||
* Functions and structures used for SUSP (IEEE 1281).
|
||||
*
|
||||
* Please refer to IEEE P1281 System Use Sharing Protocol, draft standard
|
||||
* version 1.12 for more details.
|
||||
*/
|
||||
|
||||
#ifndef __ISO_SUSP
|
||||
@ -28,13 +32,23 @@ struct susp_info
|
||||
* will go in a CE area. */
|
||||
};
|
||||
|
||||
/**
|
||||
* Add a CE System Use Entry to the given tree node. A "CE" is used to add
|
||||
* a continuation area, where additional System Use Entry can be written.
|
||||
* See IEEE P1281, section 5.1.
|
||||
*/
|
||||
void susp_add_CE(struct ecma119_write_target *, struct ecma119_tree_node *);
|
||||
|
||||
/* these next 2 are special because they don't modify the susp fields of the
|
||||
* directory; they modify the susp fields of the
|
||||
* "." entry in the directory. */
|
||||
/**
|
||||
* Add a SP System Use Entry to the "." entry of the directory. The SP provide
|
||||
* an identifier that the SUSP is used within the volume. The SP shall be
|
||||
* recorded in the "." entry of the root directory.
|
||||
* See IEEE P1281, section 5.3 for more details.
|
||||
*
|
||||
* this is special because it doesn't modify the susp fields of the
|
||||
* directory; it modifies the susp fields of the "." entry in the directory.
|
||||
*/
|
||||
void susp_add_SP(struct ecma119_write_target *, struct ecma119_tree_node *);
|
||||
void rrip_add_ER(struct ecma119_write_target *, struct ecma119_tree_node *);
|
||||
|
||||
/** Once all the directories and files are laid out, recurse through the tree
|
||||
* and finalize all SUSP CE entries. */
|
||||
|
Reference in New Issue
Block a user