├── AUTHORS ├── CONTRIBUTORS ├── COPYING ├── COPYRIGHT ├── ChangeLog ├── INSTALL ├── Makefile.am ├── Makefile.in ├── README ├── acinclude.m4 ├── aclocal.m4 ├── bootstrap ├── compile ├── config.guess ├── config.h.in ├── config.status ├── config.sub ├── configure ├── configure.ac ├── depcomp ├── doc ├── boot_sectors.txt ├── checksums.txt ├── partition_offset.wiki ├── qemu_xorriso.wiki ├── startup_file.txt ├── susp_aaip_2_0.txt ├── susp_aaip_isofs_names.txt └── zisofs_format.txt ├── frontend ├── README-tcltk ├── frontend_pipes_xorriso.c └── xorriso-tcltk ├── install-sh ├── libburn ├── COPYRIGHT ├── async.c ├── async.h ├── back_hacks.h ├── cdtext.c ├── cleanup.c ├── cleanup.h ├── crc.h ├── ddlpa.c ├── ddlpa.h ├── ddlpa_1.h ├── debug.c ├── debug.h ├── drive.c ├── drive.h ├── ecma130ab.c ├── ecma130ab.h ├── error.h ├── file.c ├── file.h ├── init.c ├── init.h ├── libburn.h ├── libdax_audioxtr.c ├── libdax_audioxtr.h ├── libdax_msgs.c ├── libdax_msgs.h ├── libdax_sigmgr.c ├── libdax_sigmgr.h ├── libiso_msgs.c ├── libiso_msgs.h ├── mmc.c ├── mmc.h ├── null.c ├── null.h ├── options.c ├── options.h ├── os-dummy.h ├── os-freebsd.h ├── os-libcdio.h ├── os-linux.h ├── os-solaris.h ├── os.h ├── read.c ├── read.h ├── sbc.c ├── sbc.h ├── sector.c ├── sector.h ├── sg-dummy.c ├── sg-freebsd-port.c ├── sg-freebsd.c ├── sg-libcdio.c ├── sg-linux.c ├── sg-solaris.c ├── sg.c ├── sg.h ├── source.c ├── source.h ├── spc.c ├── spc.h ├── structure.c ├── structure.h ├── toc.c ├── toc.h ├── transport.h ├── util.c ├── util.h ├── write.c └── write.h ├── libisoburn ├── COPYRIGHT ├── burn_wrap.c ├── data_source.c ├── isoburn.c ├── isoburn.h ├── isofs_wrap.c └── libisoburn.h ├── libisofs ├── COPYRIGHT ├── aaip-os-dummy.c ├── aaip-os-freebsd.c ├── aaip-os-linux.c ├── aaip_0_2.c ├── aaip_0_2.h ├── buffer.c ├── buffer.h ├── builder.c ├── builder.h ├── data_source.c ├── ecma119.c ├── ecma119.h ├── ecma119_tree.c ├── ecma119_tree.h ├── eltorito.c ├── eltorito.h ├── filesrc.c ├── filesrc.h ├── filter.c ├── filter.h ├── filters │ ├── external.c │ ├── gzip.c │ └── zisofs.c ├── find.c ├── fs_image.c ├── fs_local.c ├── fsource.c ├── fsource.h ├── hfsplus.c ├── hfsplus.h ├── hfsplus_case.c ├── hfsplus_case_apple_vladimir.c ├── hfsplus_classes.c ├── hfsplus_classes_old.c ├── hfsplus_classes_test.c ├── hfsplus_classes_ts_test.c ├── hfsplus_decompose.c ├── hfsplus_decompose_old.c ├── hfsplus_decompose_test.c ├── hfsplus_decompose_ts_test.c ├── image.c ├── image.h ├── iso1999.c ├── iso1999.h ├── joliet.c ├── joliet.h ├── libiso_msgs.c ├── libiso_msgs.h ├── libisofs.h ├── make_isohybrid_mbr.c ├── md5.c ├── md5.h ├── messages.c ├── messages.h ├── node.c ├── node.h ├── rockridge.c ├── rockridge.h ├── rockridge_read.c ├── stream.c ├── stream.h ├── system_area.c ├── system_area.h ├── tree.c ├── tree.h ├── util.c ├── util.h ├── util_htable.c ├── util_rbtree.c └── writer.h ├── libjte ├── COPYRIGHT ├── checksum.c ├── checksum.h ├── endian.c ├── endianconv.h ├── jigdo-gen-md5-list ├── jigdo-gen-md5-list.1 ├── jte.c ├── jte.h ├── libjte.c ├── libjte.h ├── libjte_private.h ├── md5.c ├── md5.h ├── rsync.c ├── rsync.h ├── sha1.c ├── sha1.h ├── sha256.c ├── sha256.h ├── sha512.c └── sha512.h ├── libtool ├── libtool.m4 ├── ltmain.sh ├── ltoptions.m4 ├── ltsugar.m4 ├── ltversion.m4 ├── lt~obsolete.m4 ├── missing ├── mkinstalldirs ├── releng ├── CHECKLIST ├── README ├── TODO ├── auto_isocontent ├── auto_printsize ├── change_shell_to_use ├── codesamples │ ├── api_3lib.cpp │ └── api_xorriso.cpp ├── inc │ ├── releng_getopts.inc │ └── test_releng_getopt ├── jigdo-gen-md5-list ├── jigdo-gen-md5-list.1 ├── manual_burn ├── manual_devices ├── manual_isojigdo ├── run_all_auto └── template_new ├── test └── compare_file.c ├── texinfo.tex ├── version.h.in └── xorriso ├── COPYRIGHT ├── aux_objects.c ├── aux_objects.h ├── base_obj.c ├── base_obj.h ├── changelog.txt ├── check_media.c ├── check_media.h ├── cmp_update.c ├── cmp_update.h ├── disk_ops.c ├── disk_ops.h ├── drive_mgt.c ├── drive_mgt.h ├── emulators.c ├── emulators.h ├── filters.c ├── filters.h ├── findjob.c ├── findjob.h ├── iso_img.c ├── iso_img.h ├── iso_manip.c ├── iso_manip.h ├── iso_tree.c ├── iso_tree.h ├── lib_mgt.c ├── lib_mgt.h ├── make_docs.sh ├── make_xorriso_1.c ├── man_1_xorrecord.html ├── man_1_xorriso.html ├── man_1_xorrisofs.html ├── match.c ├── match.h ├── misc_funct.c ├── misc_funct.h ├── opts_a_c.c ├── opts_d_h.c ├── opts_i_o.c ├── opts_p_z.c ├── parse_exec.c ├── parse_exec.h ├── read_run.c ├── read_run.h ├── sfile.c ├── sfile.h ├── sort_cmp.c ├── sort_cmp.h ├── text_io.c ├── text_io.h ├── write_run.c ├── write_run.h ├── xorrecord.1 ├── xorrecord.info ├── xorrecord.texi ├── xorriso.1 ├── xorriso.h ├── xorriso.info ├── xorriso.texi ├── xorriso_buildstamp.h ├── xorriso_buildstamp_none.h ├── xorriso_eng.html ├── xorriso_main.c ├── xorriso_private.h ├── xorriso_timestamp.h ├── xorrisoburn.h ├── xorrisofs.1 ├── xorrisofs.info └── xorrisofs.texi /AUTHORS: -------------------------------------------------------------------------------- 1 | Derek Foreman 2 | Ben Jansens 3 | Thomas Schmitt 4 | Mario Danic 5 | Vreixo Formoso Lopes 6 | Colin Plumb 7 | Tatu Ylonen 8 | Jim Kingdon 9 | Scott G. Miller 10 | Ulrich Drepper 11 | Richard Atterer 12 | Steve McIntyre 13 | George Danchev 14 | and possibly others who gave their copyright to Free Software Foundation, Inc. 15 | 16 | -------------------------------------------------------------------------------- /CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | Joe Neeman 2 | Philippe Rouquier 3 | Gabriel Craciunescu 4 | George Danchev 5 | Jean-Francois Wauthy 6 | Lorenzo Taylor 7 | -------------------------------------------------------------------------------- /COPYRIGHT: -------------------------------------------------------------------------------- 1 | Derek Foreman 2 | Ben Jansens 3 | Thomas Schmitt 4 | Mario Danic , 5 | Vreixo Formoso 6 | Steve McIntyre 7 | George Danchev 8 | 9 | GNU xorriso is a compilation of modules from libburnia-project.org : 10 | xorriso Copyright (C) 2007-2012 Thomas Schmitt 11 | libisoburn Copyright (C) 2007-2012 Vreixo Formoso, Thomas Schmitt 12 | libisofs Copyright (C) 2007-2012 Vreixo Formoso, Mario Danic, Thomas Schmitt 13 | libburn Copyright (C) 2002-2006 Derek Foreman, Ben Jansens 14 | 2006-2012 Mario Danic, Thomas Schmitt 15 | Further included is : 16 | libjte Copyright (C) 2000-2007 Free Software Foundation, Inc. 17 | 2004-2011 Steve McIntyre 18 | 2010-2011 George Danchev, Thomas Schmitt 19 | 20 | Originally they all are licensed directly or indirectly as GPLv2+. 21 | GNU xorriso is licensed by the following statement: 22 | 23 | This program is free software; you can redistribute it and/or modify 24 | it under the terms of the GNU General Public License version 3 25 | or later as published by the Free Software Foundation. 26 | 27 | This program is distributed in the hope that it will be useful, 28 | but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 30 | GNU General Public License for more details. 31 | 32 | You should have received a copy of the GNU General Public License 33 | along with this program; if not, write to the Free Software 34 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 35 | -------------------------------------------------------------------------------- /bootstrap: -------------------------------------------------------------------------------- 1 | #!/bin/sh -x 2 | 3 | aclocal -I . 4 | libtoolize --copy --force 5 | autoconf 6 | 7 | autoheader 8 | 9 | automake --foreign --add-missing --copy --include-deps 10 | 11 | -------------------------------------------------------------------------------- /compile: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # Wrapper for compilers which do not understand `-c -o'. 4 | 5 | # Copyright 1999, 2000 Free Software Foundation, Inc. 6 | # Written by Tom Tromey . 7 | # 8 | # This program is free software; you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation; either version 2, or (at your option) 11 | # any later version. 12 | # 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program; if not, write to the Free Software 20 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 | 22 | # As a special exception to the GNU General Public License, if you 23 | # distribute this file as part of a program that contains a 24 | # configuration script generated by Autoconf, you may include it under 25 | # the same distribution terms that you use for the rest of that program. 26 | 27 | # Usage: 28 | # compile PROGRAM [ARGS]... 29 | # `-o FOO.o' is removed from the args passed to the actual compile. 30 | 31 | prog=$1 32 | shift 33 | 34 | ofile= 35 | cfile= 36 | args= 37 | while test $# -gt 0; do 38 | case "$1" in 39 | -o) 40 | # configure might choose to run compile as `compile cc -o foo foo.c'. 41 | # So we do something ugly here. 42 | ofile=$2 43 | shift 44 | case "$ofile" in 45 | *.o | *.obj) 46 | ;; 47 | *) 48 | args="$args -o $ofile" 49 | ofile= 50 | ;; 51 | esac 52 | ;; 53 | *.c) 54 | cfile=$1 55 | args="$args $1" 56 | ;; 57 | *) 58 | args="$args $1" 59 | ;; 60 | esac 61 | shift 62 | done 63 | 64 | if test -z "$ofile" || test -z "$cfile"; then 65 | # If no `-o' option was seen then we might have been invoked from a 66 | # pattern rule where we don't need one. That is ok -- this is a 67 | # normal compilation that the losing compiler can handle. If no 68 | # `.c' file was seen then we are probably linking. That is also 69 | # ok. 70 | exec "$prog" $args 71 | fi 72 | 73 | # Name of file we expect compiler to create. 74 | cofile=`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'` 75 | 76 | # Create the lock directory. 77 | # Note: use `[/.-]' here to ensure that we don't use the same name 78 | # that we are using for the .o file. Also, base the name on the expected 79 | # object file name, since that is what matters with a parallel build. 80 | lockdir=`echo $cofile | sed -e 's|[/.-]|_|g'`.d 81 | while true; do 82 | if mkdir $lockdir > /dev/null 2>&1; then 83 | break 84 | fi 85 | sleep 1 86 | done 87 | # FIXME: race condition here if user kills between mkdir and trap. 88 | trap "rmdir $lockdir; exit 1" 1 2 15 89 | 90 | # Run the compile. 91 | "$prog" $args 92 | status=$? 93 | 94 | if test -f "$cofile"; then 95 | mv "$cofile" "$ofile" 96 | fi 97 | 98 | rmdir $lockdir 99 | exit $status 100 | -------------------------------------------------------------------------------- /doc/startup_file.txt: -------------------------------------------------------------------------------- 1 | # This is an example for a xorriso startup file. 2 | # If found at one of the following addresses then its text lines will get 3 | # executed by xorriso as commands before any of its program arguments: 4 | # /etc/default/xorriso 5 | # /etc/opt/xorriso/rc 6 | # /etc/xorriso/xorriso.conf 7 | # $HOME/.xorrisorc 8 | # Note: Command -no_rc as first program argument prevents this execution. 9 | 10 | 11 | # Disallow the use of hard disk /dev/sda and its partitions as 12 | # pseudo-drive (e.g. as output target of an ISO image). 13 | 14 | -drive_class banned /dev/sda* 15 | 16 | 17 | # Allow the use of /dev/sdb, /dev/sdc, and /dev/sdd as pseudo-drives 18 | # without the prefix "stdio:" which is usually required for device addresses 19 | # which begin by "/dev/" but represent no CD drives. 20 | 21 | -drive_class harmless /dev/sd[bcd] 22 | 23 | -------------------------------------------------------------------------------- /libburn/COPYRIGHT: -------------------------------------------------------------------------------- 1 | Derek Foreman and Ben Jansens 2 | Copyright (C) 2002-2006 Derek Foreman and Ben Jansens 3 | Mario Danic , Thomas Schmitt 4 | Copyright (C) 2006-2011 Mario Danic, Thomas Schmitt 5 | 6 | 7 | This program is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License version 2 or later 9 | as published by the Free Software Foundation. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | -------------------------------------------------------------------------------- /libburn/async.h: -------------------------------------------------------------------------------- 1 | /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ 2 | 3 | #ifndef BURN__ASYNC_H 4 | #define BURN__ASYNC_H 5 | 6 | void burn_async_join_all(void); 7 | struct burn_write_opts; 8 | 9 | /* ts A70930 */ 10 | /* To be called when the first read() call comes to a fifo */ 11 | int burn_fifo_start(struct burn_source *source, int flag); 12 | 13 | /* ts A81108 */ 14 | /* To abort a running fifo thread before the fifo object gets deleted */ 15 | int burn_fifo_abort(struct burn_source_fifo *fs, int flag); 16 | 17 | 18 | #endif /* BURN__ASYNC_H */ 19 | -------------------------------------------------------------------------------- /libburn/back_hacks.h: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2006 Thomas Schmitt 3 | Provided under GPL version 2 or later. 4 | 5 | This file bundles variables which disable changes in libburn which are 6 | not yet completely accepted. 7 | 8 | The use of these variables is *strongly discouraged* unless you have sincere 9 | reason and are willing to share your gained knowledge with the libburn 10 | developers. 11 | 12 | Do *not silently rely* on these variables with your application. Tell us 13 | that you needed one or more of them. They are subject to removal as soon 14 | as consense has been found about correctness of the change they revoke. 15 | 16 | Value 0 means that the new behavior is enabled. Any other value enables 17 | the described old time behavior. 18 | 19 | If you doubt one of the changes here broke your application, then do 20 | *in your application*, *not here* : 21 | 22 | - #include "libburn/back_hacks.h" like you include "libburn/libburn.h" 23 | 24 | - Set the libburn_back_hack_* variable of your choice to 1. 25 | In your app. Not here. 26 | 27 | - Then start and use libburn as usual. Watch out for results. 28 | 29 | - If you believe to have detected a flaw in our change, come forward 30 | and report it to the libburn developers. Thanks in advance. :) 31 | 32 | */ 33 | 34 | /** Do not define this macro in your application. Only libburn/init.c is 35 | entitled to set it. 36 | */ 37 | #ifdef BURN_BACK_HACKS_INIT 38 | 39 | 40 | /** Corresponds to http://libburn.pykix.org/ticket/42 41 | Reinstates the old ban not to blank appendable CD-RW. We see no reason 42 | for this ban yet. It appears unusual. But maybe it patches a bug. 43 | */ 44 | int libburn_back_hack_42= 0; 45 | 46 | 47 | #else /* BURN_BACK_HACKS_INIT */ 48 | 49 | /* Note: no application programmer info beyond this point */ 50 | 51 | 52 | extern int libburn_back_hack_42; 53 | 54 | #endif /* ! BURN_BACK_HACKS_INIT */ 55 | 56 | 57 | -------------------------------------------------------------------------------- /libburn/cleanup.h: -------------------------------------------------------------------------------- 1 | /* 2 | cleanup.c , Copyright 2006 Thomas Schmitt 3 | 4 | A signal handler which cleans up an application and exits. 5 | 6 | Provided under GPLv2+ within GPL projects, BSD license elsewise. 7 | */ 8 | 9 | #ifndef Cleanup_includeD 10 | #define Cleanup_includeD 1 11 | 12 | 13 | /** Layout of an application provided cleanup function using an application 14 | provided handle as first argument and the signal number as second 15 | argument. The third argument is a flag bit field with no defined bits yet. 16 | If the handler returns 2 or -2 then it has delegated exit() to some other 17 | instance and the Cleanup handler shall return rather than exit. 18 | */ 19 | typedef int (*Cleanup_app_handler_T)(void *, int, int); 20 | 21 | 22 | /** Establish exiting signal handlers on (hopefully) all signals that are 23 | not ignored by default or non-catchable. 24 | @param handle Opaque object which knows how to cleanup application 25 | @param handler Function which uses handle to perform application cleanup 26 | @param flag Control Bitfield 27 | bit0= reset to default signal handling 28 | */ 29 | int Cleanup_set_handlers(void *handle, Cleanup_app_handler_T handler, 30 | int flag); 31 | 32 | 33 | #endif /* ! Cleanup_includeD */ 34 | 35 | -------------------------------------------------------------------------------- /libburn/crc.h: -------------------------------------------------------------------------------- 1 | /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ 2 | 3 | /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens 4 | Copyright (c) 2012 Thomas Schmitt 5 | Provided under GPL version 2 or later. 6 | */ 7 | #ifndef BURN__CRC_H 8 | #define BURN__CRC_H 9 | 10 | 11 | #ifdef Xorriso_standalonE 12 | /* Source module crc.c of yet unclear ancestry is excluded from GNU xorriso */ 13 | /* ts B20219 : The functions have been re-implemented from scratch after 14 | studying texts about CRC computation and understanding the 15 | meaning of the underlying ECMA-130 specs. 16 | Nevertheless, there is no need to include them into xorriso 17 | because it does neither CD-TEXT nor raw CD writing. 18 | */ 19 | #ifndef Libburn_no_crc_C 20 | #define Libburn_no_crc_C 1 21 | #endif 22 | #endif 23 | 24 | 25 | #ifndef Libburn_no_crc_C 26 | 27 | unsigned short crc_ccitt(unsigned char *, int len); 28 | unsigned int crc_32(unsigned char *, int len); 29 | 30 | #endif /* Libburn_no_crc_C */ 31 | 32 | 33 | #endif /* BURN__CRC_H */ 34 | -------------------------------------------------------------------------------- /libburn/ddlpa.h: -------------------------------------------------------------------------------- 1 | 2 | /* ddlpa 3 | Implementation of Delicate Device Locking Protocol level A. 4 | Copyright (C) 2007 Thomas Schmitt 5 | Provided under any of the following licenses: GPL, LGPL, BSD. Choose one. 6 | 7 | See ../doc/ddlp.txt for a description of the protocol. 8 | */ 9 | 10 | #ifndef DDLPA_H_INCLUDED 11 | #define DDLPA_H_INCLUDED 1 12 | 13 | 14 | /* An upper limit for the length of standard paths and sibling paths */ 15 | #define DDLPA_MAX_STD_LEN 15 16 | 17 | /* An upper limit for the number of siblings */ 18 | #define DDLPA_MAX_SIBLINGS 5 19 | 20 | struct ddlpa_lock { 21 | 22 | /* Recorded input parameters of locking call */ 23 | char *path; 24 | int path_is_valid; 25 | int in_bus, in_target, in_lun; 26 | int inbtl_is_valid; 27 | int ddlpa_flags; 28 | int o_flags; 29 | 30 | /* Result of locking call */ 31 | char std_path[DDLPA_MAX_STD_LEN + 1]; 32 | int fd; 33 | dev_t rdev; 34 | dev_t dev; 35 | ino_t ino; 36 | int host, channel, id, lun, bus; 37 | int hcilb_is_valid; 38 | int num_siblings; 39 | char sibling_paths[DDLPA_MAX_SIBLINGS][DDLPA_MAX_STD_LEN + 1]; 40 | int sibling_fds[DDLPA_MAX_SIBLINGS]; 41 | dev_t sibling_rdevs[DDLPA_MAX_SIBLINGS]; 42 | dev_t sibling_devs[DDLPA_MAX_SIBLINGS]; 43 | ino_t sibling_inodes[DDLPA_MAX_SIBLINGS]; 44 | 45 | /* Is NULL if all goes well. Else it may contain a text message. */ 46 | char *errmsg; 47 | }; 48 | 49 | 50 | 51 | /** Lock a recorder by naming a device file path. Allocate a new container. 52 | @param path Gives the file system path of the recorder 53 | as known to the calling program. 54 | @param o_flags flags for open(2). Do not use O_EXCL here because this 55 | is done automatically whenever appropriate. 56 | Advised is O_RDWR | O_LARGEFILE, eventually | O_NDELAY. 57 | @param ddlpa_flags 0 = default behavior: the standard path will be opened 58 | and treated by fcntl(F_SETLK) 59 | DDLPA_OPEN_GIVEN_PATH causes the input parameter "path" 60 | to be used with open(2) and fcntl(2). 61 | DDLPA_ALLOW_MISSING_SGRCD allows to grant a lock 62 | although not all three, a sg, a sr and a scd device 63 | file have been found during sibling search. Normally 64 | this is counted as failure due to EBUSY. 65 | @param lockbundle gets allocated and then represents the locking state 66 | @param errmsg if *errmsg is not NULL after the call, it contains an 67 | error message. Then to be released by free(3). 68 | It is NULL in case of success or lack of memory. 69 | @return 0=success , else an errno compatible error number 70 | */ 71 | int ddlpa_lock_path(char *path, int o_flags, int ddlpa_flags, 72 | struct ddlpa_lock **lockbundle, char **errmsg); 73 | 74 | 75 | /** Lock a recorder by naming a Bus,Target,Lun number triple. 76 | Allocate a new container. 77 | @param bus parameter to match ioctl(SCSI_IOCTL_GET_BUS_NUMBER) 78 | @param target parameter to match ioctl(SCSI_IOCTL_GET_IDLUN) &0xff 79 | @param lun parameter to match ioctl(SCSI_IOCTL_GET_IDLUN) &0xff00 80 | @param o_flags see ddlpa_lock_path(). 81 | @param ddlpa_flags see ddlpa_lock_path(). Flag DDLPA_OPEN_GIVEN_PATH 82 | will be ignored. 83 | @param lockbundle see ddlpa_lock_path(). 84 | @param errmsg see ddlpa_lock_path(). 85 | @return 0=success , else an errno compatible error number 86 | */ 87 | int ddlpa_lock_btl(int bus, int target, int lun, 88 | int o_flags, int ddlpa_flags, 89 | struct ddlpa_lock **lockbundle, char **errmsg); 90 | 91 | 92 | /** Release the lock by closing all filedescriptors and freeing memory. 93 | @param lockbundle the lock which is to be released. 94 | *lockbundle will be set to NULL by this call. 95 | @return 0=success , 1=failure 96 | */ 97 | int ddlpa_destroy(struct ddlpa_lock **lockbundle); 98 | 99 | 100 | 101 | /** Definitions of macros used in above functions */ 102 | 103 | #define DDLPA_OPEN_GIVEN_PATH 1 104 | #define DDLPA_ALLOW_MISSING_SGRCD 2 105 | 106 | 107 | #endif /* DDLPA_H_INCLUDED */ 108 | -------------------------------------------------------------------------------- /libburn/debug.c: -------------------------------------------------------------------------------- 1 | /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ 2 | 3 | /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens 4 | Provided under GPL version 2 or later. 5 | */ 6 | 7 | #ifdef HAVE_CONFIG_H 8 | #include "../config.h" 9 | #endif 10 | 11 | 12 | #ifdef WIN32 13 | #include 14 | #endif 15 | 16 | #include 17 | #include 18 | #include "libburn.h" 19 | #include "debug.h" 20 | 21 | static int burn_verbosity = 0; 22 | 23 | void burn_set_verbosity(int v) 24 | { 25 | burn_verbosity = v; 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /libburn/debug.h: -------------------------------------------------------------------------------- 1 | /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ 2 | 3 | #ifndef BURN__DEBUG_H 4 | #define BURN__DEBUG_H 5 | 6 | void burn_print(int level, const char *a, ...); 7 | 8 | #endif /* BURN__DEBUG_H */ 9 | -------------------------------------------------------------------------------- /libburn/ecma130ab.h: -------------------------------------------------------------------------------- 1 | 2 | /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ 3 | 4 | /* ts A91016 : libburn/ecma130ab.h is the replacement for old libburn/lec.h 5 | 6 | Copyright 2009, Thomas Schmitt , libburnia-project.org 7 | Provided under GPL version 2 or later. 8 | 9 | This code module implements the computations prescribed in ECMA-130 Annex A 10 | and B. For explanations of the underlying mathematics see ecma130ab.c . 11 | 12 | */ 13 | 14 | #ifndef Libburn_ecma130ab_includeD 15 | #define Libburn_ecma130ab_includeD 1 16 | 17 | void burn_rspc_parity_p(unsigned char *sector); 18 | 19 | void burn_rspc_parity_q(unsigned char *sector); 20 | 21 | void burn_ecma130_scramble(unsigned char *sector); 22 | 23 | #endif /* ! Libburn_ecma130ab_includeD */ 24 | 25 | -------------------------------------------------------------------------------- /libburn/error.h: -------------------------------------------------------------------------------- 1 | /* -*- indent-tabs-mode; t; tab-width: 8; c-basic-offset: 8; -*- */ 2 | 3 | #ifndef __ERROR_H 4 | #define __ERROR_H 5 | 6 | #define BE_CANCELLED 1 7 | 8 | #endif /* __ERROR_H */ 9 | -------------------------------------------------------------------------------- /libburn/file.h: -------------------------------------------------------------------------------- 1 | /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ 2 | 3 | /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens 4 | Copyright (c) 2006 - 2010 Thomas Schmitt 5 | Provided under GPL version 2 or later. 6 | */ 7 | 8 | #ifndef BURN__FILE_H 9 | #define BURN__FILE_H 10 | 11 | struct burn_source_file 12 | { 13 | char magic[4]; 14 | 15 | int datafd; 16 | int subfd; 17 | off_t fixed_size; 18 | }; 19 | 20 | /* ts A70126 : burn_source_file obsoleted burn_source_fd */ 21 | 22 | 23 | /* ts A70930 */ 24 | struct burn_source_fifo { 25 | char magic[4]; 26 | 27 | /* The fifo stays inactive and unequipped with eventual resources 28 | until its read() method is called for the first time. 29 | Only then burn_fifo_start() gets called, allocates the complete 30 | resources, starts a thread with burn_fifo_source_shuffler() 31 | which shuffles data and finally destroys the resources. 32 | This late start is to stay modest in case of multiple tracks 33 | in one disc. 34 | */ 35 | int is_started; 36 | 37 | void *thread_handle; /* actually a pointer to a thread_t */ 38 | int thread_pid; 39 | int thread_is_valid; 40 | 41 | /* the burn_source for which this fifo is acting as proxy */ 42 | struct burn_source *inp; 43 | int inp_read_size; 44 | 45 | /* <<< up to now it was only a pipe. This is on its way out. */ 46 | int outlet[2]; 47 | 48 | /* The ring buffer mechanism */ 49 | int chunksize; 50 | int chunks; 51 | char *buf; 52 | volatile int buf_writepos; 53 | volatile int buf_readpos; 54 | volatile int end_of_input; 55 | volatile int input_error; 56 | volatile int end_of_consumption; 57 | 58 | off_t in_counter; 59 | off_t out_counter; 60 | 61 | int total_min_fill; 62 | int interval_min_fill; 63 | int put_counter; 64 | int get_counter; 65 | int empty_counter; 66 | int full_counter; 67 | 68 | }; 69 | 70 | 71 | /** The worker behind the fifo thread. 72 | Gets started from burn_fifo_start() in async.c 73 | */ 74 | int burn_fifo_source_shoveller(struct burn_source *source, int flag); 75 | 76 | 77 | /* ts B00922 */ 78 | struct burn_source_offst { 79 | 80 | /* See burn_offst_source_new() */ 81 | struct burn_source *inp; 82 | struct burn_source *prev; 83 | off_t start; 84 | off_t size; 85 | int size_adjustable; 86 | 87 | /* for set_size/get_size */ 88 | int nominal_size; 89 | 90 | /* To help offst_free() */ 91 | struct burn_source *next; 92 | 93 | /* The current reading position */ 94 | int running; 95 | off_t pos; 96 | 97 | }; 98 | 99 | #endif /* LIBBURN__FILE_H */ 100 | -------------------------------------------------------------------------------- /libburn/init.h: -------------------------------------------------------------------------------- 1 | /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ 2 | 3 | #ifndef BURN__INIT_H 4 | #define BURN__INIT_H 5 | 6 | extern int burn_running; 7 | 8 | /** Indicator for burn_drive_get_status() wether a signal hit parts of the 9 | thread team. 10 | 0= all works well , 11 | 1 to 5 = waiting for eventual signal on control thread 12 | > 5 = do abort now 13 | -1 = control thread has been informed 14 | */ 15 | extern volatile int burn_global_abort_level; 16 | extern int burn_global_abort_signum; 17 | extern void *burn_global_signal_handle; 18 | extern burn_abort_handler_t burn_global_signal_handler; 19 | 20 | extern int burn_builtin_signal_action; /* burn_set_signal_handling() */ 21 | extern volatile int burn_builtin_triggered_action; /* burn_is_aborting() */ 22 | 23 | 24 | /* ts B00225 */ 25 | /* @return 0= no abort pending , 1= not control thread , 26 | -1= surprisingly burn_abort returned 27 | */ 28 | int burn_init_catch_on_abort(int flag); 29 | 30 | /* ts B10606 */ 31 | void *burn_alloc_mem(size_t size, size_t count, int flag); 32 | 33 | #define BURN_ALLOC_MEM(pt, typ, count) { \ 34 | pt= (typ *) burn_alloc_mem(sizeof(typ), (size_t) (count), 0); \ 35 | if(pt == NULL) { \ 36 | ret= -1; goto ex; \ 37 | } } 38 | 39 | #define BURN_ALLOC_MEM_VOID(pt, typ, count) { \ 40 | pt= (typ *) burn_alloc_mem(sizeof(typ), (size_t) (count), 0); \ 41 | if(pt == NULL) { \ 42 | goto ex; \ 43 | } } 44 | 45 | #define BURN_FREE_MEM(pt) { \ 46 | if(pt != NULL) \ 47 | free((char *) pt); \ 48 | } 49 | 50 | 51 | /* B20122 */ 52 | int burn_grab_prepare_sig_action(int *signal_action_mem, int flag); 53 | int burn_grab_restore_sig_action(int signal_action_mem, int flag); 54 | 55 | 56 | #endif /* BURN__INIT_H */ 57 | -------------------------------------------------------------------------------- /libburn/libdax_sigmgr.h: -------------------------------------------------------------------------------- 1 | 2 | /* libdax_sigmgr 3 | Signal management facility of libdax and libburn. 4 | Copyright (C) 2006 Thomas Schmitt , provided under GPLv2+ 5 | */ 6 | 7 | 8 | /* 9 | *Never* set this macro outside libdax_sigmgr.c ! 10 | The entrails of this facility are not to be seen by 11 | the other library components or the applications. 12 | */ 13 | #ifdef LIBDAX_SIGMGR_H_INTERNAL 14 | 15 | /** Layout of an application provided cleanup function using an application 16 | provided handle as first argument and the signal number as second 17 | argument. The third argument is a flag bit field with no defined bits yet. 18 | If the handler returns -2 then it has delegated exit() to some other 19 | instance and the Cleanup handler shall return rather than exit. 20 | */ 21 | typedef int (*libdax_sigmgr_handler_t)(void *, int, int); 22 | 23 | 24 | struct libdax_sigmgr { 25 | 26 | /* The thread to be handled by this handler */ 27 | pid_t control_pid; 28 | 29 | /* The libdax api objects to be handled */ 30 | struct libdax_api *api_chain; 31 | 32 | char msg[4096]; 33 | int exiting; 34 | 35 | }; 36 | 37 | 38 | #endif /* LIBDAX_SIGMGR_H_INTERNAL */ 39 | 40 | 41 | #ifndef LIBDAX_SIGMGR_H_INCLUDED 42 | #define LIBDAX_SIGMGR_H_INCLUDED 1 43 | 44 | 45 | #ifndef LIBDAX_SIGMGR_H_INTERNAL 46 | 47 | /* Public Opaque Handles */ 48 | 49 | /** A pointer to this is a opaque handle to a signal handling manager */ 50 | struct libdax_sigmgr; 51 | 52 | 53 | #endif /* ! LIBDAX_SIGMGR_H_INTERNAL */ 54 | 55 | 56 | /* Public Macros */ 57 | 58 | 59 | /* Public Functions */ 60 | 61 | 62 | 63 | /* Calls initiated from inside libdax/libburn */ 64 | 65 | 66 | /* Calls from applications (to be forwarded by libdax/libburn) */ 67 | 68 | 69 | 70 | #ifdef LIDBAX_SIGMGR________________ 71 | 72 | 73 | -- place documentation text here --- 74 | 75 | 76 | #endif /* LIDBAX_SIGMGR_________________ */ 77 | 78 | 79 | 80 | #ifdef LIBDAX_SIGMGR_H_INTERNAL 81 | 82 | /* Internal Functions */ 83 | 84 | #endif /* LIBDAX_SIGMGR_H_INTERNAL */ 85 | 86 | 87 | #endif /* ! LIBDAX_SIGMGR_H_INCLUDED */ 88 | 89 | -------------------------------------------------------------------------------- /libburn/null.c: -------------------------------------------------------------------------------- 1 | /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ 2 | 3 | /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens 4 | Provided under GPL version 2 or later. 5 | */ 6 | 7 | 8 | #ifdef HAVE_CONFIG_H 9 | #include "../config.h" 10 | #endif 11 | 12 | #include "null.h" 13 | #include "libburn.h" 14 | #include 15 | 16 | #include 17 | int null_read(struct burn_source *source, unsigned char *buffer, int size) 18 | { 19 | memset(buffer, 0, size); 20 | return size; 21 | } 22 | 23 | struct burn_source *burn_null_source_new(void) 24 | { 25 | struct burn_source *src; 26 | 27 | src = calloc(1, sizeof(struct burn_source)); 28 | src->refcount = 1; 29 | src->read = null_read; 30 | src->read_sub = NULL; 31 | 32 | src->get_size = 0; 33 | 34 | /* ts A70126 */ 35 | src->set_size = NULL; 36 | 37 | src->free_data = NULL; 38 | src->data = NULL; 39 | return src; 40 | } 41 | -------------------------------------------------------------------------------- /libburn/null.h: -------------------------------------------------------------------------------- 1 | /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ 2 | 3 | #ifndef BURN__NULL_H 4 | #define BURN__NULL_H 5 | 6 | struct burn_source; 7 | int null_read(struct burn_source *source, unsigned char *buffer, int size); 8 | struct burn_source *burn_null_source_new(void); 9 | 10 | #endif /* LIBBURN__NULL_H */ 11 | -------------------------------------------------------------------------------- /libburn/options.h: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens 3 | Copyright (c) 2006 - 2012 Thomas Schmitt 4 | Provided under GPL version 2 or later. 5 | */ 6 | 7 | #ifndef BURN__OPTIONS_H 8 | #define BURN__OPTIONS_H 9 | 10 | #include "libburn.h" 11 | 12 | /** Options for disc writing operations. This should be created with 13 | burn_write_opts_new() and freed with burn_write_opts_free(). */ 14 | struct burn_write_opts 15 | { 16 | /** Drive the write opts are good for */ 17 | struct burn_drive *drive; 18 | 19 | /** For internal use. */ 20 | int refcount; 21 | 22 | /** The method/style of writing to use. */ 23 | enum burn_write_types write_type; 24 | /** format of the data to send to the drive */ 25 | enum burn_block_types block_type; 26 | 27 | /** Number of toc entries. if this is 0, they will be auto generated*/ 28 | int toc_entries; 29 | /** Toc entries for the disc */ 30 | struct burn_toc_entry *toc_entry; 31 | 32 | /** Simulate the write so that the disc is not actually written */ 33 | unsigned int simulate:1; 34 | /** If available, enable a drive feature which prevents buffer 35 | underruns if not enough data is available to keep up with the 36 | drive. */ 37 | unsigned int underrun_proof:1; 38 | /** Perform calibration of the drive's laser before beginning the 39 | write. */ 40 | unsigned int perform_opc:1; 41 | 42 | /* ts A61219 : Output block size to trigger buffer flush if hit. 43 | -1 with CD, 32 kB with DVD */ 44 | int obs; 45 | int obs_pad; /* >0 pad up last block to obs, 0 do not 46 | 2 indicates burn_write_opts_set_obs_pad(,1) 47 | */ 48 | 49 | /* ts A61222 : Start address for media which allow a choice */ 50 | off_t start_byte; 51 | 52 | /* ts A70213 : Wether to fill up the available space on media */ 53 | int fill_up_media; 54 | 55 | /* ts A70303 : Wether to override conformance checks: 56 | - the check wether CD write+block type is supported by the drive 57 | */ 58 | int force_is_set; 59 | 60 | /* ts A80412 : whether to use WRITE12 with Streaming bit set 61 | rather than WRITE10. Speeds up DVD-RAM. Might help with BD-RE. 62 | This gets transferred to burn_drive.do_stream_recording 63 | */ 64 | int do_stream_recording; 65 | 66 | /* ts A91115 : override value for .obs on DVD media. 67 | Only values 0, 32K and 64K are allowed for now. */ 68 | int dvd_obs_override; 69 | 70 | /* ts A91115 : size of the fsync() interval for stdio writing. 71 | Values 0 or >= 32 counted in 2 KB blocks. */ 72 | int stdio_fsync_size; 73 | 74 | /* ts B11203 : CD-TEXT */ 75 | unsigned char *text_packs; 76 | int num_text_packs; 77 | int no_text_pack_crc_check; 78 | 79 | /** A disc can have a media catalog number */ 80 | int has_mediacatalog; 81 | unsigned char mediacatalog[13]; 82 | /** Session format */ 83 | int format; 84 | /* internal use only */ 85 | unsigned char control; 86 | unsigned char multi; 87 | }; 88 | 89 | /* Default value for burn_write_opts.stdio_flush_size 90 | */ 91 | #define Libburn_stdio_fsync_limiT 8192 92 | 93 | /* Maximum number of Lead-in text packs. 94 | READ TOC/PMA/ATIP can at most return 3640.7 packs. 95 | The sequence counters of the packs have 8 bits. There are 8 blocks at most. 96 | Thus max 2048 packs. 97 | */ 98 | #define Libburn_leadin_cdtext_packs_maX 2048 99 | 100 | 101 | /** Options for disc reading operations. This should be created with 102 | burn_read_opts_new() and freed with burn_read_opts_free(). */ 103 | struct burn_read_opts 104 | { 105 | /** Drive the read opts are good for */ 106 | struct burn_drive *drive; 107 | 108 | /** For internal use. */ 109 | int refcount; 110 | 111 | /** Read in raw mode, so that everything in the data tracks on the 112 | disc is read, including headers. Not needed if just reading a 113 | filesystem off a disc, but it should usually be used when making a 114 | disc image or copying a disc. */ 115 | unsigned int raw:1; 116 | /** Report c2 errors. Useful for statistics reporting */ 117 | unsigned int c2errors:1; 118 | /** Read subcodes from audio tracks on the disc */ 119 | unsigned int subcodes_audio:1; 120 | /** Read subcodes from data tracks on the disc */ 121 | unsigned int subcodes_data:1; 122 | /** Have the drive recover errors if possible */ 123 | unsigned int hardware_error_recovery:1; 124 | /** Report errors even when they were recovered from */ 125 | unsigned int report_recovered_errors:1; 126 | /** Read blocks even when there are unrecoverable errors in them */ 127 | unsigned int transfer_damaged_blocks:1; 128 | 129 | /** The number of retries the hardware should make to correct 130 | errors. */ 131 | unsigned char hardware_error_retries; 132 | 133 | /* ts B21119 */ 134 | /* >>> Needs API access */ 135 | /** Whether to set DAP bit which allows drive to apply 136 | "flaw obscuring mechanisms like audio data mute and interpolate" 137 | */ 138 | unsigned int dap_bit; 139 | 140 | }; 141 | 142 | #endif /* BURN__OPTIONS_H */ 143 | -------------------------------------------------------------------------------- /libburn/os-dummy.h: -------------------------------------------------------------------------------- 1 | 2 | /* os-dummy.h 3 | Operating system specific libburn definitions and declarations. Included 4 | by os.h in case of compilation for 5 | Unknown POSIX like systems 6 | with the dummy MMC transport adapter sg-dummy.c 7 | 8 | Copyright (C) 2009 Thomas Schmitt , provided under GPLv2+ 9 | */ 10 | 11 | 12 | /** List of all signals which shall be caught by signal handlers and trigger 13 | a graceful abort of libburn. (See man 7 signal.) 14 | */ 15 | /* Once as system defined macros */ 16 | #define BURN_OS_SIGNAL_MACRO_LIST \ 17 | SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGABRT, \ 18 | SIGFPE, SIGSEGV, SIGPIPE, SIGALRM, SIGTERM, \ 19 | SIGUSR1, SIGUSR2, SIGXCPU, SIGTSTP, SIGTTIN, \ 20 | SIGTTOU 21 | 22 | /* Once as text 1:1 list of strings for messages and interpreters */ 23 | #define BURN_OS_SIGNAL_NAME_LIST \ 24 | "SIGHUP", "SIGINT", "SIGQUIT", "SIGILL", "SIGABRT", \ 25 | "SIGFPE", "SIGSEGV", "SIGPIPE", "SIGALRM", "SIGTERM", \ 26 | "SIGUSR1", "SIGUSR2", "SIGXCPU", "SIGTSTP", "SIGTTIN", \ 27 | "SIGTTOU" 28 | 29 | /* The number of above list items */ 30 | #define BURN_OS_SIGNAL_COUNT 16 31 | 32 | /** The list of all signals which shall surely not be caught. 33 | It depends on the particular signal whether it can be ignored or whether 34 | it will lead to sudden death of the process. 35 | Some signals are not POSIX, 36 | but nevertheless ought to be ignored if they are defined. 37 | */ 38 | 39 | #ifdef SIGWINCH 40 | #define BURN_OS_SIG_WINCH ,SIGWINCH 41 | #define BURN_OS_SIG_WINCH_CNT 1 42 | #else 43 | #define BURN_OS_SIG_WINCH 44 | #define BURN_OS_SIG_WINCH_CNT 0 45 | #endif 46 | 47 | #ifdef SIGURG 48 | #define BURN_OS_SIG_URG ,SIGURG 49 | #define BURN_OS_SIG_URG_CNT 1 50 | #else 51 | #define BURN_OS_SIG_URG 52 | #define BURN_OS_SIG_URG_CNT 0 53 | #endif 54 | 55 | /** The combined list of all signals which shall not be caught. 56 | */ 57 | #define BURN_OS_NON_SIGNAL_MACRO_LIST \ 58 | SIGKILL, SIGCHLD, SIGSTOP BURN_OS_SIG_WINCH BURN_OS_SIG_URG 59 | 60 | /* The number of above list items */ 61 | #define BURN_OS_NON_SIGNAL_COUNT \ 62 | ( 3 + BURN_OS_SIG_WINCH_CNT + BURN_OS_SIG_URG_CNT ) 63 | 64 | 65 | /* The maximum size for a (SCSI) i/o transaction */ 66 | /* Important : MUST be at least 32768 ! */ 67 | #define BURN_OS_TRANSPORT_BUFFER_SIZE 65536 68 | 69 | 70 | /* To hold the position of the most recently delivered address from 71 | device enumeration. 72 | */ 73 | struct burn_drive_enumerator_struct { 74 | int pos; 75 | int info_count; 76 | char **info_list; 77 | }; 78 | 79 | #define BURN_OS_DEFINE_DRIVE_ENUMERATOR_T \ 80 | typedef struct burn_drive_enumerator_struct burn_drive_enumerator_t; 81 | 82 | 83 | /* The list of operating system dependent elements in struct burn_drive. 84 | Usually they are initialized in sg-*.c:enumerate_common(). 85 | */ 86 | #define BURN_OS_TRANSPORT_DRIVE_ELEMENTS \ 87 | int just_a_dummy; 88 | 89 | -------------------------------------------------------------------------------- /libburn/os-freebsd.h: -------------------------------------------------------------------------------- 1 | 2 | /* os-freebsd.h 3 | Operating system specific libburn definitions and declarations. Included 4 | by os.h in case of compilation for 5 | FreeBSD with CAM 6 | 7 | Copyright (C) 2006 - 2010 Thomas Schmitt , 8 | provided under GPLv2+ 9 | */ 10 | 11 | /** List of all signals which shall be caught by signal handlers and trigger 12 | a graceful abort of libburn. (See man 7 signal.) 13 | */ 14 | /* Once as system defined macros */ 15 | #define BURN_OS_SIGNAL_MACRO_LIST \ 16 | SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGABRT, \ 17 | SIGFPE, SIGSEGV, SIGPIPE, SIGALRM, SIGTERM, \ 18 | SIGUSR1, SIGUSR2, SIGXCPU, SIGTSTP, SIGTTIN, \ 19 | SIGTTOU, \ 20 | SIGBUS, SIGPROF, SIGSYS, SIGTRAP, \ 21 | SIGVTALRM, SIGXCPU, SIGXFSZ 22 | 23 | /* Once as text 1:1 list of strings for messages and interpreters */ 24 | #define BURN_OS_SIGNAL_NAME_LIST \ 25 | "SIGHUP", "SIGINT", "SIGQUIT", "SIGILL", "SIGABRT", \ 26 | "SIGFPE", "SIGSEGV", "SIGPIPE", "SIGALRM", "SIGTERM", \ 27 | "SIGUSR1", "SIGUSR2", "SIGXCPU", "SIGTSTP", "SIGTTIN", \ 28 | "SIGTTOU", \ 29 | "SIGBUS", "SIGPROF", "SIGSYS", "SIGTRAP", \ 30 | "SIGVTALRM", "SIGXCPU", "SIGXFSZ" 31 | 32 | /* The number of above list items */ 33 | #define BURN_OS_SIGNAL_COUNT 23 34 | 35 | /** To list all signals which shall surely not be caught */ 36 | #define BURN_OS_NON_SIGNAL_MACRO_LIST \ 37 | SIGKILL, SIGCHLD, SIGSTOP, SIGURG, SIGWINCH 38 | 39 | /* The number of above list items */ 40 | #define BURN_OS_NON_SIGNAL_COUNT 5 41 | 42 | 43 | /* The maximum size for a (SCSI) i/o transaction */ 44 | /* Important : MUST be at least 32768 ! */ 45 | /* Older BSD info says that 32 kB is maximum. But 64 kB seems to work well 46 | on 8-STABLE. It is by default only used with BD in streaming mode. 47 | So older systems should still be quite safe with this buffer max size. 48 | */ 49 | #define BURN_OS_TRANSPORT_BUFFER_SIZE 65536 50 | 51 | 52 | /** To hold all state information of BSD device enumeration 53 | which are now local in sg_enumerate() . So that sg_give_next_adr() 54 | can work in BSD and sg_enumerate() can use it. 55 | */ 56 | #define BURN_OS_DEFINE_DRIVE_ENUMERATOR_T \ 57 | struct burn_drive_enumeration_state; \ 58 | typedef struct burn_drive_enumeration_state *burn_drive_enumerator_t; 59 | 60 | 61 | /* The list of operating system dependent elements in struct burn_drive. 62 | To be initialized and used within sg-*.c . 63 | */ 64 | #define BURN_OS_TRANSPORT_DRIVE_ELEMENTS \ 65 | struct cam_device* cam; \ 66 | int lock_fd; \ 67 | int is_ahci; \ 68 | 69 | 70 | -------------------------------------------------------------------------------- /libburn/os-libcdio.h: -------------------------------------------------------------------------------- 1 | 2 | /* os-libcdio.h 3 | Operating system specific libburn definitions and declarations. Included 4 | by os.h in case of compilation for 5 | Unknown X/Open-like systems 6 | with GNU libcdio MMC transport adapter sg-libcdio.c 7 | 8 | Copyright (C) 2009 Thomas Schmitt , provided under GPLv2+ 9 | */ 10 | 11 | 12 | /** List of all signals which shall be caught by signal handlers and trigger 13 | a graceful abort of libburn. (See man 7 signal.) 14 | */ 15 | /* Once as system defined macros */ 16 | #define BURN_OS_SIGNAL_MACRO_LIST \ 17 | SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGABRT, \ 18 | SIGFPE, SIGSEGV, SIGPIPE, SIGALRM, SIGTERM, \ 19 | SIGUSR1, SIGUSR2, SIGXCPU, SIGTSTP, SIGTTIN, \ 20 | SIGTTOU 21 | 22 | /* Once as text 1:1 list of strings for messages and interpreters */ 23 | #define BURN_OS_SIGNAL_NAME_LIST \ 24 | "SIGHUP", "SIGINT", "SIGQUIT", "SIGILL", "SIGABRT", \ 25 | "SIGFPE", "SIGSEGV", "SIGPIPE", "SIGALRM", "SIGTERM", \ 26 | "SIGUSR1", "SIGUSR2", "SIGXCPU", "SIGTSTP", "SIGTTIN", \ 27 | "SIGTTOU" 28 | 29 | /* The number of above list items */ 30 | #define BURN_OS_SIGNAL_COUNT 16 31 | 32 | 33 | /** The list of all signals which shall surely not be caught. 34 | It depends on the particular signal whether it can be ignored or whether 35 | it will lead to sudden death of the process. 36 | Some signals are not POSIX, 37 | but nevertheless ought to be ignored if they are defined. 38 | */ 39 | 40 | #ifdef SIGWINCH 41 | #define BURN_OS_SIG_WINCH ,SIGWINCH 42 | #define BURN_OS_SIG_WINCH_CNT 1 43 | #else 44 | #define BURN_OS_SIG_WINCH 45 | #define BURN_OS_SIG_WINCH_CNT 0 46 | #endif 47 | 48 | #ifdef SIGURG 49 | #define BURN_OS_SIG_URG ,SIGURG 50 | #define BURN_OS_SIG_URG_CNT 1 51 | #else 52 | #define BURN_OS_SIG_URG 53 | #define BURN_OS_SIG_URG_CNT 0 54 | #endif 55 | 56 | /** The combined list of all signals which shall not be caught. 57 | */ 58 | #define BURN_OS_NON_SIGNAL_MACRO_LIST \ 59 | SIGKILL, SIGCHLD, SIGSTOP BURN_OS_SIG_WINCH BURN_OS_SIG_URG 60 | 61 | /* The number of above list items */ 62 | #define BURN_OS_NON_SIGNAL_COUNT \ 63 | ( 3 + BURN_OS_SIG_WINCH_CNT + BURN_OS_SIG_URG_CNT ) 64 | 65 | 66 | /* The maximum size for a (SCSI) i/o transaction */ 67 | /* My Blu-ray burner LG GGW-H20 writes junk if stream recording is combined 68 | with buffer size 32 kB. So stream recording is allowed only with size 64k. 69 | Older BSD info says that 32 kB is maximum. But 64 kB seems to work well 70 | on 8-STABLE. It is by default only used with BD in streaming mode. 71 | So older systems should still be quite safe with this buffer max size. 72 | */ 73 | /* Important : MUST be at least 32768 ! */ 74 | #define BURN_OS_TRANSPORT_BUFFER_SIZE 65536 75 | 76 | 77 | /* To hold the position of the most recently delivered address from 78 | device enumeration. 79 | */ 80 | struct burn_drive_enumerator_struct { 81 | char **ppsz_cd_drives; 82 | char **pos; 83 | }; 84 | 85 | #define BURN_OS_DEFINE_DRIVE_ENUMERATOR_T \ 86 | typedef struct burn_drive_enumerator_struct burn_drive_enumerator_t; 87 | 88 | 89 | /* The list of operating system dependent elements in struct burn_drive. 90 | Usually they are initialized in sg-*.c:enumerate_common(). 91 | */ 92 | #define BURN_OS_TRANSPORT_DRIVE_ELEMENTS \ 93 | void *p_cdio; /* actually a pointer to CdIo_t */ \ 94 | char libcdio_name[4096]; /* The drive path as used by libcdio */ \ 95 | 96 | -------------------------------------------------------------------------------- /libburn/os-linux.h: -------------------------------------------------------------------------------- 1 | 2 | /* os-linux.h 3 | Operating system specific libburn definitions and declarations. Included 4 | by os.h in case of compilation for 5 | Linux kernels 2.4 and 2.6, GNU/Linux SCSI Generic (sg) 6 | 7 | Copyright (C) 2006 - 2010 Thomas Schmitt 8 | Provided under GPL version 2 or later. 9 | */ 10 | 11 | 12 | /** List of all signals which shall be caught by signal handlers and trigger 13 | a graceful abort of libburn. (See man 7 signal.) 14 | */ 15 | /* Once as system defined macros */ 16 | #define BURN_OS_SIGNAL_MACRO_LIST \ 17 | SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGABRT, \ 18 | SIGFPE, SIGSEGV, SIGPIPE, SIGALRM, SIGTERM, \ 19 | SIGUSR1, SIGUSR2, SIGXCPU, SIGTSTP, SIGTTIN, \ 20 | SIGTTOU, \ 21 | SIGBUS, SIGPOLL, SIGPROF, SIGSYS, SIGTRAP, \ 22 | SIGVTALRM, SIGXCPU, SIGXFSZ 23 | 24 | /* Once as text 1:1 list of strings for messages and interpreters */ 25 | #define BURN_OS_SIGNAL_NAME_LIST \ 26 | "SIGHUP", "SIGINT", "SIGQUIT", "SIGILL", "SIGABRT", \ 27 | "SIGFPE", "SIGSEGV", "SIGPIPE", "SIGALRM", "SIGTERM", \ 28 | "SIGUSR1", "SIGUSR2", "SIGXCPU", "SIGTSTP", "SIGTTIN", \ 29 | "SIGTTOU", \ 30 | "SIGBUS", "SIGPOLL", "SIGPROF", "SIGSYS", "SIGTRAP", \ 31 | "SIGVTALRM", "SIGXCPU", "SIGXFSZ" 32 | 33 | /* The number of above list items */ 34 | #define BURN_OS_SIGNAL_COUNT 24 35 | 36 | /** To list all signals which shall surely not be caught */ 37 | #define BURN_OS_NON_SIGNAL_MACRO_LIST \ 38 | SIGKILL, SIGCHLD, SIGSTOP, SIGURG, SIGWINCH 39 | 40 | /* The number of above list items */ 41 | #define BURN_OS_NON_SIGNAL_COUNT 5 42 | 43 | 44 | /* The maximum size for a (SCSI) i/o transaction */ 45 | /* Important : MUST be at least 32768 ! */ 46 | /* ts A70523 : >32k seems not good with kernel 2.4 USB drivers and audio 47 | #define BURN_OS_TRANSPORT_BUFFER_SIZE 32768 48 | */ 49 | /* ts A80414 : curbed in write.c CD media to Libburn_cd_obS = 32 kiB 50 | re-enlarged transport to 64 kiB for BD-RE experiments 51 | */ 52 | #define BURN_OS_TRANSPORT_BUFFER_SIZE 65536 53 | 54 | 55 | /* To hold the position of the most recently delivered address from 56 | device enumeration. 57 | */ 58 | struct burn_drive_enumerator_struct { 59 | int pos; 60 | int info_count; 61 | char **info_list; 62 | }; 63 | 64 | #define BURN_OS_DEFINE_DRIVE_ENUMERATOR_T \ 65 | typedef struct burn_drive_enumerator_struct burn_drive_enumerator_t; 66 | 67 | 68 | /* Parameters for sibling list. See sibling_fds, sibling_fnames */ 69 | #define BURN_OS_SG_MAX_SIBLINGS 5 70 | #define BURN_OS_SG_MAX_NAMELEN 16 71 | 72 | /* The list of operating system dependent elements in struct burn_drive. 73 | Usually they are initialized in sg-*.c:enumerate_common(). 74 | */ 75 | #define BURN_OS_TRANSPORT_DRIVE_ELEMENTS \ 76 | int fd; \ 77 | \ 78 | /* ts A60926 : trying to lock against growisofs /dev/srN, /dev/scdN */ \ 79 | int sibling_count; \ 80 | int sibling_fds[BURN_OS_SG_MAX_SIBLINGS]; \ 81 | /* ts A70409 : DDLP */ \ 82 | char sibling_fnames[BURN_OS_SG_MAX_SIBLINGS][BURN_OS_SG_MAX_NAMELEN]; 83 | 84 | -------------------------------------------------------------------------------- /libburn/os-solaris.h: -------------------------------------------------------------------------------- 1 | 2 | /* os-solaris.h 3 | Operating system specific libburn definitions and declarations. Included 4 | by os.h in case of compilation for 5 | Solaris based systems, e.g. SunOS 5.11 6 | with Solaris uscsi MMC transport adapter sg-solaris.c 7 | 8 | Copyright (C) 2010 Thomas Schmitt , provided under GPLv2+ 9 | */ 10 | 11 | 12 | /** List of all signals which shall be caught by signal handlers and trigger 13 | a graceful abort of libburn. (See man signal.h) 14 | */ 15 | /* Once as system defined macros */ 16 | #define BURN_OS_SIGNAL_MACRO_LIST \ 17 | SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGABRT, \ 18 | SIGFPE, SIGSEGV, SIGPIPE, SIGALRM, SIGTERM, \ 19 | SIGUSR1, SIGUSR2, SIGXCPU, SIGTSTP, SIGTTIN, \ 20 | SIGTTOU 21 | 22 | /* Once as text 1:1 list of strings for messages and interpreters */ 23 | #define BURN_OS_SIGNAL_NAME_LIST \ 24 | "SIGHUP", "SIGINT", "SIGQUIT", "SIGILL", "SIGABRT", \ 25 | "SIGFPE", "SIGSEGV", "SIGPIPE", "SIGALRM", "SIGTERM", \ 26 | "SIGUSR1", "SIGUSR2", "SIGXCPU", "SIGTSTP", "SIGTTIN", \ 27 | "SIGTTOU" 28 | 29 | /* The number of above list items */ 30 | #define BURN_OS_SIGNAL_COUNT 16 31 | 32 | /** To list all signals which shall surely not be caught */ 33 | #define BURN_OS_NON_SIGNAL_MACRO_LIST \ 34 | SIGKILL, SIGCHLD, SIGSTOP, SIGURG, SIGWINCH 35 | 36 | /* The number of above list items */ 37 | #define BURN_OS_NON_SIGNAL_COUNT 5 38 | 39 | 40 | /* The maximum size for a (SCSI) i/o transaction */ 41 | /* Important : MUST be at least 32768 ! */ 42 | /* My Blu-ray burner LG GGW-H20 writes junk if stream recording is combined 43 | with buffer size 32 kB. So stream recording is allowed only with size 64k. 44 | */ 45 | #define BURN_OS_TRANSPORT_BUFFER_SIZE 65536 46 | 47 | 48 | /* >>> */ 49 | 50 | /* To hold the position of the most recently delivered address from 51 | device enumeration. 52 | */ 53 | struct burn_drive_enumerator_struct { 54 | void *dir; 55 | }; 56 | 57 | #define BURN_OS_DEFINE_DRIVE_ENUMERATOR_T \ 58 | typedef struct burn_drive_enumerator_struct burn_drive_enumerator_t; 59 | 60 | 61 | /* The list of operating system dependent elements in struct burn_drive. 62 | Usually they are initialized in sg-*.c:enumerate_common(). 63 | */ 64 | #define BURN_OS_TRANSPORT_DRIVE_ELEMENTS \ 65 | int fd; 66 | 67 | -------------------------------------------------------------------------------- /libburn/os.h: -------------------------------------------------------------------------------- 1 | 2 | /* os.h 3 | Operating system specific libburn definitions and declarations. 4 | The macros defined here are used by libburn modules in order to 5 | avoid own system dependent case distinctions. 6 | Copyright (C) 2009 Thomas Schmitt , provided under GPLv2+ 7 | */ 8 | 9 | #ifndef BURN_OS_H_INCLUDED 10 | #define BURN_OS_H_INCLUDED 1 11 | 12 | /* 13 | Operating system case distinction 14 | */ 15 | 16 | 17 | #ifdef Libburn_use_sg_dummY 18 | 19 | 20 | /* --------- Any other system. With dummy MMC transport sg-dummy.c --------- */ 21 | #include "os-dummy.h" 22 | 23 | 24 | #else 25 | #ifdef Libburn_use_libcdiO 26 | 27 | 28 | /* -------------------------- X/Open with GNU libcdio ---------------------- */ 29 | #include "os-libcdio.h" 30 | 31 | 32 | #else 33 | #ifdef __FreeBSD__ 34 | 35 | 36 | /* ----------------------------- FreeBSD with CAM -------------------------- */ 37 | #include "os-freebsd.h" 38 | 39 | 40 | #else 41 | #ifdef __FreeBSD_kernel__ 42 | 43 | 44 | /* ----------------------- FreeBSD with CAM under Debian ------------------- */ 45 | #include "os-freebsd.h" 46 | 47 | 48 | #else 49 | #ifdef __linux 50 | 51 | 52 | /* ------- Linux kernels 2.4 and 2.6 with GNU/Linux SCSI Generic (sg) ------ */ 53 | #include "os-linux.h" 54 | 55 | 56 | #else 57 | #ifdef __sun 58 | 59 | 60 | /* ------- Solaris (e.g. SunOS 5.11) with uscsi ------ */ 61 | #include "os-solaris.h" 62 | 63 | 64 | #else 65 | 66 | 67 | /* --------- Any other system. With dummy MMC transport sg-dummy.c --------- */ 68 | #include "os-dummy.h" 69 | 70 | 71 | #endif /* ! __sun*/ 72 | #endif /* ! __linux */ 73 | #endif /* ! __FreeBSD__kernel__ */ 74 | #endif /* ! __FreeBSD__ */ 75 | #endif /* ! Libburn_use_libcdiO */ 76 | #endif /* ! Libburn_use_sg_dummY */ 77 | 78 | 79 | #endif /* ! BURN_OS_H_INCLUDED */ 80 | 81 | -------------------------------------------------------------------------------- /libburn/read.h: -------------------------------------------------------------------------------- 1 | /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ 2 | 3 | #ifndef __LIBBURN_READ 4 | #define __LIBBURN_READ 5 | 6 | struct burn_drive; 7 | struct burn_read_opts; 8 | 9 | int burn_sector_length_read(struct burn_drive *d, 10 | const struct burn_read_opts *o); 11 | void burn_packet_process(struct burn_drive *d, unsigned char *data, 12 | const struct burn_read_opts *o); 13 | 14 | #endif /* __LIBBURN_READ */ 15 | -------------------------------------------------------------------------------- /libburn/sbc.h: -------------------------------------------------------------------------------- 1 | /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ 2 | 3 | /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens 4 | Copyright (c) 2006 - 2010 Thomas Schmitt 5 | Provided under GPL version 2 or later. 6 | */ 7 | 8 | 9 | #ifndef __SBC 10 | #define __SBC 11 | 12 | struct burn_drive; 13 | 14 | void sbc_load(struct burn_drive *); 15 | void sbc_eject(struct burn_drive *); 16 | 17 | /* ts A61118 */ 18 | int sbc_start_unit(struct burn_drive *); 19 | 20 | /* ts A61021 : the sbc specific part of sg.c:enumerate_common() 21 | */ 22 | int sbc_setup_drive(struct burn_drive *d); 23 | 24 | #endif /* __SBC */ 25 | -------------------------------------------------------------------------------- /libburn/sector.h: -------------------------------------------------------------------------------- 1 | /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ 2 | 3 | /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens 4 | Copyright (c) 2006 - 2010 Thomas Schmitt 5 | Provided under GPL version 2 or later. 6 | */ 7 | 8 | #ifndef __SECTOR 9 | #define __SECTOR 10 | 11 | #include "libburn.h" 12 | #include "transport.h" 13 | 14 | struct burn_drive; 15 | struct isrc; 16 | 17 | int dec_to_bcd(int); 18 | 19 | int sector_toc(struct burn_write_opts *, int mode); 20 | int sector_pregap(struct burn_write_opts *, unsigned char tno, 21 | unsigned char control, int mode); 22 | int sector_postgap(struct burn_write_opts *, unsigned char tno, 23 | unsigned char control, int mode); 24 | int sector_lout(struct burn_write_opts *, unsigned char control, int mode); 25 | int sector_data(struct burn_write_opts *, struct burn_track *t, int psub); 26 | 27 | /* ts B20113 */ 28 | int sector_write_buffer(struct burn_drive *d, 29 | struct burn_track *track, int flag); 30 | 31 | /* ts A61009 */ 32 | int sector_headers_is_ok(struct burn_write_opts *o, int mode); 33 | 34 | int sector_headers(struct burn_write_opts *, unsigned char *, 35 | int mode, int leadin); 36 | void subcode_user(struct burn_write_opts *, unsigned char *s, 37 | unsigned char tno, unsigned char control, 38 | unsigned char index, struct isrc *isrc, int psub); 39 | 40 | int sector_identify(unsigned char *); 41 | 42 | void process_q(struct burn_drive *d, unsigned char *q); 43 | 44 | #endif /* __SECTOR */ 45 | -------------------------------------------------------------------------------- /libburn/sg.c: -------------------------------------------------------------------------------- 1 | 2 | /* sg.c 3 | Switcher for operating system dependent transport level modules of libburn. 4 | Copyright (C) 2009 - 2010 Thomas Schmitt , 5 | provided under GPLv2+ 6 | */ 7 | 8 | #ifdef HAVE_CONFIG_H 9 | #include "../config.h" 10 | #undef HAVE_CONFIG_H 11 | #endif 12 | 13 | 14 | #ifdef Libburn_use_sg_dummY 15 | 16 | #include "sg-dummy.c" 17 | 18 | #else 19 | #ifdef Libburn_use_libcdiO 20 | 21 | #include "sg-libcdio.c" 22 | 23 | #else 24 | #ifdef __FreeBSD__ 25 | 26 | #ifdef Libburn_use_sg_freebsd_porT 27 | #include "sg-freebsd-port.c" 28 | #else 29 | #include "sg-freebsd.c" 30 | #endif 31 | 32 | #else 33 | #ifdef __FreeBSD_kernel__ 34 | 35 | #ifdef Libburn_use_sg_freebsd_porT 36 | #include "sg-freebsd-port.c" 37 | #else 38 | #include "sg-freebsd.c" 39 | #endif 40 | 41 | #else 42 | #ifdef __linux 43 | 44 | #include "sg-linux.c" 45 | 46 | #else 47 | #ifdef __sun 48 | 49 | #include "sg-solaris.c" 50 | 51 | #else 52 | 53 | /* The dummy adapter formally fulfills the expectations of libburn towards 54 | its SCSI command transport. It will show no drives and perform no SCSI 55 | commands. 56 | libburn will then be restricted to using its stdio pseudo drives. 57 | */ 58 | static int intentional_compiler_warning(void) 59 | { 60 | int INTENTIONAL_COMPILER_WARNING_; 61 | int Cannot_recognize_GNU_Linux_nor_FreeBSD_nor_Solaris_; 62 | int Have_to_use_dummy_MMC_transport_adapter_; 63 | int This_libburn_will_not_be_able_to_operate_on_real_CD_drives; 64 | int Have_to_use_dummy_MMC_transport_adapter; 65 | int Cannot_recognize_GNU_Linux_nor_FreeBSD_nor_Solaris; 66 | int INTENTIONAL_COMPILER_WARNING; 67 | 68 | return(0); 69 | } 70 | 71 | #include "sg-dummy.c" 72 | 73 | #endif /* ! __sun */ 74 | #endif /* ! __linux */ 75 | #endif /* ! __FreeBSD_kernel__ */ 76 | #endif /* ! __FreeBSD__ */ 77 | #endif /* ! Libburn_use_libcdiO */ 78 | #endif /* ! Libburn_use_sg_dummY */ 79 | 80 | -------------------------------------------------------------------------------- /libburn/sg.h: -------------------------------------------------------------------------------- 1 | /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ 2 | 3 | /* Copyright (C) 2009 Thomas Schmitt , provided under GPLv2+ 4 | */ 5 | 6 | #ifndef __SG 7 | #define __SG 8 | 9 | 10 | #include "os.h" 11 | 12 | 13 | /* see os.h for name of particular os-*.h where this is defined */ 14 | BURN_OS_DEFINE_DRIVE_ENUMERATOR_T 15 | 16 | 17 | struct burn_drive; 18 | struct command; 19 | 20 | 21 | /* ts A60922 ticket 33 */ 22 | int sg_give_next_adr(burn_drive_enumerator_t *enm_context, 23 | char adr[], int adr_size, int initialize); 24 | int sg_is_enumerable_adr(char *adr); 25 | int sg_obtain_scsi_adr(char *path, int *bus_no, int *host_no, int *channel_no, 26 | int *target_no, int *lun_no); 27 | 28 | int sg_grab(struct burn_drive *); 29 | int sg_release(struct burn_drive *); 30 | int sg_issue_command(struct burn_drive *, struct command *); 31 | 32 | /* ts A61115 : formerly sg_enumerate();ata_enumerate() */ 33 | int scsi_enumerate_drives(void); 34 | 35 | int sg_drive_is_open(struct burn_drive * d); 36 | 37 | int burn_os_is_2k_seekrw(char *path, int flag); 38 | 39 | int burn_os_stdio_capacity(char *path, off_t *bytes); 40 | 41 | /* ts A91227 */ 42 | /** Returns the id string of the SCSI transport adapter and eventually 43 | needed operating system facilities. 44 | This call is usable even if sg_initialize() was not called yet. In that 45 | case a preliminary constant message might be issued if detailed info is 46 | not available yet. 47 | @param msg returns id string 48 | @param flag unused yet, submit 0 49 | @return 1 = success, <=0 = failure 50 | */ 51 | int sg_id_string(char msg[1024], int flag); 52 | 53 | /* ts A91225 */ 54 | /** Performs global initialization of the SCSI transport adapter and eventually 55 | needed operating system facilities. Checks for compatibility supporting 56 | software components. 57 | @param msg returns ids and/or error messages of eventual helpers 58 | @param flag unused yet, submit 0 59 | @return 1 = success, <=0 = failure 60 | */ 61 | int sg_initialize(char msg[1024], int flag); 62 | 63 | /* ts A91227 */ 64 | /** Performs global finalization of the SCSI transport adapter and eventually 65 | needed operating system facilities. Releases globally aquired resources. 66 | @param flag unused yet, submit 0 67 | @return 1 = success, <=0 = failure 68 | */ 69 | int sg_shutdown(int flag); 70 | 71 | /* ts A91227 */ 72 | /** Finalizes BURN_OS_TRANSPORT_DRIVE_ELEMENTS, the components of 73 | struct burn_drive which are defined in os-*.h. 74 | The eventual initialization of those components was made underneath 75 | scsi_enumerate_drives(). 76 | This will be called when a burn_drive gets disposed. 77 | @param d the drive to be finalized 78 | @param flag unused yet, submit 0 79 | @return 1 = success, <=0 = failure 80 | */ 81 | int sg_dispose_drive(struct burn_drive *d, int flag); 82 | 83 | 84 | #endif /* __SG */ 85 | -------------------------------------------------------------------------------- /libburn/source.c: -------------------------------------------------------------------------------- 1 | /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ 2 | 3 | /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens 4 | Copyright (c) 2006 - 2010 Thomas Schmitt 5 | Provided under GPL version 2 or later. 6 | */ 7 | 8 | #ifdef HAVE_CONFIG_H 9 | #include "../config.h" 10 | #endif 11 | 12 | 13 | #include 14 | #include 15 | #include "libburn.h" 16 | #include "source.h" 17 | #include "structure.h" 18 | #include "init.h" 19 | 20 | void burn_source_free(struct burn_source *src) 21 | { 22 | if (--src->refcount < 1) { 23 | if (src->free_data) 24 | src->free_data(src); 25 | free(src); 26 | } 27 | } 28 | 29 | enum burn_source_status burn_track_set_source(struct burn_track *t, 30 | struct burn_source *s) 31 | { 32 | s->refcount++; 33 | t->source = s; 34 | 35 | /* ts A61031 */ 36 | t->open_ended = (s->get_size(s) <= 0); 37 | 38 | return BURN_SOURCE_OK; 39 | } 40 | 41 | struct burn_source *burn_source_new(void) 42 | { 43 | struct burn_source *out; 44 | 45 | /* ts A70825 , B11219 */ 46 | out = burn_alloc_mem(sizeof(struct burn_source), 1, 0); 47 | if (out == NULL) 48 | return NULL; 49 | 50 | out->refcount = 1; 51 | return out; 52 | } 53 | 54 | 55 | /* ts A71223 */ 56 | int burn_source_cancel(struct burn_source *src) 57 | { 58 | if(src->read == NULL) 59 | if(src->version > 0) 60 | if(src->cancel != NULL) 61 | src->cancel(src); 62 | return 1; 63 | } 64 | 65 | 66 | /* ts B00922 */ 67 | int burn_source_read(struct burn_source *src, unsigned char *buffer, int size) 68 | { 69 | int ret; 70 | 71 | if (src->read != NULL) 72 | ret = src->read(src, buffer, size); 73 | else 74 | ret = src->read_xt(src, buffer, size); 75 | return ret; 76 | } 77 | -------------------------------------------------------------------------------- /libburn/source.h: -------------------------------------------------------------------------------- 1 | /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ 2 | 3 | #ifndef __SOURCE 4 | #define __SOURCE 5 | 6 | struct burn_source *burn_source_new(void); 7 | 8 | int burn_source_cancel(struct burn_source *src); 9 | 10 | int burn_source_read(struct burn_source *src, unsigned char *buffer, int size); 11 | 12 | #endif /*__SOURCE*/ 13 | -------------------------------------------------------------------------------- /libburn/toc.c: -------------------------------------------------------------------------------- 1 | /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ 2 | 3 | /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens 4 | Copyright (c) 2011 - 2011 Thomas Schmitt 5 | Provided under GPL version 2 or later. 6 | */ 7 | 8 | 9 | #ifdef HAVE_CONFIG_H 10 | #include "../config.h" 11 | #endif 12 | 13 | /* ts A61008 */ 14 | /* #include */ 15 | 16 | #include 17 | #include 18 | #include 19 | #include "toc.h" 20 | #include "transport.h" 21 | #include "libburn.h" 22 | #include "sector.h" 23 | #include "options.h" 24 | #include "init.h" 25 | 26 | #if 0 27 | static void write_clonecd2(volatile struct toc *toc, int f); 28 | 29 | static void write_clonecd2(volatile struct toc *toc, int f) 30 | { 31 | int i; 32 | 33 | /* header */ 34 | dprintf(f, "[CloneCD]\r\n"); 35 | dprintf(f, "Version=2\r\n"); 36 | dprintf(f, "\r\n"); 37 | 38 | /* disc data */ 39 | dprintf(f, "[Disc]\r\n"); 40 | 41 | dprintf(f, "TocEntries=%d\r\n", toc->toc_entries); 42 | dprintf(f, "Sessions=%d\r\n", toc->sessions); 43 | dprintf(f, "DataTracksScrambled=%d\r\n", toc->datatracksscrambled); 44 | dprintf(f, "CDTextLength=%d\r\n", toc->cdtextlength); 45 | dprintf(f, "\r\n"); 46 | 47 | /* session data */ 48 | for (i = 0; i < toc->sessions; ++i) { 49 | dprintf(f, "[Session %d]\r\n", i + 1); 50 | 51 | { 52 | int m; 53 | 54 | switch (toc->session[i].track[0]->mode) { 55 | case BURN_MODE_RAW_DATA: 56 | case BURN_MODE_AUDIO: 57 | m = 0; 58 | break; 59 | case BURN_MODE0: 60 | m = 1; 61 | break; 62 | case BURN_MODE1: 63 | case BURN_MODE2_FORMLESS: 64 | case BURN_MODE2_FORM1: 65 | case BURN_MODE2_FORM2: 66 | case BURN_MODE_UNINITIALIZED: 67 | 68 | /* ts A61008 : do this softly without Assert */ 69 | 70 | a ssert(0); /* unhandled! find out ccd's 71 | value for these modes! */ 72 | } 73 | dprintf(f, "PreGapMode=%d\r\n", m); 74 | } 75 | dprintf(f, "\r\n"); 76 | } 77 | 78 | for (i = 0; i < toc->toc_entries; ++i) { 79 | dprintf(f, "[Entry %d]\r\n", i); 80 | 81 | dprintf(f, "Session=%d\r\n", toc->toc_entry[i].session); 82 | dprintf(f, "Point=0x%02x\r\n", toc->toc_entry[i].point); 83 | dprintf(f, "ADR=0x%02x\r\n", toc->toc_entry[i].adr); 84 | dprintf(f, "Control=0x%02x\r\n", toc->toc_entry[i].control); 85 | dprintf(f, "TrackNo=%d\r\n", toc->toc_entry[i].tno); 86 | dprintf(f, "AMin=%d\r\n", toc->toc_entry[i].min); 87 | dprintf(f, "ASec=%d\r\n", toc->toc_entry[i].sec); 88 | dprintf(f, "AFrame=%d\r\n", toc->toc_entry[i].frame); 89 | dprintf(f, "ALBA=%d\r\n", 90 | burn_msf_to_lba(toc->toc_entry[i].min, 91 | toc->toc_entry[i].sec, 92 | toc->toc_entry[i].frame)); 93 | dprintf(f, "Zero=%d\r\n", toc->toc_entry[i].zero); 94 | dprintf(f, "PMin=%d\r\n", toc->toc_entry[i].pmin); 95 | dprintf(f, "PSec=%d\r\n", toc->toc_entry[i].psec); 96 | dprintf(f, "PFrame=%d\r\n", toc->toc_entry[i].pframe); 97 | dprintf(f, "PLBA=%d\r\n", 98 | burn_msf_to_lba(toc->toc_entry[i].pmin, 99 | toc->toc_entry[i].psec, 100 | toc->toc_entry[i].pframe)); 101 | dprintf(f, "\r\n"); 102 | } 103 | } 104 | #endif 105 | 106 | void toc_find_modes(struct burn_drive *d) 107 | { 108 | int i, j; 109 | struct buffer *mem = NULL; 110 | struct burn_toc_entry *e; 111 | 112 | /* ts A70519 : the code which needs this does not work with GNU/Linux 2.4 USB 113 | int lba; 114 | struct burn_read_opts o; 115 | 116 | o.raw = 1; 117 | o.c2errors = 0; 118 | o.subcodes_audio = 1; 119 | o.subcodes_data = 1; 120 | o.hardware_error_recovery = 1; 121 | o.report_recovered_errors = 0; 122 | o.transfer_damaged_blocks = 1; 123 | o.hardware_error_retries = 1; 124 | */ 125 | 126 | BURN_ALLOC_MEM_VOID(mem, struct buffer, 1); 127 | 128 | mem->bytes = 0; 129 | mem->sectors = 1; 130 | 131 | for (i = 0; i < d->disc->sessions; i++) 132 | for (j = 0; j < d->disc->session[i]->tracks; j++) { 133 | struct burn_track *t = d->disc->session[i]->track[j]; 134 | 135 | e = t->entry; 136 | /* XXX | in the subcodes if appropriate! */ 137 | if (e && !(e->control & 4)) { 138 | t->mode = BURN_AUDIO; 139 | } else { 140 | 141 | t->mode = BURN_MODE1; 142 | /* ts A70519 : this does not work with GNU/Linux 2.4 USB because one cannot 143 | predict the exact dxfer_size without knowing the sector type. 144 | if (!e) 145 | lba = 0; 146 | else 147 | lba = burn_msf_to_lba(e->pmin, e->psec, 148 | e->pframe); 149 | mem->sectors = 1; 150 | 151 | ts B21119 : Would now be d->read_cd() with 152 | with sectype = 0 , mainch = 0xf8 153 | d->read_sectors(d, lba, mem.sectors, &o, mem); 154 | 155 | t->mode = sector_identify(mem->data); 156 | */ 157 | } 158 | } 159 | 160 | ex: 161 | BURN_FREE_MEM(mem); 162 | } 163 | -------------------------------------------------------------------------------- /libburn/toc.h: -------------------------------------------------------------------------------- 1 | /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ 2 | 3 | /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens 4 | Provided under GPL version 2 or later. 5 | */ 6 | 7 | 8 | #ifndef __TOC_H 9 | #define __TOC_H 10 | 11 | struct command; 12 | 13 | #include "libburn.h" 14 | #include "structure.h" 15 | 16 | /* return if a given entry refers to a track position */ 17 | #define TOC_ENTRY_IS_TRACK(drive, entrynum) \ 18 | ((drive)->toc_entry[entrynum].point < 100) 19 | 20 | /* return if a given entry is in audio or data format */ 21 | #define TOC_ENTRY_IS_AUDIO(drive, entrynum) \ 22 | (~(drive)->toc_entry[entrynum].control & 4) 23 | 24 | /* return the point value for a given entry number */ 25 | #define TOC_POINT(drive, entrynum) ((drive)->toc_entry[entrynum].point) 26 | 27 | /* return the track struct for a given entry number */ 28 | #define TOC_TRACK(drive, entrynum) \ 29 | ((drive)->track[TOC_POINT(drive, entrynum) - 1]) 30 | 31 | /* return the lba of a toc entry */ 32 | #define TOC_ENTRY_PLBA(drive, entrynum) \ 33 | burn_msf_to_lba((drive)->toc_entry[(entrynum)].pmin, \ 34 | (drive)->toc_entry[(entrynum)].psec, \ 35 | (drive)->toc_entry[(entrynum)].pframe) 36 | 37 | /* flags for the q subchannel control field */ 38 | #define TOC_CONTROL_AUDIO (0) 39 | #define TOC_CONTROL_DATA (1 << 2) 40 | #define TOC_CONTROL_AUDIO_TWO_CHANNELS (0) 41 | #define TOC_CONTROL_AUDIO_FOUR_CHANNELS (1 << 3) 42 | #define TOC_CONTROL_AUDIO_PRE_EMPHASIS (1 << 0) 43 | #define TOC_CONTROL_DATA_RECORDED_UNINTERRUPTED (0) 44 | #define TOC_CONTROL_DATA_RECORDED_INCREMENT (1 << 0) 45 | #define TOC_CONTROL_COPY_PROHIBITED (0) 46 | #define TOC_CONTROL_COPY_PERMITTED (1 << 1) 47 | 48 | /** read a sector from each track on disc to determine modes 49 | @param d The drive. 50 | */ 51 | void toc_find_modes(struct burn_drive *d); 52 | 53 | #endif /*__TOC_H*/ 54 | -------------------------------------------------------------------------------- /libburn/util.h: -------------------------------------------------------------------------------- 1 | #ifndef __UTIL 2 | #define __UTIL 3 | 4 | /* ts A90905 */ 5 | int burn_util_make_printable_word(char **text, int flag); 6 | 7 | /* ts B11216 */ 8 | char *burn_sfile_fgets(char *line, int maxl, FILE *fp); 9 | char *burn_printify(char *msg); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /libburn/write.h: -------------------------------------------------------------------------------- 1 | /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ 2 | 3 | /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens 4 | Copyright (c) 2006 - 2010 Thomas Schmitt 5 | Provided under GPL version 2 or later. 6 | */ 7 | 8 | 9 | #ifndef BURN__WRITE_H 10 | #define BURN__WRITE_H 11 | 12 | struct cue_sheet; 13 | struct burn_session; 14 | struct burn_write_opts; 15 | struct burn_disc; 16 | 17 | struct cue_sheet *burn_create_toc_entries(struct burn_write_opts *o, 18 | struct burn_session *session, 19 | int nwa); 20 | int burn_sector_length(int trackmode); 21 | int burn_subcode_length(int trackmode); 22 | 23 | /* ts A61009 */ 24 | int burn_disc_write_is_ok(struct burn_write_opts *o, struct burn_disc *disc, 25 | int flag); 26 | 27 | void burn_disc_write_sync(struct burn_write_opts *o, struct burn_disc *disc); 28 | int burn_write_leadin(struct burn_write_opts *o, 29 | struct burn_session *s, int first); 30 | int burn_write_leadout(struct burn_write_opts *o, 31 | int first, unsigned char control, int mode); 32 | int burn_write_session(struct burn_write_opts *o, struct burn_session *s); 33 | int burn_write_track(struct burn_write_opts *o, struct burn_session *s, 34 | int tnum); 35 | int burn_write_flush(struct burn_write_opts *o, struct burn_track *track); 36 | 37 | /* ts A61030 : necessary for TAO */ 38 | int burn_write_close_track(struct burn_write_opts *o, struct burn_session *s, 39 | int tnum); 40 | int burn_write_close_session(struct burn_write_opts *o); 41 | 42 | /* @param flag bit0= repair checksum 43 | bit1= repair checksum if all pack CRCs are 0 44 | @return 0= no mismatch , >0 number of unrepaired mismatches 45 | <0 number of repaired mismatches 46 | */ 47 | int burn_cdtext_crc_mismatches(unsigned char *packs, int num_packs, int flag); 48 | 49 | 50 | 51 | /* mmc5r03c.pdf 6.3.3.3.3: DVD-R DL: Close Function 010b: Close Session 52 | "When the recording mode is Incremental Recording, 53 | the disc is single session." 54 | Enable this macro to get away from growisofs which uses Close Session 55 | but also states "// DVD-R DL Seq has no notion of multi-session". 56 | 57 | #define Libburn_dvd_r_dl_multi_no_close_sessioN 1 58 | 59 | */ 60 | 61 | #endif /* BURN__WRITE_H */ 62 | -------------------------------------------------------------------------------- /libisoburn/COPYRIGHT: -------------------------------------------------------------------------------- 1 | Mario Danic , 2 | Vreixo Formoso 3 | Thomas Schmitt 4 | libisoburn is Copyright (C) 2007-2011 Vreixo Formoso, Thomas Schmitt 5 | xorriso is Copyright (C) 2007-2011 Thomas Schmitt 6 | 7 | This program is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License version 2 9 | or later as published by the Free Software Foundation. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | -------------------------------------------------------------------------------- /libisofs/COPYRIGHT: -------------------------------------------------------------------------------- 1 | Vreixo Formoso , 2 | Mario Danic , 3 | Thomas Schmitt 4 | Copyright (C) 2007-2011 Vreixo Formoso, Mario Danic, Thomas Schmitt 5 | 6 | 7 | This program is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License version 2 or later 9 | as published by the Free Software Foundation. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | -------------------------------------------------------------------------------- /libisofs/aaip-os-dummy.c: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | aaip-os-dummy.c 5 | 6 | Idle placeholder for: 7 | Arbitrary Attribute Interchange Protocol , system adapter for getting and 8 | setting of ACLs and xattr. 9 | 10 | See aaip-os-linux.c for a real implementation of this interface. 11 | 12 | To be included by aaip_0_2.c 13 | 14 | Copyright (c) 2009 - 2011 Thomas Schmitt, libburnia project, GPLv2+ 15 | 16 | */ 17 | 18 | #ifdef HAVE_CONFIG_H 19 | #include "../config.h" 20 | #endif 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | /* ------------------------------ Inquiry --------------------------------- */ 32 | 33 | /* See also API iso_local_attr_support(). 34 | @param flag 35 | Bitfield for control purposes 36 | bit0= inquire availability of ACL 37 | bit1= inquire availability of xattr 38 | bit2 - bit7= Reserved for future types. 39 | It is permissibile to set them to 1 already now. 40 | bit8 and higher: reserved, submit 0 41 | @return 42 | Bitfield corresponding to flag. If bits are set, th 43 | bit0= ACL adapter is enabled 44 | bit1= xattr adapter is enabled 45 | bit2 - bit7= Reserved for future types. 46 | bit8 and higher: reserved, do not interpret these 47 | */ 48 | int aaip_local_attr_support(int flag) 49 | { 50 | return(0); 51 | } 52 | 53 | 54 | /* ------------------------------ Getters --------------------------------- */ 55 | 56 | /* Obtain the ACL of the given file in long text form. 57 | @return 0 ACL support not enabled at compile time 58 | */ 59 | int aaip_get_acl_text(char *path, char **text, int flag) 60 | { 61 | return(0); 62 | } 63 | 64 | 65 | /* Obtain the Extended Attributes and/or the ACLs of the given file in a form 66 | that is ready for aaip_encode(). 67 | @return 1 ok 68 | */ 69 | int aaip_get_attr_list(char *path, size_t *num_attrs, char ***names, 70 | size_t **value_lengths, char ***values, int flag) 71 | { 72 | *num_attrs= 0; 73 | *names= NULL; 74 | *value_lengths= NULL; 75 | *values= NULL; 76 | return(1); 77 | } 78 | 79 | 80 | /* ------------------------------ Setters --------------------------------- */ 81 | 82 | 83 | /* Set the ACL of the given file to a given list in long text form. 84 | @return 0 ACL support not enabled at compile time 85 | */ 86 | int aaip_set_acl_text(char *path, char *text, int flag) 87 | { 88 | return(0); 89 | } 90 | 91 | 92 | /* Bring the given attributes and/or ACLs into effect with the given file. 93 | @param flag Bitfield for control purposes 94 | bit0= decode and set ACLs 95 | bit1= first clear all existing attributes of the file 96 | bit2= do not set attributes other than ACLs 97 | @return 1 success (there was nothing to do) 98 | -6 support of xattr not enabled at compile time 99 | -7 support of ACL not enabled at compile time 100 | */ 101 | int aaip_set_attr_list(char *path, size_t num_attrs, char **names, 102 | size_t *value_lengths, char **values, int flag) 103 | { 104 | size_t i; 105 | 106 | for(i= 0; i < num_attrs; i++) { 107 | if(names[i] == NULL || values[i] == NULL) 108 | continue; 109 | if(names[i][0] == 0) { /* ACLs */ 110 | if(flag & 1) 111 | return(-7); 112 | continue; 113 | } 114 | /* Extended Attribute */ 115 | if(flag & 4) 116 | continue; 117 | if(!(flag & 8)) 118 | if(strncmp(names[i], "user.", 5)) 119 | continue; 120 | return(-6); 121 | } 122 | if(flag & 2) 123 | return(-6); 124 | return(1); 125 | } 126 | 127 | 128 | -------------------------------------------------------------------------------- /libisofs/buffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007 Vreixo Formoso 3 | * 4 | * This file is part of the libisofs project; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License version 2 6 | * or later as published by the Free Software Foundation. 7 | * See COPYING file for details. 8 | */ 9 | 10 | #ifndef LIBISO_BUFFER_H_ 11 | #define LIBISO_BUFFER_H_ 12 | 13 | #include 14 | 15 | #ifdef HAVE_STDINT_H 16 | #include 17 | #else 18 | #ifdef HAVE_INTTYPES_H 19 | #include 20 | #endif 21 | #endif 22 | 23 | #define BLOCK_SIZE 2048 24 | 25 | typedef struct iso_ring_buffer IsoRingBuffer; 26 | 27 | /** 28 | * Create a new buffer. 29 | * 30 | * The created buffer should be freed with iso_ring_buffer_free() 31 | * 32 | * @param size 33 | * Number of blocks in buffer. You should supply a number >= 32, otherwise 34 | * size will be ignored and 32 will be used by default, which leads to a 35 | * 64 KiB buffer. 36 | * @return 37 | * 1 success, < 0 error 38 | */ 39 | int iso_ring_buffer_new(size_t size, IsoRingBuffer **rbuf); 40 | 41 | /** 42 | * Free a given buffer 43 | */ 44 | void iso_ring_buffer_free(IsoRingBuffer *buf); 45 | 46 | /** 47 | * Write count bytes into buffer. It blocks until all bytes where written or 48 | * reader close the buffer. 49 | * 50 | * @param buf 51 | * the buffer 52 | * @param data 53 | * pointer to a memory region of at least coun bytes, from which data 54 | * will be read. 55 | * @param 56 | * Number of bytes to write 57 | * @return 58 | * 1 succes, 0 read finished, < 0 error 59 | */ 60 | int iso_ring_buffer_write(IsoRingBuffer *buf, uint8_t *data, size_t count); 61 | 62 | /** 63 | * Read count bytes from the buffer into dest. It blocks until the desired 64 | * bytes has been read. If the writer finishes before outputting enought 65 | * bytes, 0 (EOF) is returned, the number of bytes already read remains 66 | * unknown. 67 | * 68 | * @return 69 | * 1 success, 0 EOF, < 0 error 70 | */ 71 | int iso_ring_buffer_read(IsoRingBuffer *buf, uint8_t *dest, size_t count); 72 | 73 | /** Backend of API call iso_ring_buffer_get_status() 74 | * 75 | * Get the status of a ring buffer. 76 | * 77 | * @param buf 78 | * The ring buffer object to inquire 79 | * @param size 80 | * Will be filled with the total size of the buffer, in bytes 81 | * @param free_bytes 82 | * Will be filled with the bytes currently available in buffer 83 | * @return 84 | * < 0 error, > 0 state: 85 | * 1="active" : input and consumption are active 86 | * 2="ending" : input has ended without error 87 | * 3="failing" : input had error and ended, 88 | * 5="abandoned" : consumption has ended prematurely 89 | * 6="ended" : consumption has ended without input error 90 | * 7="aborted" : consumption has ended after input error 91 | */ 92 | int iso_ring_buffer_get_buf_status(IsoRingBuffer *buf, size_t *size, 93 | size_t *free_bytes); 94 | 95 | /** 96 | * Close the buffer (to be called by the writer). 97 | * You have to explicity close the buffer when you don't have more data to 98 | * write, otherwise reader will be waiting forever. 99 | * 100 | * @param error 101 | * Writer has finished prematurely due to an error 102 | */ 103 | void iso_ring_buffer_writer_close(IsoRingBuffer *buf, int error); 104 | 105 | /** 106 | * Close the buffer (to be called by the reader). 107 | * If for any reason you don't want to read more data, you need to call this 108 | * to let the writer thread finish. 109 | * 110 | * @param error 111 | * Reader has finished prematurely due to an error 112 | */ 113 | void iso_ring_buffer_reader_close(IsoRingBuffer *buf, int error); 114 | 115 | /** 116 | * Get the times the buffer was full. 117 | */ 118 | unsigned int iso_ring_buffer_get_times_full(IsoRingBuffer *buf); 119 | 120 | /** 121 | * Get the times the buffer was empty. 122 | */ 123 | unsigned int iso_ring_buffer_get_times_empty(IsoRingBuffer *buf); 124 | 125 | #endif /*LIBISO_BUFFER_H_*/ 126 | -------------------------------------------------------------------------------- /libisofs/builder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007 Vreixo Formoso 3 | * 4 | * This file is part of the libisofs project; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License version 2 6 | * or later as published by the Free Software Foundation. 7 | * See COPYING file for details. 8 | */ 9 | 10 | #ifndef LIBISO_BUILDER_H_ 11 | #define LIBISO_BUILDER_H_ 12 | 13 | /* 14 | * Definitions for IsoNode builders. 15 | */ 16 | 17 | /* 18 | * Some functions here will be moved to libisofs.h when we expose 19 | * Builder. 20 | */ 21 | 22 | #include "libisofs.h" 23 | #include "fsource.h" 24 | 25 | typedef struct Iso_Node_Builder IsoNodeBuilder; 26 | 27 | struct Iso_Node_Builder 28 | { 29 | 30 | /** 31 | * Create a new IsoFile from an IsoFileSource. Name, permissions 32 | * and other attributes are taken from src, but a regular file will 33 | * always be created, even if src is another kind of file. 34 | * 35 | * In that case, if the implementation can't do the conversion, it 36 | * should fail propertly. 37 | * 38 | * Note that the src is never unref, so you need to free it. 39 | * 40 | * @return 41 | * 1 on success, < 0 on error 42 | */ 43 | int (*create_file)(IsoNodeBuilder *builder, IsoImage *image, 44 | IsoFileSource *src, IsoFile **file); 45 | 46 | /** 47 | * Create a new IsoNode from a IsoFileSource. The type of the node to be 48 | * created is determined from the type of the file source. Name, 49 | * permissions and other attributes are taken from source file. 50 | * 51 | * Note that the src is never unref, so you need to free it. 52 | * 53 | * @return 54 | * 1 on success, < 0 on error 55 | */ 56 | int (*create_node)(IsoNodeBuilder *builder, IsoImage *image, 57 | IsoFileSource *src, IsoNode **node); 58 | 59 | /** 60 | * Free implementation specific data. Should never be called by user. 61 | * Use iso_node_builder_unref() instead. 62 | */ 63 | void (*free)(IsoNodeBuilder *builder); 64 | 65 | int refcount; 66 | void *create_file_data; 67 | void *create_node_data; 68 | }; 69 | 70 | void iso_node_builder_ref(IsoNodeBuilder *builder); 71 | void iso_node_builder_unref(IsoNodeBuilder *builder); 72 | 73 | /** 74 | * Create a new basic builder ... 75 | * 76 | * @return 77 | * 1 success, < 0 error 78 | */ 79 | int iso_node_basic_builder_new(IsoNodeBuilder **builder); 80 | 81 | #endif /*LIBISO_BUILDER_H_*/ 82 | -------------------------------------------------------------------------------- /libisofs/ecma119_tree.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007 Vreixo Formoso 3 | * 2012 Thomas Schmitt 4 | * 5 | * This file is part of the libisofs project; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License version 2 7 | * or later as published by the Free Software Foundation. 8 | * See COPYING file for details. 9 | */ 10 | 11 | #ifndef LIBISO_ECMA119_TREE_H_ 12 | #define LIBISO_ECMA119_TREE_H_ 13 | 14 | #include "libisofs.h" 15 | #include "ecma119.h" 16 | 17 | enum ecma119_node_type { 18 | ECMA119_FILE, 19 | ECMA119_DIR, 20 | ECMA119_SYMLINK, 21 | ECMA119_SPECIAL, 22 | ECMA119_PLACEHOLDER 23 | }; 24 | 25 | /** 26 | * Struct with info about a node representing a directory 27 | */ 28 | struct ecma119_dir_info 29 | { 30 | /* Block where the directory entries will be written on image */ 31 | size_t block; 32 | 33 | size_t nchildren; 34 | Ecma119Node **children; 35 | 36 | /* 37 | * Size of the dir, i.e., sum of the lengths of all directory records. 38 | * It is computed by calc_dir_size() [ecma119.c]. 39 | * Note that this don't include the length of any SUSP Continuation 40 | * Area needed by the dir, but it includes the size of the SUSP entries 41 | * than fit in the directory records System Use Field. 42 | */ 43 | size_t len; 44 | 45 | /** 46 | * Real parent if the dir has been reallocated. NULL otherwise. 47 | */ 48 | Ecma119Node *real_parent; 49 | }; 50 | 51 | /** 52 | * A node for a tree containing all the information necessary for writing 53 | * an ISO9660 volume. 54 | */ 55 | struct ecma119_node 56 | { 57 | /** 58 | * Name in ASCII, conforming to selected ISO level. 59 | * Version number is not include, it is added on the fly 60 | */ 61 | char *iso_name; 62 | 63 | Ecma119Node *parent; 64 | 65 | IsoNode *node; /*< reference to the iso node */ 66 | 67 | /* >>> ts A90501 : Shouldn't this be uint32_t 68 | as this is what PX will take ? */ 69 | ino_t ino; 70 | 71 | nlink_t nlink; 72 | 73 | /**< file, symlink, special, directory or placeholder */ 74 | enum ecma119_node_type type; 75 | union 76 | { 77 | IsoFileSrc *file; 78 | struct ecma119_dir_info *dir; 79 | /** this field points to the relocated directory. */ 80 | Ecma119Node *real_me; 81 | } info; 82 | }; 83 | 84 | /** 85 | * 86 | */ 87 | int ecma119_tree_create(Ecma119Image *img); 88 | 89 | /** 90 | * Free an Ecma119Node, and its children if node is a dir 91 | */ 92 | void ecma119_node_free(Ecma119Node *node); 93 | 94 | /** 95 | * Search the tree for a certain IsoNode and return its owning Ecma119Node 96 | * or NULL. 97 | */ 98 | Ecma119Node *ecma119_search_iso_node(Ecma119Image *img, IsoNode *node); 99 | 100 | /** 101 | * Tell whether node is a dedicated relocation directory which only contains 102 | * relocated directories. 103 | */ 104 | int ecma119_is_dedicated_reloc_dir(Ecma119Image *img, Ecma119Node *node); 105 | 106 | 107 | #endif /*LIBISO_ECMA119_TREE_H_*/ 108 | -------------------------------------------------------------------------------- /libisofs/filesrc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007 Vreixo Formoso 3 | * 2012 Thomas Schmitt 4 | * 5 | * This file is part of the libisofs project; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License version 2 7 | * or later as published by the Free Software Foundation. 8 | * See COPYING file for details. 9 | */ 10 | #ifndef LIBISO_FILESRC_H_ 11 | #define LIBISO_FILESRC_H_ 12 | 13 | #include "libisofs.h" 14 | #include "stream.h" 15 | #include "ecma119.h" 16 | 17 | #ifdef HAVE_STDINT_H 18 | #include 19 | #else 20 | #ifdef HAVE_INTTYPES_H 21 | #include 22 | #endif 23 | #endif 24 | 25 | 26 | /* Abstraction of data file content in the emerging image. 27 | */ 28 | struct Iso_File_Src 29 | { 30 | /* This marks an IsoFileSrc which shall only expose its extent addresses 31 | and sizes but shall not be counted or written by filesrc_writer. 32 | */ 33 | unsigned int no_write :1; 34 | 35 | unsigned int checksum_index :31; 36 | 37 | /** File Sections of the file in the image */ 38 | /* Special sections[0].block values while they are relative 39 | before filesrc_writer_compute_data_blocks(). 40 | Valid only with .no_write == 0: 41 | 0xfffffffe This Iso_File_Src is claimed as external partition. 42 | Others will take care of the content data. 43 | filesrc_writer shall neither count nor write it. 44 | At write_data time it is already converted to 45 | a fileadress between Ecma119Image.ms_block and 46 | Ecma119Image.filesrc_start - 1. 47 | 0xffffffff This is the block to which empty files shall point. 48 | Normal data files have relative addresses from 0 to 0xffffffdf. 49 | They cannot be higher, because mspad_writer forces the absolute 50 | filesrc addresses to start at least at 0x20. 51 | */ 52 | struct iso_file_section *sections; 53 | int nsections; 54 | 55 | int sort_weight; 56 | IsoStream *stream; 57 | }; 58 | 59 | int iso_file_src_cmp(const void *n1, const void *n2); 60 | 61 | /** 62 | * Create a new IsoFileSrc to get data from a specific IsoFile. 63 | * 64 | * The IsoFileSrc will be cached in a tree to prevent the same file for 65 | * being written several times to image. If you call again this function 66 | * with a node that refers to the same source file, the previously 67 | * created one will be returned. No new IsoFileSrc is created in that case. 68 | * 69 | * @param img 70 | * The image where this file is to be written 71 | * @param file 72 | * The IsoNode we want to write 73 | * @param src 74 | * Will be filled with a pointer to the IsoFileSrc 75 | * @return 76 | * 1 if new object was created, 0 if object existed, < 0 on error 77 | */ 78 | int iso_file_src_create(Ecma119Image *img, IsoFile *file, IsoFileSrc **src); 79 | 80 | /** 81 | * Add a given IsoFileSrc to the given image target. 82 | * 83 | * The IsoFileSrc will be cached in a tree to prevent the same file for 84 | * being written several times to image. If you call again this function 85 | * with a node that refers to the same source file, the previously 86 | * created one will be returned. 87 | * 88 | * @param img 89 | * The image where this file is to be written 90 | * @param new 91 | * The IsoFileSrc to add 92 | * @param src 93 | * Will be filled with a pointer to the IsoFileSrc really present in 94 | * the tree. It could be different than new if the same file already 95 | * exists in the tree. 96 | * @return 97 | * 1 on success, 0 if file already exists on tree, < 0 error 98 | */ 99 | int iso_file_src_add(Ecma119Image *img, IsoFileSrc *new, IsoFileSrc **src); 100 | 101 | /** 102 | * Free the IsoFileSrc especific data 103 | */ 104 | void iso_file_src_free(void *node); 105 | 106 | /** 107 | * Get the size of the file this IsoFileSrc represents 108 | */ 109 | off_t iso_file_src_get_size(IsoFileSrc *file); 110 | 111 | /** 112 | * Create a Writer for file contents. 113 | * 114 | * It takes care of written the files in the correct order. 115 | */ 116 | int iso_file_src_writer_create(Ecma119Image *target); 117 | 118 | /** 119 | * Determine number of filesrc blocks in the image and compute extent addresses 120 | * relative to start of the file source writer area. 121 | * filesrc_writer_compute_data_blocks() later makes them absolute. 122 | */ 123 | int filesrc_writer_pre_compute(IsoImageWriter *writer); 124 | 125 | /** 126 | * Write the content of file into the output stream of t. 127 | * name must be NULL or offer at least PATH_MAX characters of storage. 128 | * buffer must be NULL or offer at least BLOCK_SIZE characters of storage. 129 | * flag is not used yet, submit 0. 130 | */ 131 | int iso_filesrc_write_data(Ecma119Image *t, IsoFileSrc *file, 132 | char *name, char *buffer, int flag); 133 | 134 | 135 | #endif /*LIBISO_FILESRC_H_*/ 136 | -------------------------------------------------------------------------------- /libisofs/filter.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008 Vreixo Formoso 3 | * Copyright (c) 2009 Thomas Schmitt 4 | * 5 | * This file is part of the libisofs project; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License version 2 7 | * or later as published by the Free Software Foundation. 8 | * See COPYING file for details. 9 | */ 10 | 11 | #ifdef HAVE_CONFIG_H 12 | #include "../config.h" 13 | #endif 14 | 15 | #include "libisofs.h" 16 | #include "filter.h" 17 | #include "node.h" 18 | 19 | 20 | void iso_filter_ref(FilterContext *filter) 21 | { 22 | ++filter->refcount; 23 | } 24 | 25 | void iso_filter_unref(FilterContext *filter) 26 | { 27 | if (--filter->refcount == 0) { 28 | filter->free(filter); 29 | free(filter); 30 | } 31 | } 32 | 33 | int iso_file_add_filter(IsoFile *file, FilterContext *filter, int flag) 34 | { 35 | int ret; 36 | IsoStream *original, *filtered; 37 | if (file == NULL || filter == NULL) { 38 | return ISO_NULL_POINTER; 39 | } 40 | 41 | original = file->stream; 42 | 43 | if (!iso_stream_is_repeatable(original)) { 44 | /* TODO use custom error */ 45 | return ISO_WRONG_ARG_VALUE; 46 | } 47 | 48 | ret = filter->get_filter(filter, original, &filtered); 49 | if (ret < 0) { 50 | return ret; 51 | } 52 | iso_stream_unref(original); 53 | file->stream = filtered; 54 | return ISO_SUCCESS; 55 | } 56 | 57 | 58 | int iso_file_remove_filter(IsoFile *file, int flag) 59 | { 60 | IsoStream *file_stream, *input_stream; 61 | 62 | file_stream = file->stream; 63 | input_stream = iso_stream_get_input_stream(file_stream, 0); 64 | if (input_stream == NULL) 65 | return 0; 66 | file->stream = input_stream; 67 | iso_stream_ref(input_stream); /* Protect against _unref(file_stream) */ 68 | iso_stream_unref(file_stream); 69 | return 1; 70 | } 71 | 72 | -------------------------------------------------------------------------------- /libisofs/filter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008 Vreixo Formoso 3 | * 4 | * This file is part of the libisofs project; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License version 2 6 | * or later as published by the Free Software Foundation. 7 | * See COPYING file for details. 8 | */ 9 | #ifndef LIBISO_FILTER_H_ 10 | #define LIBISO_FILTER_H_ 11 | 12 | /* 13 | * Definitions of filters. 14 | */ 15 | 16 | 17 | /* dev_id for stream identification */ 18 | 19 | /* libisofs/filters/xor_encrypt.c */ 20 | #define XOR_ENCRYPT_DEV_ID 1 21 | 22 | /* libisofs/filters/external.c */ 23 | #define ISO_FILTER_EXTERNAL_DEV_ID 2 24 | 25 | /* libisofs/filters/zisofs.c */ 26 | #define ISO_FILTER_ZISOFS_DEV_ID 3 27 | 28 | /* libisofs/filters/gzip.c */ 29 | #define ISO_FILTER_GZIP_DEV_ID 4 30 | 31 | 32 | typedef struct filter_context FilterContext; 33 | 34 | struct filter_context { 35 | int version; /* reserved for future usage, set to 0 */ 36 | int refcount; 37 | 38 | /** filter specific shared data */ 39 | void *data; 40 | 41 | /** 42 | * Factory method to create a filtered stream from another stream. 43 | * 44 | * @param original 45 | * The original stream to be filtered. If the filter needs a ref to 46 | * it (most cases), it should take a ref to it with iso_stream_ref(). 47 | * @param filtered 48 | * Will be filled with the filtered IsoStream (reference belongs to 49 | * caller). 50 | * @return 51 | * 1 on success, < 0 on error 52 | */ 53 | int (*get_filter)(FilterContext *filter, IsoStream *original, 54 | IsoStream **filtered); 55 | 56 | /** 57 | * Free implementation specific data. Should never be called by user. 58 | * Use iso_filter_unref() instead. 59 | */ 60 | void (*free)(FilterContext *filter); 61 | }; 62 | 63 | /** 64 | * 65 | * @param flag 66 | * Reserved for future usage, pass always 0 for now. 67 | * TODO in a future a different value can mean filter caching, where 68 | * the filter is applied once and the filtered file is stored in a temp 69 | * dir. This prevent filter to be applied several times. 70 | */ 71 | int iso_file_add_filter(IsoFile *file, FilterContext *filter, int flag); 72 | 73 | void iso_filter_ref(FilterContext *filter); 74 | void iso_filter_unref(FilterContext *filter); 75 | 76 | #endif /*LIBISO_FILTER_H_*/ 77 | -------------------------------------------------------------------------------- /libisofs/fsource.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007 Vreixo Formoso 3 | * 4 | * This file is part of the libisofs project; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License version 2 6 | * or later as published by the Free Software Foundation. 7 | * See COPYING file for details. 8 | */ 9 | 10 | #ifdef HAVE_CONFIG_H 11 | #include "../config.h" 12 | #endif 13 | 14 | #include "fsource.h" 15 | #include 16 | 17 | /** 18 | * Values belong 1000 are reserved for libisofs usage 19 | */ 20 | unsigned int iso_fs_global_id = 1000; 21 | 22 | void iso_file_source_ref(IsoFileSource *src) 23 | { 24 | ++src->refcount; 25 | } 26 | 27 | void iso_file_source_unref(IsoFileSource *src) 28 | { 29 | if (--src->refcount == 0) { 30 | src->class->free(src); 31 | free(src); 32 | } 33 | } 34 | 35 | void iso_filesystem_ref(IsoFilesystem *fs) 36 | { 37 | ++fs->refcount; 38 | } 39 | 40 | void iso_filesystem_unref(IsoFilesystem *fs) 41 | { 42 | if (--fs->refcount == 0) { 43 | fs->free(fs); 44 | free(fs); 45 | } 46 | } 47 | 48 | /* 49 | * this are just helpers to invoque methods in class 50 | */ 51 | 52 | inline 53 | char* iso_file_source_get_path(IsoFileSource *src) 54 | { 55 | return src->class->get_path(src); 56 | } 57 | 58 | inline 59 | char* iso_file_source_get_name(IsoFileSource *src) 60 | { 61 | return src->class->get_name(src); 62 | } 63 | 64 | inline 65 | int iso_file_source_lstat(IsoFileSource *src, struct stat *info) 66 | { 67 | return src->class->lstat(src, info); 68 | } 69 | 70 | inline 71 | int iso_file_source_access(IsoFileSource *src) 72 | { 73 | return src->class->access(src); 74 | } 75 | 76 | inline 77 | int iso_file_source_stat(IsoFileSource *src, struct stat *info) 78 | { 79 | return src->class->stat(src, info); 80 | } 81 | 82 | inline 83 | int iso_file_source_open(IsoFileSource *src) 84 | { 85 | return src->class->open(src); 86 | } 87 | 88 | inline 89 | int iso_file_source_close(IsoFileSource *src) 90 | { 91 | return src->class->close(src); 92 | } 93 | 94 | inline 95 | int iso_file_source_read(IsoFileSource *src, void *buf, size_t count) 96 | { 97 | return src->class->read(src, buf, count); 98 | } 99 | 100 | inline 101 | off_t iso_file_source_lseek(IsoFileSource *src, off_t offset, int flag) 102 | { 103 | return src->class->lseek(src, offset, flag); 104 | } 105 | 106 | inline 107 | int iso_file_source_readdir(IsoFileSource *src, IsoFileSource **child) 108 | { 109 | return src->class->readdir(src, child); 110 | } 111 | 112 | inline 113 | int iso_file_source_readlink(IsoFileSource *src, char *buf, size_t bufsiz) 114 | { 115 | return src->class->readlink(src, buf, bufsiz); 116 | } 117 | 118 | inline 119 | IsoFilesystem* iso_file_source_get_filesystem(IsoFileSource *src) 120 | { 121 | return src->class->get_filesystem(src); 122 | } 123 | 124 | 125 | inline 126 | int iso_file_source_get_aa_string(IsoFileSource *src, 127 | unsigned char **aa_string, int flag) 128 | { 129 | if (src->class->version < 1) { 130 | *aa_string = NULL; 131 | return 1; 132 | } 133 | return src->class->get_aa_string(src, aa_string, flag); 134 | } 135 | 136 | -------------------------------------------------------------------------------- /libisofs/fsource.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007 Vreixo Formoso 3 | * Copyright (c) 2009 - 2011 Thomas Schmitt 4 | * 5 | * This file is part of the libisofs project; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License version 2 7 | * or later as published by the Free Software Foundation. 8 | * See COPYING file for details. 9 | */ 10 | 11 | #ifndef LIBISO_FSOURCE_H_ 12 | #define LIBISO_FSOURCE_H_ 13 | 14 | /* 15 | * Definitions for the file sources. Most functions/structures related with 16 | * this were moved to libisofs.h. 17 | */ 18 | 19 | #include "libisofs.h" 20 | 21 | #define ISO_LOCAL_FS_ID 1 22 | #define ISO_IMAGE_FS_ID 2 23 | #define ISO_ELTORITO_FS_ID 3 24 | #define ISO_MEM_FS_ID 4 25 | #define ISO_FILTER_FS_ID 5 26 | 27 | /** 28 | * Create a new IsoFilesystem to deal with local filesystem. 29 | * 30 | * @return 31 | * 1 sucess, < 0 error 32 | */ 33 | int iso_local_filesystem_new(IsoFilesystem **fs); 34 | 35 | 36 | /* Rank two IsoFileSource of ifs_class by their eventual old image LBAs. 37 | Other IsoFileSource classes will be ranked only roughly. 38 | */ 39 | int iso_ifs_sections_cmp(IsoFileSource *s1, IsoFileSource *s2, int flag); 40 | 41 | 42 | /* Create an independent copy of an ifs_class IsoFileSource. 43 | */ 44 | int iso_ifs_source_clone(IsoFileSource *old_source, IsoFileSource **new_source, 45 | int flag); 46 | 47 | 48 | #endif /*LIBISO_FSOURCE_H_*/ 49 | -------------------------------------------------------------------------------- /libisofs/iso1999.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007 Vreixo Formoso 3 | * 4 | * This file is part of the libisofs project; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License version 2 6 | * or later as published by the Free Software Foundation. 7 | * See COPYING file for details. 8 | */ 9 | 10 | /** 11 | * Structures related to ISO/IEC 9660:1999, that is version 2 of ISO-9660 12 | * "See doc/devel/cookbook/ISO 9660-1999" and 13 | * ISO/IEC DIS 9660:1999(E) "Information processing. Volume and file structure 14 | * of CD­-ROM for Information Interchange" 15 | * for further details. 16 | */ 17 | 18 | #ifndef LIBISO_ISO1999_H 19 | #define LIBISO_ISO1999_H 20 | 21 | #include "libisofs.h" 22 | #include "ecma119.h" 23 | 24 | enum iso1999_node_type { 25 | ISO1999_FILE, 26 | ISO1999_DIR 27 | }; 28 | 29 | struct iso1999_dir_info { 30 | Iso1999Node **children; 31 | size_t nchildren; 32 | size_t len; 33 | size_t block; 34 | }; 35 | 36 | struct iso1999_node 37 | { 38 | char *name; /**< Name chosen output charset. */ 39 | 40 | Iso1999Node *parent; 41 | 42 | IsoNode *node; /*< reference to the iso node */ 43 | 44 | enum iso1999_node_type type; 45 | union { 46 | IsoFileSrc *file; 47 | struct iso1999_dir_info *dir; 48 | } info; 49 | }; 50 | 51 | /** 52 | * Create a IsoWriter to deal with ISO 9660:1999 estructures, and add it to 53 | * the given target. 54 | * 55 | * @return 56 | * 1 on success, < 0 on error 57 | */ 58 | int iso1999_writer_create(Ecma119Image *target); 59 | 60 | #endif /* LIBISO_ISO1999_H */ 61 | -------------------------------------------------------------------------------- /libisofs/joliet.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007 Vreixo Formoso 3 | * Copyright (c) 2007 Mario Danic 4 | * 5 | * This file is part of the libisofs project; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License version 2 7 | * or later as published by the Free Software Foundation. 8 | * See COPYING file for details. 9 | */ 10 | 11 | /** 12 | * Declare Joliet related structures. 13 | */ 14 | 15 | #ifndef LIBISO_JOLIET_H 16 | #define LIBISO_JOLIET_H 17 | 18 | #include "libisofs.h" 19 | #include "ecma119.h" 20 | 21 | /* was formerly 66 = 64 + 2. Now 105 = 103 + 2. 22 | */ 23 | #define LIBISO_JOLIET_NAME_MAX 105 24 | 25 | enum joliet_node_type { 26 | JOLIET_FILE, 27 | JOLIET_DIR 28 | }; 29 | 30 | struct joliet_dir_info { 31 | JolietNode **children; 32 | size_t nchildren; 33 | size_t len; 34 | size_t block; 35 | }; 36 | 37 | struct joliet_node 38 | { 39 | uint16_t *name; /**< Name in UCS-2BE. */ 40 | 41 | JolietNode *parent; 42 | 43 | IsoNode *node; /*< reference to the iso node */ 44 | 45 | enum joliet_node_type type; 46 | union { 47 | IsoFileSrc *file; 48 | struct joliet_dir_info *dir; 49 | } info; 50 | }; 51 | 52 | /** 53 | * Create a IsoWriter to deal with Joliet estructures, and add it to the given 54 | * target. 55 | * 56 | * @return 57 | * 1 on success, < 0 on error 58 | */ 59 | int joliet_writer_create(Ecma119Image *target); 60 | 61 | 62 | /* Not to be called but only for comparison with target->writers[i] 63 | */ 64 | int joliet_writer_write_vol_desc(IsoImageWriter *writer); 65 | 66 | 67 | #endif /* LIBISO_JOLIET_H */ 68 | -------------------------------------------------------------------------------- /libisofs/md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Thomas Schmitt 3 | * 4 | * This file is part of the libisofs project; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License version 2 6 | * or later as published by the Free Software Foundation. 7 | * See COPYING file for details. 8 | */ 9 | 10 | #ifndef LIBISO_MD5_H_ 11 | #define LIBISO_MD5_H_ 12 | 13 | 14 | /* The MD5 computation API is in libisofs.h : iso_md5_start() et.al. */ 15 | 16 | 17 | /** Create a writer object for checksums and add it to the writer list of 18 | the given Ecma119Image. 19 | */ 20 | int checksum_writer_create(Ecma119Image *target); 21 | 22 | 23 | /* Write stream detectable checksum tag to extra block. 24 | * All tag ranges start at the beginning of the System Area (i.e. t->ms_block) 25 | * and stem from the same MD5 computation context. Tag types 2 and 3 are 26 | * intermediate checksums. Type 2 announces the existence of type 3. 27 | * If both match, then at least the directory tree is trustworthy. 28 | * Type 1 is written at the very end of the session. If it matches, then 29 | * the whole image is trustworthy. 30 | * @param t The image being written 31 | * @flag bit0-7= tag type 32 | * 1= session tag (End checksumming.) 33 | * 2= superblock tag (System Area and Volume Descriptors) 34 | * 3= tree tag (ECMA-119 and Rock Ridge tree) 35 | */ 36 | int iso_md5_write_tag(Ecma119Image *t, int flag); 37 | 38 | 39 | #endif /* ! LIBISO_MD5_H_ */ 40 | 41 | 42 | -------------------------------------------------------------------------------- /libisofs/messages.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007 Vreixo Formoso 3 | * 4 | * This file is part of the libisofs project; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License version 2 6 | * or later as published by the Free Software Foundation. 7 | * See COPYING file for details. 8 | */ 9 | 10 | /* 11 | * Message handling for libisofs 12 | */ 13 | 14 | #ifndef MESSAGES_H_ 15 | #define MESSAGES_H_ 16 | 17 | /** 18 | * Take and increment this variable to get a valid identifier for message 19 | * origin. 20 | */ 21 | extern int iso_message_id; 22 | 23 | /** 24 | * Submit a debug message. 25 | */ 26 | void iso_msg_debug(int imgid, const char *fmt, ...); 27 | 28 | 29 | /** 30 | * Inquire whether the given error code triggers the abort threshold 31 | */ 32 | int iso_msg_is_abort(int errcode); 33 | 34 | 35 | /** 36 | * 37 | * @param errcode 38 | * The error code. 39 | * @param causedby 40 | * Error that was caused the errcode. If this error is a FATAL error, 41 | * < 0 will be returned in any case. Use 0 if there is no previous 42 | * cause for the error. 43 | * @return 44 | * 0 on success, < 0 if function must abort asap. 45 | */ 46 | int iso_msg_submit(int imgid, int errcode, int causedby, const char *fmt, ...); 47 | 48 | 49 | /* To be called with events which report incidents with individual input 50 | files from the local filesystem. Not with image nodes, files containing an 51 | image or similar file-like objects. 52 | */ 53 | int iso_report_errfile(char *path, int error_code, int os_errno, int flag); 54 | 55 | 56 | /* Drains the libjte message list and puts out the messages via 57 | iso_msg_submit() 58 | */ 59 | int iso_libjte_forward_msgs(void *libjte_handle, 60 | int imgid, int errcode, int flag); 61 | 62 | #endif /*MESSAGES_H_*/ 63 | -------------------------------------------------------------------------------- /libisofs/stream.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007 Vreixo Formoso 3 | * Copyright (c) 2009 - 2011 Thomas Schmitt 4 | * 5 | * This file is part of the libisofs project; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License version 2 7 | * or later as published by the Free Software Foundation. 8 | * See COPYING file for details. 9 | */ 10 | #ifndef LIBISO_STREAM_H_ 11 | #define LIBISO_STREAM_H_ 12 | 13 | /* 14 | * Definitions of streams. 15 | */ 16 | #include "fsource.h" 17 | 18 | /* IMPORTANT: Any change must be reflected by fsrc_clone_stream */ 19 | typedef struct 20 | { 21 | IsoFileSource *src; 22 | 23 | /* key for file identification inside filesystem */ 24 | dev_t dev_id; 25 | ino_t ino_id; 26 | off_t size; /**< size of this file */ 27 | } FSrcStreamData; 28 | 29 | /** 30 | * Get an identifier for the file of the source, for debug purposes 31 | * @param name 32 | * Must provide at least PATH_MAX bytes. If no PATH_MAX is defined 33 | * then assume PATH_MAX = Libisofs_default_path_maX from libisofs.h 34 | */ 35 | void iso_stream_get_file_name(IsoStream *stream, char *name); 36 | 37 | /** 38 | * Create a stream to read from a IsoFileSource. 39 | * The stream will take the ref. to the IsoFileSource, so after a successfully 40 | * exectution of this function, you musn't unref() the source, unless you 41 | * take an extra ref. 42 | * 43 | * @return 44 | * 1 sucess, < 0 error 45 | * Possible errors: 46 | * 47 | */ 48 | int iso_file_source_stream_new(IsoFileSource *src, IsoStream **stream); 49 | 50 | /** 51 | * Create a new stream to read a chunk of an IsoFileSource.. 52 | * The stream will add a ref. to the IsoFileSource. 53 | * 54 | * @return 55 | * 1 sucess, < 0 error 56 | */ 57 | int iso_cut_out_stream_new(IsoFileSource *src, off_t offset, off_t size, 58 | IsoStream **stream); 59 | 60 | /** 61 | * Obtain eventual zisofs ZF field entry parameters from a file source out 62 | * of a loaded ISO image. 63 | * To make hope for non-zero reply the stream has to be the original stream 64 | * of an IsoFile with .from_old_session==1. The call is safe with any stream 65 | * type, though, unless fsrc_stream_class would be used without FSrcStreamData. 66 | * @return 1= returned parameters are valid, 0=no ZF info found , <0 error 67 | */ 68 | int iso_stream_get_src_zf(IsoStream *stream, int *header_size_div4, 69 | int *block_size_log2, uint32_t *uncompressed_size, 70 | int flag); 71 | 72 | /** 73 | * Set the inode number of a stream that is based on FSrcStreamData, i.e. 74 | * stems from the imported ISO image. 75 | * @return 1 = ok , 0 = not an ISO image stream , <0 = error 76 | */ 77 | int iso_stream_set_image_ino(IsoStream *stream, ino_t ino, int flag); 78 | 79 | 80 | /** 81 | * Read the full required amount of data unless error or EOF occurs. 82 | * Fill missing bytes by 0s. 83 | * @param count Required amount 84 | * @param got Returns number of actually read bytes 85 | * @return 86 | * 1 no problem encountered, 0 EOF encountered, < 0 error 87 | */ 88 | int iso_stream_read_buffer(IsoStream *stream, char *buf, size_t count, 89 | size_t *got); 90 | 91 | /** 92 | * @return 1=ok, md5 is valid, 93 | * 0= not ok 94 | * <0 fatal error, abort 95 | */ 96 | int iso_stream_make_md5(IsoStream *stream, char md5[16], int flag); 97 | 98 | 99 | /** 100 | * Create a clone of the input stream of old_stream and a roughly initialized 101 | * clone of old_stream which has the same class and refcount 1. Its data 102 | * pointer will be NULL and needs to be filled by an expert which knows how 103 | * to clone the data of old_stream. 104 | * @param old_stream The existing stream which is in process of cloning 105 | * @param new_stream Will return the uninitialized memory object which shall 106 | * later become the clone of old_stream. 107 | * @param new_input The clone of the input stream of old stream. 108 | * @param flag Submit 0 for now. 109 | * @return ISO_SUCCESS or an error code <0 110 | */ 111 | int iso_stream_clone_filter_common(IsoStream *old_stream, 112 | IsoStream **new_stream, 113 | IsoStream **new_input, int flag); 114 | 115 | #endif /*STREAM_H_*/ 116 | -------------------------------------------------------------------------------- /libisofs/tree.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007 Vreixo Formoso 3 | * 4 | * This file is part of the libisofs project; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License version 2 6 | * or later as published by the Free Software Foundation. 7 | * See COPYING file for details. 8 | */ 9 | #ifndef LIBISO_IMAGE_TREE_H_ 10 | #define LIBISO_IMAGE_TREE_H_ 11 | 12 | #include "image.h" 13 | 14 | /** 15 | * Recursively add a given directory to the image tree. 16 | * 17 | * @return 18 | * 1 continue, 0 stop, < 0 error 19 | */ 20 | int iso_add_dir_src_rec(IsoImage *image, IsoDir *parent, IsoFileSource *dir); 21 | 22 | #endif /*LIBISO_IMAGE_TREE_H_*/ 23 | -------------------------------------------------------------------------------- /libisofs/writer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007 Vreixo Formoso 3 | * 4 | * This file is part of the libisofs project; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License version 2 6 | * or later as published by the Free Software Foundation. 7 | * See COPYING file for details. 8 | */ 9 | #ifndef LIBISO_IMAGE_WRITER_H_ 10 | #define LIBISO_IMAGE_WRITER_H_ 11 | 12 | #include "ecma119.h" 13 | 14 | struct Iso_Image_Writer 15 | { 16 | /** 17 | * 18 | */ 19 | int (*compute_data_blocks)(IsoImageWriter *writer); 20 | 21 | int (*write_vol_desc)(IsoImageWriter *writer); 22 | 23 | int (*write_data)(IsoImageWriter *writer); 24 | 25 | int (*free_data)(IsoImageWriter *writer); 26 | 27 | void *data; 28 | Ecma119Image *target; 29 | }; 30 | 31 | /** 32 | * This is the function all Writers shoudl call to write data to image. 33 | * Currently, it is just a wrapper for write(2) Unix system call. 34 | * 35 | * It is implemented in ecma119.c 36 | * 37 | * @return 38 | * 1 on sucess, < 0 error 39 | */ 40 | int iso_write(Ecma119Image *target, void *buf, size_t count); 41 | 42 | int ecma119_writer_create(Ecma119Image *target); 43 | 44 | #endif /*LIBISO_IMAGE_WRITER_H_*/ 45 | -------------------------------------------------------------------------------- /libjte/COPYRIGHT: -------------------------------------------------------------------------------- 1 | Steve McIntyre 2 | George Danchev 3 | Thomas Schmitt 4 | Copyright (C) 2000-2010 Free Software Foundation, Inc., Steve McIntyre, George Danchev, Thomas Schmitt. 5 | 6 | This statement overrides for the libjte package as a whole any license 7 | statements by Steve McIntyre, George Danchev, and Thomas Schmitt in the 8 | source code files of the package. Individually they are licensed as stated. 9 | 10 | libjte contains code with explicitely unclaimed copyrights, code from programs 11 | and libraries with copyright of Free Software Foundation under LGPLv2.1, 12 | code with copyright of Steve McIntyre, George Danchev, and Thomas Schmitt 13 | under LGPLv2.1. 14 | 15 | In the sum, libjte is provided under this license: 16 | 17 | This program is free software; you can redistribute it and/or modify 18 | it under the terms of the GNU Lesser General Public License as 19 | published by the Free Software Foundation; either version 2.1 of 20 | the License, or (at your option) any later version. 21 | 22 | This program is distributed in the hope that it will be useful, 23 | but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | GNU General Public License for more details. 26 | 27 | You should have received a copy of the GNU Lesser General Public License 28 | along with this program; if not, write to the Free Software 29 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 30 | 31 | -------------------------------------------------------------------------------- /libjte/checksum.h: -------------------------------------------------------------------------------- 1 | /* 2 | * checksum.h 3 | * 4 | * Copyright (c) 2008- Steve McIntyre 5 | * 6 | * Definitions and prototypes for a generic checksum interface, used 7 | * in JTE. Inspired heavily by the interface to the MD5 code we're 8 | * using already. 9 | * 10 | * GNU GPL v2 11 | */ 12 | 13 | #ifndef _JTE_CHECKSUM_H_ 14 | #define _JTE_CHECKSUM_H_ 15 | 16 | enum checksum_types 17 | { 18 | CHECK_MD5 = 0, 19 | CHECK_SHA1, 20 | CHECK_SHA256, 21 | CHECK_SHA512, 22 | NUM_CHECKSUMS 23 | }; 24 | 25 | #define CHECK_MD5_USED (1 << CHECK_MD5) 26 | #define CHECK_SHA1_USED (1 << CHECK_SHA1) 27 | #define CHECK_SHA256_USED (1 << CHECK_SHA256) 28 | #define CHECK_SHA512_USED (1 << CHECK_SHA512) 29 | #define CHECK_ALL_USED 0xFFFFFFFF 30 | 31 | typedef void checksum_context_t; 32 | 33 | struct checksum_info 34 | { 35 | char *name; 36 | char *prog; 37 | int digest_size; 38 | }; 39 | 40 | /* Ask the library for information about a particular checksum 41 | * algorithm. Returns a pointer to internal memory - DO NOT 42 | * MODIFY/FREE! */ 43 | struct checksum_info *checksum_information(enum checksum_types which); 44 | 45 | /* Allocate / initialise a context for the chosen checksums. OR 46 | * together the desired checksums as the parameter */ 47 | checksum_context_t *checksum_init_context(int checksums, const char *owner); 48 | 49 | /* Cleanup and free a context when it's finished with */ 50 | void checksum_free_context(checksum_context_t *context); 51 | 52 | /* Pass a new buffer full of data through the checksum code */ 53 | void checksum_update(checksum_context_t *context, 54 | unsigned char const *buf, 55 | unsigned int len); 56 | 57 | /* Finish the current set of checksums */ 58 | void checksum_final(checksum_context_t *context); 59 | 60 | /* Extract a particular algorithm's checksum once checksum_final() has 61 | * been called. Use the details in checksum_information() above first 62 | * to see how big the digest will be. Only valid once checksum_final() 63 | * has been called, otherwise the digest returned will be all 64 | * zeroes. */ 65 | void checksum_copy(checksum_context_t *context, 66 | enum checksum_types which, 67 | unsigned char *digest); 68 | 69 | /* Helper function: return a pointer to a string containing the ASCII 70 | * hexadecimal dump of a checksum. Only valid once checksum_final() 71 | * has been called, otherwise will return NULL */ 72 | const char * checksum_hex(checksum_context_t *context, 73 | enum checksum_types which); 74 | 75 | 76 | extern int parse_checksum_algo(char *arg, 77 | int *algo); 78 | 79 | #endif 80 | /* _JTE_CHECKSUM_H_ */ 81 | -------------------------------------------------------------------------------- /libjte/endianconv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * endianconv.h 3 | * 4 | * Copyright (c) 2004-2006 Steve McIntyre 5 | * 6 | * Simple helper routines for marshalling data - prototypes 7 | * 8 | * GNU GPL v2 9 | */ 10 | 11 | #ifndef _JTE_ENDIANCONV_H_ 12 | #define _JTE_ENDIANCONV_H_ 13 | 14 | void write_be64(uint64_t in, unsigned char *out); 15 | uint64_t read_be64(unsigned char *in); 16 | void write_le64(uint64_t in, unsigned char *out); 17 | uint64_t read_le64(unsigned char *in); 18 | 19 | void write_le48(uint64_t in, unsigned char *out); 20 | uint64_t read_le48(unsigned char *in); 21 | 22 | void write_be32(unsigned long in, unsigned char *out); 23 | unsigned long read_be32(unsigned char *in); 24 | void write_le32(unsigned long in, unsigned char *out); 25 | unsigned long read_le32(unsigned char *in); 26 | 27 | void write_be16(unsigned short in, unsigned char *out); 28 | unsigned short read_be16(unsigned char *in); 29 | void write_le16(unsigned short in, unsigned char *out); 30 | unsigned short read_le16(unsigned char *in); 31 | 32 | #endif 33 | /* _JTE_ENDIANCONV_H_ */ 34 | -------------------------------------------------------------------------------- /libjte/jigdo-gen-md5-list: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Copyright (c) 2010, 2011 George Danchev 4 | # Copyright (c) 2010, 2011 Thomas Schmitt 5 | # This script is distributed according to the terms of the GNU GPL v2. 6 | # This should be better rewritten in C at some future point. Ref: pwd code. 7 | 8 | # Create a list of MD5sums encoded in hexidecimal format and print to standard output 9 | 10 | # Format Description 11 | # A line in the emerging file is to be composed as follows: 12 | # 13 | # The MD5 checksum of the file content must be encoded in 32 hex digits 14 | # [0-9afAF] 15 | # 16 | # Next come two blanks. 17 | # 18 | # The byte size of the file content must be encoded in 12 decimal digits 19 | # or blanks. 20 | # 21 | # Next come two blanks. 22 | # 23 | # The rest of the line up to the newline character is a semi-literal file 24 | # address. Its basename has to be the same as the basename of the data file 25 | # when it is used as one of the input files for the jigdo file generator. 26 | 27 | # The semi-literal address and the address mapping define what will be 28 | # listed as file address in the jigdo file. 29 | # The address may bear at its start a literal text that shall be recognized by 30 | # the address mapping (e.g. -jigdo-map) of the jigdo file generator. 31 | # The rest of the address must be usable as file address in both situations: 32 | # When the jigdo file gets generated, and when the jigdo file gets read 33 | # to inflate the template file into the original payload image. 34 | # The address mappings at both occasions can be used to adapt to a change 35 | # of the absolute location of the listed files. 36 | # Between both mappings, the parent directory is represented by a symbolic 37 | # text, like "Debian:". 38 | 39 | # A simple strategy to cope with this is to write absolute paths into the 40 | # .md5 file, and to use matching absolute paths in the -jigdo-map 41 | # directives. Keep in mind that mapping is purely literal. Symbolic links 42 | # are neither resolved nor can they confuse the mapping. 43 | 44 | set -e 45 | 46 | SELF=jigdo-gen-md5-list 47 | VER=0.2 48 | 49 | OPT_ABSOLUTE=1 50 | 51 | # On FreeBSD there is "md5" rather than "md5sum". 52 | # Furthermore, the FreeBSD shell reports missing commands to inherited stderr, 53 | # regardless that the attempt itself has redirected stderr. Thus a sub shell 54 | # is needed to hide the protest. 55 | if ( md5sum --help ) >/dev/null 2>&1 56 | then 57 | md5_cmd=md5sum 58 | elif ( md5 -s test ) >/dev/null 2>&1 59 | then 60 | md5_cmd=md5 61 | else 62 | echo "$0 : Programs md5sum and md5 failed to work" >&2 63 | exit 2 64 | fi 65 | 66 | usage() { 67 | cat << USAGE 68 | usage: $SELF [option] DIR FILE ... 69 | -a, --make-absolute make absolute paths, avoiding any symlinks (default) 70 | -l, --keep-literal leave paths untouched, literally as supplied 71 | -v, --version print version 72 | -h, --help print help 73 | -e, --examples print examples 74 | USAGE 75 | } 76 | 77 | examples() { 78 | cat << EXAMPLES 79 | examples: 80 | $SELF datadir datafile 81 | $SELF --keep-literal datadir datafile 82 | find . -type f | xargs $SELF 83 | find . -exec $SELF '{}' ';' 84 | EXAMPLES 85 | } 86 | 87 | md5list() { 88 | item="$1" 89 | if test $OPT_ABSOLUTE -eq 1; then 90 | dn=`dirname "$item"` # dirname 91 | fn=`basename "$item"` # filename 92 | od=`pwd -P` # old dir 93 | cd "$dn" || exit 1 94 | item=`pwd -P`/"$fn" # absolute physical file path, avoiding all symlinks 95 | cd "$od" || exit 1 96 | fi 97 | if test "$md5_cmd" = "md5sum" 98 | then 99 | MD5=`md5sum "$item" | awk '{print $1}'` 100 | elif test "$md5_cmd" = "md5" 101 | then 102 | MD5=`md5 -q "$item"` 103 | else 104 | echo "$0 : No MD5 program found" >&2 105 | exit 2 106 | fi 107 | SIZ=`ls -ld "$item" | awk '{print $5}'` 108 | printf '%32s %12s %s\n' "$MD5" "$SIZ" "$item" 109 | } 110 | 111 | walkdir() { 112 | DR="$1" 113 | for item in `find "$DR" -type f` 114 | do 115 | md5list "$item" 116 | done 117 | } 118 | 119 | 120 | # main() 121 | if test "$1" = "" ; then 122 | usage 123 | exit 1 124 | fi 125 | 126 | case "$1" in 127 | --make-absolute|-a) 128 | OPT_ABSOLUTE=1; 129 | shift; 130 | ;; 131 | --keep-literal|-l) 132 | OPT_ABSOLUTE=0; 133 | shift; 134 | ;; 135 | --version|-v) 136 | printf '%s %s\n' "$SELF" "$VER" 137 | exit 0 138 | ;; 139 | --help|-h) 140 | usage 141 | exit 0 142 | ;; 143 | --examples|-e) 144 | examples 145 | exit 0 146 | # *) 147 | # usage 148 | # exit 1 149 | # ;; 150 | esac 151 | 152 | for i in "$@" 153 | do 154 | 155 | if test -d "$i" ; then 156 | DR="$i" 157 | if test $OPT_ABSOLUTE -eq 1; then 158 | od=`pwd -P` # old dir 159 | cd "$DR" || exit 1 160 | DR=`pwd -P` # absolute physical dir path, avoiding all symlinks 161 | cd "$od" || exit 1 162 | fi 163 | walkdir "$DR" 164 | elif test -f "$i" ; then 165 | FL="$i" 166 | md5list "$FL" 167 | else 168 | usage 169 | exit 1 170 | fi; 171 | 172 | done 173 | 174 | exit 0 175 | 176 | -------------------------------------------------------------------------------- /libjte/jigdo-gen-md5-list.1: -------------------------------------------------------------------------------- 1 | .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.38.2. 2 | .TH JIGDO-GEN-MD5-LIST "1" "October 2010" "jigdo-gen-md5-list 0.1" "User Commands" 3 | .SH NAME 4 | jigdo-gen-md5-list \- create a list of MD5sums encoded in hexidecimal format and print to standard output 5 | .SH DESCRIPTION 6 | usage: jigdo\-gen\-md5\-list [option] DIR FILE ... 7 | .TP 8 | \fB\-a\fR, \fB\-\-make\-absolute\fR 9 | make absolute paths, avoiding any symlinks (default) 10 | .TP 11 | \fB\-l\fR, \fB\-\-keep\-literal\fR 12 | leave paths untouched, literally as supplied 13 | .TP 14 | \fB\-v\fR, \fB\-\-version\fR 15 | print version 16 | .TP 17 | \fB\-h\fR, \fB\-\-help\fR 18 | print help 19 | .TP 20 | \fB\-e\fR, \fB\-\-examples\fR 21 | print examples 22 | .SH FORMAT 23 | 24 | File format is described in the beginning of the script itself. 25 | 26 | .SH "SEE ALSO" 27 | xorriso(1), jigdo-lite(1), jigit-mkimage(1) 28 | 29 | .SH AUTHOR 30 | Written by George Danchev and Thomas Schmitt 31 | -------------------------------------------------------------------------------- /libjte/jte.h: -------------------------------------------------------------------------------- 1 | /* 2 | * jte.c 3 | * 4 | * Copyright (c) 2004-2006 Steve McIntyre 5 | * Copyright (c) 2010 Thomas Schmitt 6 | * Copyright (c) 2010 George Danchev 7 | * 8 | * Prototypes and declarations for JTE 9 | * 10 | * GNU GPL v2 11 | */ 12 | 13 | #ifndef _JTE_JTE_H_ 14 | #define _JTE_JTE_H_ 15 | 16 | /* The API environment handle which replaces the old global variables */ 17 | struct libjte_env; 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | typedef int BOOL; 24 | 25 | 26 | extern int write_jt_header(struct libjte_env *o, 27 | FILE *template_file, FILE *jigdo_file); 28 | extern int write_jt_footer(struct libjte_env *o); 29 | extern int jtwrite(struct libjte_env *o, 30 | void *buffer, int size, int count); 31 | extern int write_jt_match_record(struct libjte_env *o, 32 | char *filename, char *mirror_name, int sector_size, 33 | off_t size, unsigned char md5[16]); 34 | extern int list_file_in_jigdo(struct libjte_env *o, 35 | char *filename, off_t size, char **realname, 36 | unsigned char md5[16]); 37 | extern int jte_add_exclude(struct libjte_env *o, char *pattern); 38 | extern int jte_add_include(struct libjte_env *o, char *pattern); 39 | extern int jte_add_mapping(struct libjte_env *o, char *arg); 40 | 41 | int libjte_destroy_path_match_list(struct libjte_env *o, int flag); 42 | int libjte_destroy_path_mapping(struct libjte_env *o, int flag); 43 | int libjte_destroy_entry_list(struct libjte_env *o, int flag); 44 | int libjte_destroy_md5_list(struct libjte_env *o, int flag); 45 | 46 | int libjte_report_no_mem(struct libjte_env *o, size_t size, int flag); 47 | 48 | 49 | typedef enum _jtc_e 50 | { 51 | JTE_TEMP_GZIP = 0, 52 | JTE_TEMP_BZIP2 53 | } jtc_t; 54 | 55 | 56 | 57 | #define MIN_JIGDO_FILE_SIZE 1024 58 | 59 | /* 60 | Simple list to hold the results of -jigdo-exclude and 61 | -jigdo-force-match command line options. Seems easiest to do this 62 | using regexps. 63 | */ 64 | struct path_match 65 | { 66 | regex_t match_pattern; 67 | char *match_rule; 68 | struct path_match *next; 69 | }; 70 | 71 | /* List of mappings e.g. Debian=/mirror/debian */ 72 | struct path_mapping 73 | { 74 | char *from; 75 | char *to; 76 | struct path_mapping *next; 77 | }; 78 | 79 | /* List of files that we've seen, ready to write into the template and 80 | jigdo files */ 81 | typedef struct _file_entry 82 | { 83 | unsigned char md5[16]; 84 | off_t file_length; 85 | uint64_t rsyncsum; 86 | char *filename; 87 | } file_entry_t; 88 | 89 | typedef struct _unmatched_entry 90 | { 91 | off_t uncompressed_length; 92 | } unmatched_entry_t; 93 | 94 | typedef struct _entry 95 | { 96 | int entry_type; /* JTET_TYPE as above */ 97 | struct _entry *next; 98 | union 99 | { 100 | file_entry_t file; 101 | unmatched_entry_t chunk; 102 | } data; 103 | } entry_t; 104 | 105 | typedef struct _jigdo_file_entry 106 | { 107 | unsigned char type; 108 | unsigned char fileLen[6]; 109 | unsigned char fileRsync[8]; 110 | unsigned char fileMD5[16]; 111 | } jigdo_file_entry_t; 112 | 113 | typedef struct _jigdo_chunk_entry 114 | { 115 | unsigned char type; 116 | unsigned char skipLen[6]; 117 | } jigdo_chunk_entry_t; 118 | 119 | typedef struct _jigdo_image_entry 120 | { 121 | unsigned char type; 122 | unsigned char imageLen[6]; 123 | unsigned char imageMD5[16]; 124 | unsigned char blockLen[4]; 125 | } jigdo_image_entry_t; 126 | 127 | typedef struct _md5_list_entry 128 | { 129 | struct _md5_list_entry *next; 130 | unsigned char MD5[16]; 131 | uint64_t size; 132 | char *filename; 133 | } md5_list_entry_t; 134 | 135 | 136 | typedef struct _jigdo_msg_entry 137 | { 138 | struct _jigdo_msg_entry *next; 139 | char *message; 140 | } jigdo_msg_entry_t; 141 | int libjte_add_msg_entry(struct libjte_env *o, char *message, int flag); 142 | /* Destructor is API call libjte_clear_msg_list() */ 143 | 144 | #endif 145 | /*_JTE_JTE_H_*/ 146 | -------------------------------------------------------------------------------- /libjte/libjte_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libjte_private.h 3 | * 4 | * Copyright (c) 2010 Thomas Schmitt 5 | * 6 | * Environment structure for libjte 7 | * 8 | * GNU LGPL v2.1 (including option for GPL v2 or later) 9 | * 10 | */ 11 | 12 | 13 | #ifndef LIBJTE_PRIVATE_H_INCLUDED 14 | #define LIBJTE_PRIVATE_H_INCLUDED 1 15 | 16 | /* Opaque handles */ 17 | struct path_match; 18 | struct path_mapping; 19 | 20 | 21 | struct libjte_env { 22 | char *outfile; 23 | int verbose; 24 | char *jtemplate_out; 25 | char *jjigdo_out; 26 | char *jmd5_list; 27 | FILE *jtjigdo; 28 | FILE *jttemplate; 29 | int jte_min_size; 30 | int checksum_algo_iso; 31 | int checksum_algo_tmpl; 32 | jtc_t jte_template_compression; 33 | struct path_match *exclude_list; 34 | struct path_match *include_list; 35 | struct path_mapping *map_list; 36 | uint64_t template_size; 37 | uint64_t image_size; 38 | checksum_context_t *iso_context; 39 | checksum_context_t *template_context; 40 | entry_t *entry_list; 41 | entry_t *entry_last; 42 | FILE *t_file; 43 | FILE *j_file; 44 | int num_matches; 45 | int num_chunks; 46 | md5_list_entry_t *md5_list; 47 | md5_list_entry_t *md5_last; 48 | 49 | int include_in_jigdo; /* 0= put data blocks into .template, 1= do not */ 50 | 51 | char message_buffer[4096]; 52 | int error_behavior; /* bit0= report messages to stderr rather than to list 53 | bit1= perform traditional exit(1) 54 | */ 55 | jigdo_msg_entry_t *msg_list; 56 | 57 | /* Static variables from write_compressed_chunk() */ 58 | unsigned char *uncomp_buf; 59 | size_t uncomp_size; 60 | size_t uncomp_buf_used; 61 | }; 62 | 63 | 64 | #endif /* LIBJTE_PRIVATE_H_INCLUDED */ 65 | -------------------------------------------------------------------------------- /libjte/md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file has been modified for the cdrkit suite. 3 | * 4 | * The behaviour and appearence of the program code below can differ to a major 5 | * extent from the version distributed by the original author(s). 6 | * 7 | * For details, see Changelog file distributed with the cdrkit package. If you 8 | * received this file from another source then ask the distributing person for 9 | * a log of modifications. 10 | * 11 | */ 12 | 13 | /* See md5.c for explanation and copyright information. */ 14 | 15 | #ifndef MD5_H 16 | #define MD5_H 17 | 18 | /* Unlike previous versions of this code, uint32 need not be exactly 19 | 32 bits, merely 32 bits or more. Choosing a data type which is 32 20 | bits instead of 64 is not important; speed is considerably more 21 | important. ANSI guarantees that "unsigned long" will be big enough, 22 | and always using it seems to have few disadvantages. */ 23 | typedef unsigned long mk_uint32; 24 | 25 | struct mk_MD5Context { 26 | mk_uint32 buf[4]; 27 | mk_uint32 bits[2]; 28 | unsigned char in[64]; 29 | }; 30 | 31 | void mk_MD5Init (struct mk_MD5Context *context); 32 | void mk_MD5Update (struct mk_MD5Context *context, 33 | unsigned char const *buf, unsigned len); 34 | void mk_MD5Final (unsigned char digest[16], 35 | struct mk_MD5Context *context); 36 | void mk_MD5Transform (mk_uint32 buf[4], const unsigned char in[64]); 37 | int mk_MD5Parse(unsigned char in[33], unsigned char out[16]); 38 | int calculate_md5sum(char *filename, uint64_t size, unsigned char out[16]); 39 | 40 | 41 | #endif /* !MD5_H */ 42 | -------------------------------------------------------------------------------- /libjte/rsync.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file has been modified for the cdrkit suite. 3 | * 4 | * The behaviour and appearence of the program code below can differ to a major 5 | * extent from the version distributed by the original author(s). 6 | * 7 | * For details, see Changelog file distributed with the cdrkit package. If you 8 | * received this file from another source then ask the distributing person for 9 | * a log of modifications. 10 | * 11 | */ 12 | 13 | #ifdef HAVE_CONFIG_H 14 | #include "../config.h" 15 | #endif 16 | 17 | #include 18 | 19 | #ifdef HAVE_STDINT_H 20 | #include 21 | #else 22 | #ifdef HAVE_INTTYPES_H 23 | #include 24 | #endif 25 | #endif 26 | 27 | #include 28 | 29 | #include "rsync.h" 30 | 31 | /* Borrowed from jigdo; original notice: 32 | 33 | These are purely random, no patterns or anything... (I hope) 34 | 35 | I do not claim copyright for the actual numbers below, you may use them 36 | for a re-implementation of the algorithm under a license of your choice. 37 | -- Richard Atterer. */ 38 | static uint32_t charTable[256] = { 39 | 0x51d65c0f, 0x083cd94b, 0x77f73dd8, 0xa0187d36, 40 | 0x29803d07, 0x7ea8ac0e, 0xea4c16c9, 0xfc576443, 41 | 0x6213df29, 0x1c012392, 0xb38946ae, 0x2e20ca31, 42 | 0xe4dc532f, 0xcb281c47, 0x8508b6a5, 0xb93c210d, 43 | 0xef02b5f3, 0x66548c74, 0x9ae2deab, 0x3b59f472, 44 | 0x4e546447, 0x45232d1f, 0x0ac0a4b1, 0x6c4c264b, 45 | 0x5d24ce84, 0x0f2752cc, 0xa35c7ac7, 0x3e31af51, 46 | 0x79675a59, 0x581f0e81, 0x49053122, 0x7339c9d8, 47 | 0xf9833565, 0xa3dbe5b3, 0xcc06eeb9, 0x92d0671c, 48 | 0x3eb220a7, 0x64864eae, 0xca100872, 0xc50977a1, 49 | 0xd90378e1, 0x7a36cab9, 0x15c15f4b, 0x8b9ef749, 50 | 0xcc1432dc, 0x1ec578ed, 0x27e6e092, 0xbb06db8f, 51 | 0x67f661ac, 0x8dd1a3db, 0x2a0ca16b, 0xb229ab84, 52 | 0x127a3337, 0x347d846f, 0xe1ea4b50, 0x008dbb91, 53 | 0x414c1426, 0xd2be76f0, 0x08789a39, 0xb4d93e30, 54 | 0x61667760, 0x8871bee9, 0xab7da12d, 0xe3c58620, 55 | 0xe9fdfbbe, 0x64fb04f7, 0x8cc5bbf0, 0xf5272d30, 56 | 0x8f161b50, 0x11122b05, 0x7695e72e, 0xa1c5d169, 57 | 0x1bfd0e20, 0xef7e6169, 0xf652d08e, 0xa9d0f139, 58 | 0x2f70aa04, 0xae2c7d6d, 0xa3cb9241, 0x3ae7d364, 59 | 0x348788f8, 0xf483b8f1, 0x55a011da, 0x189719dc, 60 | 0xb0c5d723, 0x8b344e33, 0x300d46eb, 0xd44fe34f, 61 | 0x1a2016c1, 0x66ce4cd7, 0xa45ea5e3, 0x55cb708a, 62 | 0xbce430df, 0xb01ae6e0, 0x3551163b, 0x2c5b157a, 63 | 0x574c4209, 0x430fd0e4, 0x3387e4a5, 0xee1d7451, 64 | 0xa9635623, 0x873ab89b, 0xb96bc6aa, 0x59898937, 65 | 0xe646c6e7, 0xb79f8792, 0x3f3235d8, 0xef1b5acf, 66 | 0xd975b22b, 0x427acce6, 0xe47a2411, 0x75f8c1e8, 67 | 0xa63f799d, 0x53886ad8, 0x9b2d6d32, 0xea822016, 68 | 0xcdee2254, 0xd98bcd98, 0x2933a544, 0x961f379f, 69 | 0x49219792, 0xc61c360f, 0x77cc0c64, 0x7b872046, 70 | 0xb91c7c12, 0x7577154b, 0x196573be, 0xf788813f, 71 | 0x41e2e56a, 0xec3cd244, 0x8c7401f1, 0xc2e805fe, 72 | 0xe8872fbe, 0x9e2faf7d, 0x6766456b, 0x888e2197, 73 | 0x28535c6d, 0x2ce45f3f, 0x24261d2a, 0xd6faab8b, 74 | 0x7a7b42b8, 0x15f0f6fa, 0xfe1711df, 0x7e5685a6, 75 | 0x00930268, 0x74755331, 0x1998912c, 0x7b60498b, 76 | 0x501a5786, 0x92ace0f6, 0x1d9752fe, 0x5a731add, 77 | 0x5b3b44fc, 0x473673f9, 0xa42c0321, 0xd82f9f18, 78 | 0xb4b225da, 0xfc89ece2, 0x072e1130, 0x5772aae3, 79 | 0x29010857, 0x542c970c, 0x94f67fe5, 0x71209e9b, 80 | 0xdb97ea39, 0x2689b41b, 0xae815804, 0xfc5e2651, 81 | 0xd4521674, 0x48ed979a, 0x2f617da3, 0xc350353d, 82 | 0xc3accd94, 0xbd8d313a, 0xc61a8e77, 0xf34940a4, 83 | 0x8d2c6b0f, 0x0f0e7225, 0x39e183db, 0xd19ebba9, 84 | 0x6a0f37b9, 0xd18922f3, 0x106420c5, 0xaa5a640b, 85 | 0x7cf0d273, 0xcf3238a7, 0x3b33204f, 0x476be7bb, 86 | 0x09d23bca, 0xbe84b2f7, 0xb7a3bace, 0x2528cee1, 87 | 0x3dcaa1dd, 0x900ad31a, 0xf21dea6d, 0x9ce51463, 88 | 0xf1540bba, 0x0fab1bdd, 0x89cfb79a, 0x01a2a6e6, 89 | 0x6f85d67c, 0xd1669ec4, 0x355db722, 0x00ebd5c4, 90 | 0x926eb385, 0x69ead869, 0x0da2b122, 0x402779fe, 91 | 0xdaed92d0, 0x57e9aabb, 0x3df64854, 0xfcc774b5, 92 | 0x2e1740ed, 0xa615e024, 0xf7bac938, 0x377dfd1a, 93 | 0xd0559d66, 0x25499be8, 0x2d8f2006, 0xfaa9e486, 94 | 0x95e980e7, 0x82aeba67, 0x5a7f2561, 0xbc60dff6, 95 | 0x6c8739a2, 0x7ec59a8b, 0x9998f265, 0xdfe37e5e, 96 | 0xb47cee1e, 0x4dd8bc9e, 0x35c57e09, 0x07850b63, 97 | 0x06eadbcb, 0x6c1f2956, 0x01685c2c, 0xf5725eef, 98 | 0xf13b98b5, 0xaab739c2, 0x200b1da2, 0xa716b98b, 99 | 0xd9ee3058, 0x76acf20b, 0x2f259e04, 0xed11658b, 100 | 0x1532b331, 0x0ab43204, 0xf0beb023, 0xb1685483, 101 | 0x58cbdc4f, 0x079384d3, 0x049b141c, 0xc38184b9, 102 | 0xaf551d9a, 0x66222560, 0x059deeca, 0x535f99e2 103 | }; 104 | 105 | uint64_t rsync64(unsigned char *mem, size_t size) 106 | { 107 | uint32_t a = 0; 108 | uint32_t b = 0; 109 | unsigned char *limit = mem + size; 110 | uint64_t result = 0; 111 | 112 | while (mem < limit) 113 | { 114 | a += charTable[*mem++]; 115 | b += a; 116 | } 117 | 118 | a = a & 0xffffffff; /* Just in case uint32 can be 64 bits */ 119 | b = b & 0xffffffff; 120 | 121 | result = ((uint64_t)b << 32) | a; 122 | 123 | return result; 124 | } 125 | 126 | -------------------------------------------------------------------------------- /libjte/rsync.h: -------------------------------------------------------------------------------- 1 | #ifndef _JTE_RSYNC_H_ 2 | #define _JTE_RSYNC_H_ 3 | 4 | uint64_t rsync64(unsigned char *mem, size_t size); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /libjte/sha1.h: -------------------------------------------------------------------------------- 1 | /* sha1.c - SHA1 hash function 2 | * Copyright (C) 1998, 2001, 2002, 2003, 2008 Free Software Foundation, Inc. 3 | * 4 | * This file was part of Libgcrypt. 5 | * 6 | * Libgcrypt is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as 8 | * published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * Libgcrypt is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | */ 19 | 20 | /* Borrowed and adapted slightly for use in JTE by Steve McIntyre 21 | * October 2010 */ 22 | 23 | /* Structure to save state of computation between the single steps. */ 24 | typedef struct 25 | { 26 | uint32_t h0,h1,h2,h3,h4; 27 | uint32_t nblocks; 28 | unsigned char buf[64]; 29 | int count; 30 | } SHA1_CONTEXT; 31 | 32 | /* Initialize structure containing state of computation. */ 33 | void sha1_init_ctx (void *context); 34 | 35 | /* Starting with the result of former calls of this function (or the 36 | initialization function update the context for the next inlen bytes 37 | starting at inbuf_arg. 38 | It is NOT required that inlen is a multiple of 64. */ 39 | void sha1_write (void *context, const void *inbuf_arg, size_t inlen); 40 | 41 | /* Process the remaining bytes in the buffer and finish the checksum 42 | calculation. */ 43 | void sha1_finish_ctx(void *context); 44 | 45 | /* Read the checksum result - 20 bytes. The result is always in little 46 | endian byte order, so that a byte-wise output yields to the wanted 47 | ASCII representation of the message digest. */ 48 | unsigned char *sha1_read(void *context); 49 | -------------------------------------------------------------------------------- /libjte/sha256.h: -------------------------------------------------------------------------------- 1 | /* Declaration of functions and data types used for SHA256 sum computing 2 | library functions. 3 | Copyright (C) 2007 Free Software Foundation, Inc. 4 | 5 | Copied here from the GNU C Library version 2.7 on the 10 May 2009 6 | by Steve McIntyre <93sam@debian.org>. This code was under GPL v2.1 7 | in glibc, and that license gives us the option to use and 8 | distribute the code under the terms of the GPL v2 instead. I'm 9 | taking that option. 10 | 11 | This program is free software; you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by the 13 | Free Software Foundation; either version 2, or (at your option) any 14 | later version. 15 | 16 | This program is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | GNU General Public License for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with this program; if not, write to the Free Software Foundation, 23 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ 24 | 25 | #ifndef _SHA256_H 26 | #define _SHA256_H 1 27 | 28 | #include 29 | 30 | #ifdef HAVE_STDINT_H 31 | #include 32 | #else 33 | #ifdef HAVE_INTTYPES_H 34 | #include 35 | #endif 36 | #endif 37 | 38 | #include 39 | 40 | 41 | /* Structure to save state of computation between the single steps. */ 42 | struct sha256_ctx 43 | { 44 | uint32_t H[8]; 45 | 46 | uint32_t total[2]; 47 | uint32_t buflen; 48 | char buffer[128] __attribute__ ((__aligned__ (__alignof__ (uint32_t)))); 49 | }; 50 | 51 | /* Initialize structure containing state of computation. 52 | (FIPS 180-2: 5.3.2) */ 53 | extern void sha256_init_ctx (struct sha256_ctx *ctx); 54 | 55 | /* Starting with the result of former calls of this function (or the 56 | initialization function update the context for the next LEN bytes 57 | starting at BUFFER. 58 | It is NOT required that LEN is a multiple of 64. */ 59 | extern void sha256_process_bytes (const void *buffer, size_t len, 60 | struct sha256_ctx *ctx); 61 | 62 | /* Process the remaining bytes in the buffer and put result from CTX 63 | in first 32 bytes following RESBUF. 64 | 65 | IMPORTANT: On some systems it is required that RESBUF is correctly 66 | aligned for a 32 bits value. */ 67 | extern void *sha256_finish_ctx (struct sha256_ctx *ctx, void *resbuf); 68 | 69 | #endif /* sha256.h */ 70 | -------------------------------------------------------------------------------- /libjte/sha512.h: -------------------------------------------------------------------------------- 1 | /* Declaration of functions and data types used for SHA512 sum computing 2 | library functions. 3 | Copyright (C) 2007 Free Software Foundation, Inc. 4 | 5 | Copied here from the GNU C Library version 2.7 on the 10 May 2009 6 | by Steve McIntyre <93sam@debian.org>. This code was under GPL v2.1 7 | in glibc, and that license gives us the option to use and 8 | distribute the code under the terms of the GPL v2 instead. I'm 9 | taking that option. 10 | 11 | This program is free software; you can redistribute it and/or modify it 12 | under the terms of the GNU General Public License as published by the 13 | Free Software Foundation; either version 2, or (at your option) any 14 | later version. 15 | 16 | This program is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | GNU General Public License for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with this program; if not, write to the Free Software Foundation, 23 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ 24 | 25 | #ifndef _SHA512_H 26 | #define _SHA512_H 1 27 | 28 | #include 29 | 30 | #ifdef HAVE_STDINT_H 31 | #include 32 | #else 33 | #ifdef HAVE_INTTYPES_H 34 | #include 35 | #endif 36 | #endif 37 | 38 | #include 39 | 40 | 41 | /* Structure to save state of computation between the single steps. */ 42 | struct sha512_ctx 43 | { 44 | uint64_t H[8]; 45 | 46 | uint64_t total[2]; 47 | uint64_t buflen; 48 | char buffer[256] __attribute__ ((__aligned__ (__alignof__ (uint64_t)))); 49 | }; 50 | 51 | /* Initialize structure containing state of computation. 52 | (FIPS 180-2: 5.3.3) */ 53 | extern void sha512_init_ctx (struct sha512_ctx *ctx); 54 | 55 | /* Starting with the result of former calls of this function (or the 56 | initialization function update the context for the next LEN bytes 57 | starting at BUFFER. 58 | It is NOT required that LEN is a multiple of 128. */ 59 | extern void sha512_process_bytes (const void *buffer, size_t len, 60 | struct sha512_ctx *ctx); 61 | 62 | /* Process the remaining bytes in the buffer and put result from CTX 63 | in first 64 bytes following RESBUF. 64 | 65 | IMPORTANT: On some systems it is required that RESBUF is correctly 66 | aligned for a 64 bits value. */ 67 | extern void *sha512_finish_ctx (struct sha512_ctx *ctx, void *resbuf); 68 | 69 | #endif /* sha512.h */ 70 | -------------------------------------------------------------------------------- /ltsugar.m4: -------------------------------------------------------------------------------- 1 | # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- 2 | # 3 | # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. 4 | # Written by Gary V. Vaughan, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # serial 6 ltsugar.m4 11 | 12 | # This is to help aclocal find these macros, as it can't see m4_define. 13 | AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) 14 | 15 | 16 | # lt_join(SEP, ARG1, [ARG2...]) 17 | # ----------------------------- 18 | # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their 19 | # associated separator. 20 | # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier 21 | # versions in m4sugar had bugs. 22 | m4_define([lt_join], 23 | [m4_if([$#], [1], [], 24 | [$#], [2], [[$2]], 25 | [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) 26 | m4_define([_lt_join], 27 | [m4_if([$#$2], [2], [], 28 | [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) 29 | 30 | 31 | # lt_car(LIST) 32 | # lt_cdr(LIST) 33 | # ------------ 34 | # Manipulate m4 lists. 35 | # These macros are necessary as long as will still need to support 36 | # Autoconf-2.59 which quotes differently. 37 | m4_define([lt_car], [[$1]]) 38 | m4_define([lt_cdr], 39 | [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], 40 | [$#], 1, [], 41 | [m4_dquote(m4_shift($@))])]) 42 | m4_define([lt_unquote], $1) 43 | 44 | 45 | # lt_append(MACRO-NAME, STRING, [SEPARATOR]) 46 | # ------------------------------------------ 47 | # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. 48 | # Note that neither SEPARATOR nor STRING are expanded; they are appended 49 | # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). 50 | # No SEPARATOR is output if MACRO-NAME was previously undefined (different 51 | # than defined and empty). 52 | # 53 | # This macro is needed until we can rely on Autoconf 2.62, since earlier 54 | # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. 55 | m4_define([lt_append], 56 | [m4_define([$1], 57 | m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) 58 | 59 | 60 | 61 | # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) 62 | # ---------------------------------------------------------- 63 | # Produce a SEP delimited list of all paired combinations of elements of 64 | # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list 65 | # has the form PREFIXmINFIXSUFFIXn. 66 | # Needed until we can rely on m4_combine added in Autoconf 2.62. 67 | m4_define([lt_combine], 68 | [m4_if(m4_eval([$# > 3]), [1], 69 | [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl 70 | [[m4_foreach([_Lt_prefix], [$2], 71 | [m4_foreach([_Lt_suffix], 72 | ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, 73 | [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) 74 | 75 | 76 | # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) 77 | # ----------------------------------------------------------------------- 78 | # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited 79 | # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. 80 | m4_define([lt_if_append_uniq], 81 | [m4_ifdef([$1], 82 | [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], 83 | [lt_append([$1], [$2], [$3])$4], 84 | [$5])], 85 | [lt_append([$1], [$2], [$3])$4])]) 86 | 87 | 88 | # lt_dict_add(DICT, KEY, VALUE) 89 | # ----------------------------- 90 | m4_define([lt_dict_add], 91 | [m4_define([$1($2)], [$3])]) 92 | 93 | 94 | # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) 95 | # -------------------------------------------- 96 | m4_define([lt_dict_add_subkey], 97 | [m4_define([$1($2:$3)], [$4])]) 98 | 99 | 100 | # lt_dict_fetch(DICT, KEY, [SUBKEY]) 101 | # ---------------------------------- 102 | m4_define([lt_dict_fetch], 103 | [m4_ifval([$3], 104 | m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), 105 | m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) 106 | 107 | 108 | # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) 109 | # ----------------------------------------------------------------- 110 | m4_define([lt_if_dict_fetch], 111 | [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], 112 | [$5], 113 | [$6])]) 114 | 115 | 116 | # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) 117 | # -------------------------------------------------------------- 118 | m4_define([lt_dict_filter], 119 | [m4_if([$5], [], [], 120 | [lt_join(m4_quote(m4_default([$4], [[, ]])), 121 | lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), 122 | [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl 123 | ]) 124 | -------------------------------------------------------------------------------- /ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 3337 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4.2]) 16 | m4_define([LT_PACKAGE_REVISION], [1.3337]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4.2' 20 | macro_revision='1.3337' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /mkinstalldirs: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # mkinstalldirs --- make directory hierarchy 3 | # Author: Noah Friedman 4 | # Created: 1993-05-16 5 | # Public domain 6 | 7 | errstatus=0 8 | dirmode="" 9 | 10 | usage="\ 11 | Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." 12 | 13 | # process command line arguments 14 | while test $# -gt 0 ; do 15 | case $1 in 16 | -h | --help | --h*) # -h for help 17 | echo "$usage" 1>&2 18 | exit 0 19 | ;; 20 | -m) # -m PERM arg 21 | shift 22 | test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } 23 | dirmode=$1 24 | shift 25 | ;; 26 | --) # stop option processing 27 | shift 28 | break 29 | ;; 30 | -*) # unknown option 31 | echo "$usage" 1>&2 32 | exit 1 33 | ;; 34 | *) # first non-opt arg 35 | break 36 | ;; 37 | esac 38 | done 39 | 40 | for file 41 | do 42 | if test -d "$file"; then 43 | shift 44 | else 45 | break 46 | fi 47 | done 48 | 49 | case $# in 50 | 0) exit 0 ;; 51 | esac 52 | 53 | case $dirmode in 54 | '') 55 | if mkdir -p -- . 2>/dev/null; then 56 | echo "mkdir -p -- $*" 57 | exec mkdir -p -- "$@" 58 | fi 59 | ;; 60 | *) 61 | if mkdir -m "$dirmode" -p -- . 2>/dev/null; then 62 | echo "mkdir -m $dirmode -p -- $*" 63 | exec mkdir -m "$dirmode" -p -- "$@" 64 | fi 65 | ;; 66 | esac 67 | 68 | for file 69 | do 70 | set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` 71 | shift 72 | 73 | pathcomp= 74 | for d 75 | do 76 | pathcomp="$pathcomp$d" 77 | case $pathcomp in 78 | -*) pathcomp=./$pathcomp ;; 79 | esac 80 | 81 | if test ! -d "$pathcomp"; then 82 | echo "mkdir $pathcomp" 83 | 84 | mkdir "$pathcomp" || lasterr=$? 85 | 86 | if test ! -d "$pathcomp"; then 87 | errstatus=$lasterr 88 | else 89 | if test ! -z "$dirmode"; then 90 | echo "chmod $dirmode $pathcomp" 91 | lasterr="" 92 | chmod "$dirmode" "$pathcomp" || lasterr=$? 93 | 94 | if test ! -z "$lasterr"; then 95 | errstatus=$lasterr 96 | fi 97 | fi 98 | fi 99 | fi 100 | 101 | pathcomp="$pathcomp/" 102 | done 103 | done 104 | 105 | exit $errstatus 106 | 107 | # Local Variables: 108 | # mode: shell-script 109 | # sh-indentation: 2 110 | # End: 111 | # mkinstalldirs ends here 112 | -------------------------------------------------------------------------------- /releng/CHECKLIST: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------------------------------ 2 | http:libburnia-project.org 3 | ------------------------------------------------------------------------------ 4 | 5 | Release Engineering Check List 6 | 7 | TEST: releng 8 | auto_* tests could be run altogether by ./run_all_auto 9 | manual_* tests are to be run individually and manually 10 | LOGS: http://people.debian.org/~danchev/libburnia/logs/releng/ 11 | 12 | TEST: cppcheck - static code checker 13 | LOGS: http://people.debian.org/~danchev/libburnia/logs/cppcheck/ 14 | 15 | TEST: medistimator - checks the dialog mode of xorriso, size estimation 16 | facility, and its ability of processing large trees. Running this 17 | requires some specific knowledge of how the tool works, in order to 18 | interpret the results and compare them with these from any previous 19 | runs. The source is heavily commented. 20 | FILE: http://anonscm.debian.org/gitweb/?p=users/danchev/medistimator.git;a=summary 21 | LOGS: http://people.debian.org/~danchev/libburnia/logs/medistimator/ 22 | 23 | TEST: Debian ISO image builder logs 24 | LOGS: http://cdbuilder.debian.org/cdimage-log/ 25 | 26 | TEST: Debian build daemon logs - several hardware architectures and kernels 27 | LOGS: http://buildd.debian.org 28 | -------------------------------------------------------------------------------- /releng/TODO: -------------------------------------------------------------------------------- 1 | 2 | * Manpage examples turned into tests 3 | Convert most examples from xorriso(1) manpage into tests. 4 | 5 | * Enhance 'auto_isocontent' 6 | Extend it to use some more demanding directory tree. 7 | MD5s should be checked. 8 | All file types as of stat(2) should be tested. 9 | Test various comparisons: 10 | xorriso provides built-in means for comparison: 11 | xorriso -compare_r disk_path iso_rr_path 12 | xorriso -indev my.iso -find / vs. find input_dir 13 | bsdtar -xf my.iso vs. input_dir 14 | 15 | * Test for wrong CD sizes would need a new test and probably an 16 | automatic CD changer. 17 | 18 | * Library unit tests - investigate the possibility to write some 19 | cunit-based tests (http://cunit.sourceforge.net) for both 20 | xorriso.h and libisoburn.h API's. The code samples could be put into 21 | codesamples/ directory and run by auto_cxx or a separate auto_ script. 22 | 23 | * ??? Still to decide: 24 | Delete debian-testing-i386-businesscard.iso with ./run_all_auto -c 25 | Contra: Currently remaining large files (like downloaded ISO images) are 26 | simply left behind to be re-used and a boldified info message is shown 27 | so the users can decide for themselves what to remove or leave as well. 28 | Pro: Leaving 70 MB of image is quite obtrusive. Option -c is not run 29 | under normal circumstances. So it could well be used for total cleanup. 30 | Alternative: Specific option --remove_image. 31 | 32 | * ??? Still to decide: 33 | Have a script ./run_all_manual 34 | Contra argument: if a releng sctipt is suitable to be run under a master 35 | script run_all*, then this releng script should be put into auto_* 36 | namespace , otherwise it is manual_*. 37 | Pro: Tests may be manual because they demand lots of resources, not 38 | because they need manual attention. In general the run_all_manual script 39 | shall spare the user the plight to read the documentation. Instead it 40 | shall present the manual tests, give an opportunity to skip the test, 41 | and ask for parameters, 42 | 43 | -------------------------------------------------------------------------------- /releng/auto_printsize: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2011 George Danchev 4 | # Licensed under GNU GPL version 2 or later 5 | 6 | set -e 7 | 8 | not_in_releng_exit() { 9 | printf "\nPlease execute the tests from releng directory.\n\n" 10 | exit 1 11 | } 12 | 13 | # Include common bits 14 | . inc/releng_getopts.inc || not_in_releng_exit 15 | 16 | print_specific_help() { 17 | cat << HLP 18 | Specific options: 19 | none yet. 20 | Overview: 21 | Test performance of print_size against various input tree. 22 | Optionally compare with genisoimage and mkisofs. 23 | HLP 24 | } 25 | 26 | if test "$SPECIFIC_HELP" = 1; then 27 | print_specific_help 28 | exit 0 29 | fi 30 | 31 | # Each test should decide whether or not it needs 32 | # a xorriso binary to test, since some do compilations only. 33 | if [ ! -x $RELENG_XORRISO ]; then 34 | print_help 35 | printf "\n${SELF}: -x absolute or relative path to binary to be run.\n\n" 36 | exit 31 37 | fi 38 | 39 | # check data dir, if any and after checking -x xorriso 40 | if [ -d "${GEN_DATA_DIR}" ]; then 41 | printf "\n${SELF}: directory %s exists!" ${GEN_DATA_DIR} 42 | printf "\n${SELF}: use '${SELF} -c' to remove.\n" 43 | exit 8 44 | else 45 | mkdir "${GEN_DATA_DIR}" 46 | fi 47 | 48 | # 49 | DIR_UPPER=32 50 | FILE_UPPER=10 51 | 52 | # All must be set at this point 53 | # TODO: work out a smarter way to quickly generate different 54 | # types of trees (long, deep, etc) 55 | printf "\n${SELF}: Generating sample tree in ${GEN_DATA_DIR} :\n" 56 | count=0 57 | date 58 | 59 | # Hopefully the for-loops are much faster than while-loops with arithmetics 60 | # This needs 7/4*DIR_UPPER+FILE_UPPER (= 66) while-iterations 61 | # 62 | i1_list= 63 | i1=0 64 | o1=$(expr ${DIR_UPPER} / 4) 65 | while test $i1 -lt $o1 66 | do 67 | i1_list="$i1_list $i1" 68 | i1=$(expr $i1 + 1) 69 | done 70 | i2_list= 71 | i2=0 72 | o2=$(expr ${DIR_UPPER} / 2) 73 | while test $i2 -lt $o2 74 | do 75 | i2_list="$i2_list $i2" 76 | i2=$(expr $i2 + 1) 77 | done 78 | i3_list= 79 | i3=0 80 | while test $i3 -lt ${DIR_UPPER} 81 | do 82 | i3_list="$i3_list $i3" 83 | i3=$(expr $i3 + 1) 84 | done 85 | i_file_list= 86 | i_file=0 87 | while test $i_file -lt ${FILE_UPPER} 88 | do 89 | i_file_list="$i_file_list $i_file" 90 | i_file=$(expr $i_file + 1) 91 | done 92 | # 93 | # plus 1/8*DIR_UPPER*DIR_UPPER*DIR_UPPER*FILE_UPPER (= 40960) for-iterations 94 | # 95 | for i1 in $i1_list 96 | do 97 | for i2 in $i2_list 98 | do 99 | for i3 in $i3_list 100 | do 101 | mkdir -p ${GEN_DATA_DIR}/DirOne$i1/DirTwo$i2/DirThree$i3 102 | for i_file in $i_file_list 103 | do 104 | echo -n \ 105 | > ${GEN_DATA_DIR}/DirOne$i1/DirTwo$i2/DirThree$i3/File_${i_file} 106 | count=$((count + 1)) 107 | done 108 | done 109 | done 110 | echo " ${count} files created ..." 111 | done 112 | 113 | printf "done.\n" 114 | date 115 | du -s "${GEN_DATA_DIR}" 116 | 117 | printf "\n${SELF}: Performing several print size runs to neutralize possible disk cache impact.\n" 118 | 119 | # run xorriso 120 | if [ -x ${RELENG_XORRISO} ]; then 121 | for run in 1 2 3; do 122 | printf "\n${SELF}: Running ${RELENG_XORRISO} -as mkisofs -quiet -print-size ${GEN_DATA_DIR}. Trial: ${run}.\n" 123 | time ${RELENG_XORRISO} -as mkisofs -quiet -print-size ${GEN_DATA_DIR} 124 | done 125 | fi 126 | 127 | # try to run genisoimage 128 | if which genisoimage >/dev/null 2>&1; then 129 | RELENG_GENISOIMAGE=`which genisoimage` 130 | for run in 1 2 3; do 131 | printf "\n${SELF}: Running ${RELENG_GENISOIMAGE} -quiet -print-size ${GEN_DATA_DIR}. Trial: ${run}.\n" 132 | time ${RELENG_GENISOIMAGE} -quiet -print-size ${GEN_DATA_DIR} 133 | done 134 | fi 135 | 136 | # try to run mkisofs 137 | if which mkisofs >/dev/null 2>&1; then 138 | RELENG_MKISOFS=`which mkisofs` 139 | for run in 1 2 3; do 140 | printf "\n${SELF}: Running ${RELENG_MKISOFS} -quiet -print-size ${GEN_DATA_DIR}. Trial: ${run}.\n" 141 | time ${RELENG_MKISOFS} -quiet -print-size ${GEN_DATA_DIR} 142 | done 143 | fi 144 | 145 | # 146 | cleanup 147 | 148 | # 149 | exit 0 150 | -------------------------------------------------------------------------------- /releng/change_shell_to_use: -------------------------------------------------------------------------------- 1 | 2 | # check whether we are in releng and create dir 3 | mkdir_ret=29 4 | if test -d releng_generated_data 5 | then 6 | if test -d releng_generated_data/change_shell_to_use 7 | then 8 | mkdir_ret=0 9 | else 10 | mkdir releng_generated_data/change_shell_to_use 11 | mkdir_ret=$? 12 | fi 13 | fi 14 | 15 | if test "$mkdir_ret" = 0 16 | then 17 | for i in run_all_auto auto_* manual_* 18 | do 19 | temp=releng_generated_data/change_shell_to_use/temp_file 20 | c=$(wc -l "$i" | awk '{print $1}') 21 | line=$(head -n 1 "$i") 22 | 23 | if echo x"$line" | grep '^x#!' >/dev/null 2>&1 24 | then 25 | cp "$i" "$temp" 26 | echo '#!'"$SHELL" > "$temp" 27 | tail -n "$(expr $c - 1)" "$i" >> "$temp" 28 | mv "$temp" "$i" 29 | echo "Changed to #!$SHELL : $i" 30 | fi 31 | done 32 | rmdir releng_generated_data/change_shell_to_use 33 | else 34 | echo "change_shell_to_use: Missing directory ./releng_generated_data" >&2 35 | echo "or cannot create directory ./releng_generated_data/change_shell_to_use" >&2 36 | echo "change_shell_to_use: Run aborted" 37 | test 1 = 0 38 | fi 39 | 40 | -------------------------------------------------------------------------------- /releng/codesamples/api_3lib.cpp: -------------------------------------------------------------------------------- 1 | // Just to ensure we are C++-clean. This should not spit too much noise 2 | 3 | /* Copyright 2011 George Danchev 4 | * Released into the public domain 5 | */ 6 | 7 | #if __WORDSIZE == 32 8 | #define _LARGEFILE_SOURCE 1 9 | #define _FILE_OFFSET_BITS 64 10 | #endif 11 | 12 | #include 13 | #include 14 | 15 | //extern "C" { 16 | #include "libburn/libburn.h" 17 | #include "libisofs/libisofs.h" 18 | // using namespace burn; 19 | // (this was needed to before rev.4062 of libisoburn) 20 | #include "libisoburn/libisoburn.h" 21 | //} 22 | 23 | int main() { 24 | int major=-1, minor=-1, micro=-1; 25 | isoburn_version(&major, &minor, µ); 26 | if (major<0 || minor<0 || micro<0) 27 | return -1; 28 | std::cout 29 | << " major:" << major 30 | << " minor:" << minor 31 | << " micro:" << micro 32 | ; 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /releng/codesamples/api_xorriso.cpp: -------------------------------------------------------------------------------- 1 | // Just to ensure we are C++-clean. This should not spit too much noise 2 | 3 | /* Copyright 2011 George Danchev 4 | * Released into the public domain 5 | */ 6 | 7 | #if __WORDSIZE == 32 8 | #define _LARGEFILE_SOURCE 1 9 | #define _FILE_OFFSET_BITS 64 10 | #endif 11 | 12 | #include 13 | #include 14 | 15 | //extern "C" { 16 | #include "xorriso/xorriso.h" 17 | //} 18 | 19 | int main() { 20 | int major=-1, minor=-1, micro=-1; 21 | Xorriso__version(&major, &minor, µ); 22 | if (major<0 || minor<0 || micro<0) 23 | return -1; 24 | std::cout 25 | << " major:" << major 26 | << " minor:" << minor 27 | << " micro:" << micro 28 | ; 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /releng/inc/test_releng_getopt: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | . releng_getopts.inc 6 | 7 | printf "\nRELENG_XORRISO =${RELENG_XORRISO}" 8 | printf "\nKEEP =${KEEP}" 9 | printf "\nCLEANUP =${CLEANUP}" 10 | printf "\nSIMULATE_FAILURE =${SIMULATE_FAILURE}" 11 | printf "\n" 12 | 13 | exit 0 14 | -------------------------------------------------------------------------------- /releng/jigdo-gen-md5-list: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Copyright (c) 2010, 2011 George Danchev 4 | # Copyright (c) 2010, 2011 Thomas Schmitt 5 | # This script is distributed according to the terms of the GNU GPL v2. 6 | # This should be better rewritten in C at some future point. Ref: pwd code. 7 | 8 | # Create a list of MD5sums encoded in hexidecimal format and print to standard output 9 | 10 | # Format Description 11 | # A line in the emerging file is to be composed as follows: 12 | # 13 | # The MD5 checksum of the file content must be encoded in 32 hex digits 14 | # [0-9afAF] 15 | # 16 | # Next come two blanks. 17 | # 18 | # The byte size of the file content must be encoded in 12 decimal digits 19 | # or blanks. 20 | # 21 | # Next come two blanks. 22 | # 23 | # The rest of the line up to the newline character is a semi-literal file 24 | # address. Its basename has to be the same as the basename of the data file 25 | # when it is used as one of the input files for the jigdo file generator. 26 | 27 | # The semi-literal address and the address mapping define what will be 28 | # listed as file address in the jigdo file. 29 | # The address may bear at its start a literal text that shall be recognized by 30 | # the address mapping (e.g. -jigdo-map) of the jigdo file generator. 31 | # The rest of the address must be usable as file address in both situations: 32 | # When the jigdo file gets generated, and when the jigdo file gets read 33 | # to inflate the template file into the original payload image. 34 | # The address mappings at both occasions can be used to adapt to a change 35 | # of the absolute location of the listed files. 36 | # Between both mappings, the parent directory is represented by a symbolic 37 | # text, like "Debian:". 38 | 39 | # A simple strategy to cope with this is to write absolute paths into the 40 | # .md5 file, and to use matching absolute paths in the -jigdo-map 41 | # directives. Keep in mind that mapping is purely literal. Symbolic links 42 | # are neither resolved nor can they confuse the mapping. 43 | 44 | set -e 45 | 46 | SELF=jigdo-gen-md5-list 47 | VER=0.2 48 | 49 | OPT_ABSOLUTE=1 50 | 51 | # On FreeBSD there is "md5" rather than "md5sum". 52 | # Furthermore, the FreeBSD shell reports missing commands to inherited stderr, 53 | # regardless that the attempt itself has redirected stderr. Thus a sub shell 54 | # is needed to hide the protest. 55 | if ( md5sum --help ) >/dev/null 2>&1 56 | then 57 | md5_cmd=md5sum 58 | elif ( md5 -s test ) >/dev/null 2>&1 59 | then 60 | md5_cmd=md5 61 | else 62 | echo "$0 : Programs md5sum and md5 failed to work" >&2 63 | exit 2 64 | fi 65 | 66 | usage() { 67 | cat << USAGE 68 | usage: $SELF [option] DIR FILE ... 69 | -a, --make-absolute make absolute paths, avoiding any symlinks (default) 70 | -l, --keep-literal leave paths untouched, literally as supplied 71 | -v, --version print version 72 | -h, --help print help 73 | -e, --examples print examples 74 | USAGE 75 | } 76 | 77 | examples() { 78 | cat << EXAMPLES 79 | examples: 80 | $SELF datadir datafile 81 | $SELF --keep-literal datadir datafile 82 | find . -type f | xargs $SELF 83 | find . -exec $SELF '{}' ';' 84 | EXAMPLES 85 | } 86 | 87 | md5list() { 88 | item="$1" 89 | if test $OPT_ABSOLUTE -eq 1; then 90 | dn=`dirname "$item"` # dirname 91 | fn=`basename "$item"` # filename 92 | od=`pwd -P` # old dir 93 | cd "$dn" || exit 1 94 | item=`pwd -P`/"$fn" # absolute physical file path, avoiding all symlinks 95 | cd "$od" || exit 1 96 | fi 97 | if test "$md5_cmd" = "md5sum" 98 | then 99 | MD5=`md5sum "$item" | awk '{print $1}'` 100 | elif test "$md5_cmd" = "md5" 101 | then 102 | MD5=`md5 -q "$item"` 103 | else 104 | echo "$0 : No MD5 program found" >&2 105 | exit 2 106 | fi 107 | SIZ=`ls -ld "$item" | awk '{print $5}'` 108 | printf '%32s %12s %s\n' "$MD5" "$SIZ" "$item" 109 | } 110 | 111 | walkdir() { 112 | DR="$1" 113 | for item in `find "$DR" -type f` 114 | do 115 | md5list "$item" 116 | done 117 | } 118 | 119 | 120 | # main() 121 | if test "$1" = "" ; then 122 | usage 123 | exit 1 124 | fi 125 | 126 | case "$1" in 127 | --make-absolute|-a) 128 | OPT_ABSOLUTE=1; 129 | shift; 130 | ;; 131 | --keep-literal|-l) 132 | OPT_ABSOLUTE=0; 133 | shift; 134 | ;; 135 | --version|-v) 136 | printf '%s %s\n' "$SELF" "$VER" 137 | exit 0 138 | ;; 139 | --help|-h) 140 | usage 141 | exit 0 142 | ;; 143 | --examples|-e) 144 | examples 145 | exit 0 146 | # *) 147 | # usage 148 | # exit 1 149 | # ;; 150 | esac 151 | 152 | for i in "$@" 153 | do 154 | 155 | if test -d "$i" ; then 156 | DR="$i" 157 | if test $OPT_ABSOLUTE -eq 1; then 158 | od=`pwd -P` # old dir 159 | cd "$DR" || exit 1 160 | DR=`pwd -P` # absolute physical dir path, avoiding all symlinks 161 | cd "$od" || exit 1 162 | fi 163 | walkdir "$DR" 164 | elif test -f "$i" ; then 165 | FL="$i" 166 | md5list "$FL" 167 | else 168 | usage 169 | exit 1 170 | fi; 171 | 172 | done 173 | 174 | exit 0 175 | 176 | -------------------------------------------------------------------------------- /releng/jigdo-gen-md5-list.1: -------------------------------------------------------------------------------- 1 | .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.38.2. 2 | .TH JIGDO-GEN-MD5-LIST "1" "October 2010" "jigdo-gen-md5-list 0.1" "User Commands" 3 | .SH NAME 4 | jigdo-gen-md5-list \- create a list of MD5sums encoded in hexidecimal format and print to standard output 5 | .SH DESCRIPTION 6 | usage: jigdo\-gen\-md5\-list [option] DIR FILE ... 7 | .TP 8 | \fB\-a\fR, \fB\-\-make\-absolute\fR 9 | make absolute paths, avoiding any symlinks (default) 10 | .TP 11 | \fB\-l\fR, \fB\-\-keep\-literal\fR 12 | leave paths untouched, literally as supplied 13 | .TP 14 | \fB\-v\fR, \fB\-\-version\fR 15 | print version 16 | .TP 17 | \fB\-h\fR, \fB\-\-help\fR 18 | print help 19 | .TP 20 | \fB\-e\fR, \fB\-\-examples\fR 21 | print examples 22 | .SH FORMAT 23 | 24 | File format is described in the beginning of the script itself. 25 | 26 | .SH "SEE ALSO" 27 | xorriso(1), jigdo-lite(1), jigit-mkimage(1) 28 | 29 | .SH AUTHOR 30 | Written by George Danchev and Thomas Schmitt 31 | -------------------------------------------------------------------------------- /releng/template_new: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2011 George Danchev 4 | # Copyright 2011 Thomas Schmitt 5 | # === TEMPLATE: Add your own copyright here 6 | # 7 | # Licensed under GNU GPL version 2 or later 8 | 9 | # === TEMPLATE: Remove this remark before releasing this script. 10 | # 11 | # This is a template for creating a new libisoburn/releng test. 12 | # It is supposed that you have read releng/README before you begin to work 13 | # here. 14 | # 15 | # Step 1: Invent a name for your test 16 | # test_name="manual_"...some.name... 17 | # or 18 | # test_name="auto_"...some.name... 19 | # 20 | # Step 2: Copy releng/template_new to $test_name 21 | # 22 | # Step 3: Edit $test_name and process any line that begins by 23 | # "# === TEMPLATE:". Do what the line prescribes and then remove it 24 | # from the script. You are not done as long as such a line remains. 25 | # 26 | # === TEMPLATE: End of remark to remove 27 | 28 | set -e 29 | 30 | 31 | # === TEMPLATE: Describe your own specific options (if any) and the test 32 | print_specific_help() { 33 | cat << HLP 34 | Specific options: 35 | --option Explanation of specific option 36 | Overview: 37 | Short explanation of test purpose and activities. 38 | HLP 39 | } 40 | 41 | 42 | getopts_inc=inc/releng_getopts.inc 43 | if test -e "$getopts_inc" 44 | then 45 | . "$getopts_inc" 46 | 47 | if test "$SPECIFIC_HELP" = 1 48 | then 49 | print_specific_help 50 | exit 0 51 | fi 52 | else 53 | echo >&2 54 | echo "File not found: $getopts_inc" >&2 55 | echo "Are we in the ./releng directory of a libisoburn SVN checkout ?" >&2 56 | echo "(Please execute the tests from that ./releng directory.)" >&2 57 | echo >&2 58 | exit 29 59 | fi 60 | 61 | 62 | # === TEMPLATE: Decide whether the test will have own options, 63 | # === TEMPLATE: apart from those interpreted by inc/releng_getopts.inc 64 | # === TEMPLATE: If not, then remove this interpreter code. 65 | # Set default values for specific option variables. E.g.: 66 | # dev= 67 | # Interpret specific options, they begin after the first --. 68 | next_is=ignore 69 | for i in "$@" 70 | do 71 | if test "$next_is" = "ignore" 72 | then 73 | if test "$i" = "--" 74 | then 75 | next_is="" 76 | fi 77 | 78 | # === TEMPLATE: Implement interpretation of specific options. Like: 79 | # elif test "$next_is" = "dev" 80 | # then 81 | # dev="$i" 82 | # next_is="" 83 | # elif test "$i" = "--dev" 84 | # then 85 | # next_is="dev" 86 | 87 | else 88 | echo >&2 89 | echo "Unknown test specific option: $i" >&2 90 | print_help 91 | print_specific_help 92 | exit 31 93 | fi 94 | done 95 | # === TEMPLATE: End of own option interpreter code. 96 | 97 | 98 | # Each test should decide whether or not it needs 99 | # a xorriso binary to test, since some do compilations only. 100 | # === TEMPLATE: Decide whether you need a xorriso program. 101 | # === TEMPLATE: If not, then remove this function call 102 | check_for_xorriso -x 103 | 104 | 105 | # check data dir, if any and after checking -x xorriso 106 | # === TEMPLATE: Decide whether your test will possibly create own files. 107 | # === TEMPLATE: If yes, then create your files underneath ${GEN_DATA_DIR}. 108 | # === TEMPLATE: The name in this variable is set by inc/releng_getopts.inc . 109 | # === TEMPLATE: If not, then remove this if ... fi statement. 110 | if [ -d "${GEN_DATA_DIR}" ]; then 111 | printf "\n${SELF}: directory %s exists!" ${GEN_DATA_DIR} 112 | printf "\n${SELF}: use '${SELF} -c' to remove.\n" 113 | exit 30 114 | else 115 | mkdir "${GEN_DATA_DIR}" 116 | fi 117 | 118 | 119 | ##################################################################### 120 | 121 | 122 | # === TEMPLATE: Perform your test activities here. 123 | 124 | 125 | # === TEMPLATE: In case of failure, issue a line to stdout that begins by 126 | # === TEMPLATE: the word "FAIL", and make sure that the test script finally 127 | # === TEMPLATE: returns a non-zero exit value. 128 | # === TEMPLATE: 31 = Unknown option or unusable argument with known option 129 | # === TEMPLATE: 30 = Unexpected state of own directory for self generated files 130 | # === TEMPLATE: 29 = Not in ./releng directory or missing essential parts 131 | # === TEMPLATE: 1 to 28 = test specific exit values 132 | # === TEMPLATE: When exiting prematurely, make sure to call cleanup. 133 | 134 | cleanup 135 | exit 0 136 | -------------------------------------------------------------------------------- /version.h.in: -------------------------------------------------------------------------------- 1 | 2 | /* <<< this file is on its way out 3 | #define ISOBURN_MAJOR_VERSION @ISOBURN_MAJOR_VERSION@ 4 | #define ISOBURN_MINOR_VERSION @ISOBURN_MINOR_VERSION@ 5 | #define ISOBURN_MICRO_VERSION @ISOBURN_MICRO_VERSION@ 6 | */ 7 | #define LIBISOFS_MAJOR_VERSION @LIBISOFS_MAJOR_VERSION@ 8 | #define LIBISOFS_MINOR_VERSION @LIBISOFS_MINOR_VERSION@ 9 | #define LIBISOFS_MICRO_VERSION @LIBISOFS_MICRO_VERSION@ 10 | #define BURN_MAJOR_VERSION @BURN_MAJOR_VERSION@ 11 | #define BURN_MINOR_VERSION @BURN_MINOR_VERSION@ 12 | #define BURN_MICRO_VERSION @BURN_MICRO_VERSION@ 13 | -------------------------------------------------------------------------------- /xorriso/COPYRIGHT: -------------------------------------------------------------------------------- 1 | Mario Danic , 2 | Vreixo Formoso 3 | Thomas Schmitt 4 | libisoburn is Copyright (C) 2007-2011 Vreixo Formoso, Thomas Schmitt 5 | xorriso is Copyright (C) 2007-2011 Thomas Schmitt 6 | 7 | This program is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License version 2 9 | or later as published by the Free Software Foundation. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | -------------------------------------------------------------------------------- /xorriso/base_obj.h: -------------------------------------------------------------------------------- 1 | 2 | /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. 3 | 4 | Copyright 2007-2010 Thomas Schmitt, 5 | 6 | Provided under GPL version 2 or later. 7 | 8 | This file contains declarations of functions which perform the 9 | fundamental operations of the XorrisO object. 10 | */ 11 | 12 | 13 | #ifndef Xorriso_pvt_base_obj_includeD 14 | #define Xorriso_pvt_base_obj_includeD yes 15 | 16 | 17 | #ifdef NIX 18 | /* <<< */ 19 | unsigned long Xorriso_get_di_counteR= 0; 20 | #endif /* NIX */ 21 | 22 | struct XorrisO; 23 | 24 | 25 | int Xorriso_destroy_re(struct XorrisO *m, int flag); 26 | 27 | int Xorriso__get_signal_behavior(int flag); 28 | 29 | 30 | #endif /* ! Xorriso_pvt_base_obj_includeD */ 31 | 32 | -------------------------------------------------------------------------------- /xorriso/changelog.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Distrotech/xorriso/ee97ee61eec18ee36dae09593164cf71e5cdcc8b/xorriso/changelog.txt -------------------------------------------------------------------------------- /xorriso/cmp_update.h: -------------------------------------------------------------------------------- 1 | 2 | /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. 3 | 4 | Copyright 2007-2010 Thomas Schmitt, 5 | 6 | Provided under GPL version 2 or later. 7 | 8 | This file contains declarations of class DirseQ which 9 | crawls along a directory's content list. 10 | */ 11 | 12 | 13 | #ifndef Xorriso_pvt_cmp_includeD 14 | #define Xorriso_pvt_cmp_includeD yes 15 | 16 | int Xorriso_compare_2_files(struct XorrisO *xorriso, char *disk_adr, 17 | char *iso_adr, char *adr_common_tail, 18 | int *result, int flag); 19 | 20 | int Xorriso_pfx_disk_path(struct XorrisO *xorriso, char *iso_path, 21 | char *iso_prefix, char *disk_prefix, 22 | char disk_path[SfileadrL], int flag); 23 | 24 | /* @param boss_iter Opaque handle to be forwarded to actions in ISO image 25 | Set to NULL if calling this function from outside ISO world 26 | @param node Opaque handle to be forwarded to actions in ISO image 27 | Set to NULL if calling this function from outside ISO world 28 | @param flag bit0= update rather than compare 29 | */ 30 | int Xorriso_find_compare(struct XorrisO *xorriso, void *boss_iter, void *node, 31 | char *iso_path, char *iso_prefix, char *disk_prefix, 32 | int flag); 33 | 34 | /* @param boss_iter Opaque handle to be forwarded to actions in ISO image 35 | Set to NULL if calling this function from outside ISO world 36 | @param @node Opaque handle to be forwarded to actions in ISO image 37 | Set to NULL if calling this function from outside ISO world 38 | */ 39 | int Xorriso_update_interpreter(struct XorrisO *xorriso, 40 | void *boss_iter, void *node, 41 | int compare_result, char *disk_path, 42 | char *iso_rr_path, int flag); 43 | 44 | #endif /* ! Xorriso_pvt_cmp_includeD */ 45 | 46 | -------------------------------------------------------------------------------- /xorriso/drive_mgt.h: -------------------------------------------------------------------------------- 1 | 2 | /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. 3 | 4 | Copyright 2007-2010 Thomas Schmitt, 5 | 6 | Provided under GPL version 2 or later. 7 | 8 | This file contains declarations of functions which operate on drives 9 | and media. 10 | */ 11 | 12 | 13 | #ifndef Xorriso_pvt_drive_mgt_includeD 14 | #define Xorriso_pvt_drive_mgt_includeD yes 15 | 16 | 17 | int Xorriso_may_burn(struct XorrisO *xorriso, int flag); 18 | 19 | int Xorriso_toc_line(struct XorrisO *xorriso, int flag); 20 | 21 | int Xorriso_media_product(struct XorrisO *xorriso, int flag); 22 | 23 | int Xorriso_check_md5_range(struct XorrisO *xorriso, off_t start_lba, 24 | off_t end_lba, char md5[16], int flag); 25 | 26 | int Xorriso_check_interval(struct XorrisO *xorriso, struct SpotlisT *spotlist, 27 | struct CheckmediajoB *job, 28 | int from_lba, int block_count, int read_chunk, 29 | int md5_start, int flag); 30 | 31 | int Xorriso_get_drive_handles(struct XorrisO *xorriso, 32 | struct burn_drive_info **dinfo, 33 | struct burn_drive **drive, 34 | char *attempt, int flag); 35 | 36 | int Xorriso_check_for_abort(struct XorrisO *xorriso, 37 | char *abort_file_path, 38 | double post_read_time, 39 | double *last_abort_file_time, int flag); 40 | 41 | #endif /* ! Xorriso_pvt_drive_mgt_includeD */ 42 | 43 | -------------------------------------------------------------------------------- /xorriso/emulators.h: -------------------------------------------------------------------------------- 1 | 2 | /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. 3 | 4 | Copyright 2007-2010 Thomas Schmitt, 5 | 6 | Provided under GPL version 2 or later. 7 | 8 | This file contains declarations of emulators for mkisofs and cdrecord. 9 | */ 10 | 11 | 12 | #ifndef Xorriso_pvt_emul_includeD 13 | #define Xorriso_pvt_emul_includeD yes 14 | 15 | /* micro version of cdrskin */ 16 | int Xorriso_cdrskin(struct XorrisO *xorriso, char *whom, int argc, char **argv, 17 | int flag); 18 | 19 | int Xorriso_cdrskin_help(struct XorrisO *xorriso, int flag); 20 | 21 | int Xorriso_cdrskin_uses_stdout(struct XorrisO *xorriso, int argc, char **argv, 22 | int flag); 23 | 24 | int Xorriso_as_cdrskin(struct XorrisO *xorriso, int argc, char **argv, 25 | int *idx, int flag); 26 | 27 | /* micro emulation of mkisofs */ 28 | int Xorriso_genisofs(struct XorrisO *xorriso, char *whom, 29 | int argc, char **argv, int flag); 30 | 31 | int Xorriso_genisofs_help(struct XorrisO *xorriso, int flag); 32 | 33 | int Xorriso_as_genisofs(struct XorrisO *xorriso, int argc, char **argv, 34 | int *idx, int flag); 35 | 36 | #endif /* ! Xorriso_pvt_emul_includeD */ 37 | 38 | -------------------------------------------------------------------------------- /xorriso/filters.h: -------------------------------------------------------------------------------- 1 | 2 | /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. 3 | 4 | Copyright 2007-2010 Thomas Schmitt, 5 | 6 | Provided under GPL version 2 or later. 7 | 8 | This file contains declarations of functions which operate on 9 | data filter objects. 10 | */ 11 | 12 | 13 | #ifndef Xorriso_pvt_filters_includeD 14 | #define Xorriso_pvt_filters_includeD yes 15 | 16 | int Xorriso_extf_new(struct XorrisO *xorriso, struct Xorriso_extF **filter, 17 | char *path, int argc, char **argv, int behavior, 18 | char *suffix, char *name, int flag); 19 | 20 | int Xorriso_extf_destroy(struct XorrisO *xorriso, struct Xorriso_extF **filter, 21 | int flag); 22 | 23 | int Xorriso_lookup_extf(struct XorrisO *xorriso, char *name, 24 | struct Xorriso_lsT **found_lst, int flag); 25 | 26 | int Xorriso_rename_suffix(struct XorrisO *xorriso, IsoNode *node, char *suffix, 27 | char *show_path, char new_name[], int flag); 28 | 29 | 30 | #endif /* ! Xorriso_pvt_filters_includeD */ 31 | 32 | -------------------------------------------------------------------------------- /xorriso/iso_img.h: -------------------------------------------------------------------------------- 1 | 2 | /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. 3 | 4 | Copyright 2007-2010 Thomas Schmitt, 5 | 6 | Provided under GPL version 2 or later. 7 | 8 | This file contains declarations of functions which operate on ISO images 9 | and their global properties. 10 | */ 11 | 12 | 13 | #ifndef Xorriso_pvt_iso_img_includeD 14 | #define Xorriso_pvt_iso_img_includeD yes 15 | 16 | 17 | int Xorriso_update_volid(struct XorrisO *xorriso, int flag); 18 | 19 | int Xorriso_record_boot_info(struct XorrisO *xorriso, int flag); 20 | 21 | int Xorriso_assert_volid(struct XorrisO *xorriso, int msc1, int flag); 22 | 23 | int Xorriso_is_isohybrid(struct XorrisO *xorriso, IsoFile *bootimg_node, 24 | int flag); 25 | 26 | int Xorriso_boot_item_status(struct XorrisO *xorriso, char *cat_path, 27 | char *bin_path, int platform_id, 28 | int patch_isolinux, int emul, off_t load_size, 29 | unsigned char *id_string, 30 | unsigned char *selection_crit, char *form, 31 | char *filter, FILE *fp, int flag); 32 | 33 | int Xorriso__append_boot_params(char *line, ElToritoBootImage *bootimg, 34 | int flag); 35 | 36 | int Xorriso_get_volume(struct XorrisO *xorriso, IsoImage **volume, 37 | int flag); 38 | 39 | 40 | 41 | 42 | 43 | #endif /* ! Xorriso_pvt_iso_img_includeD */ 44 | 45 | -------------------------------------------------------------------------------- /xorriso/iso_manip.h: -------------------------------------------------------------------------------- 1 | 2 | /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. 3 | 4 | Copyright 2007-2010 Thomas Schmitt, 5 | 6 | Provided under GPL version 2 or later. 7 | 8 | This file contains declarations of functions which manipulate the 9 | libisofs tree model. 10 | */ 11 | 12 | 13 | #ifndef Xorriso_pvt_iso_manip_includeD 14 | #define Xorriso_pvt_iso_manip_includeD yes 15 | 16 | 17 | int Xorriso_transfer_properties(struct XorrisO *xorriso, struct stat *stbuf, 18 | char *disk_path, IsoNode *node, int flag); 19 | 20 | int Xorriso_graft_split(struct XorrisO *xorriso, IsoImage *volume, 21 | IsoDir *dir, char *disk_path, char *img_name, 22 | char *nominal_source, char *nominal_target, 23 | off_t size, IsoNode **node, int flag); 24 | 25 | int Xorriso_tree_graft_node(struct XorrisO *xorriso, IsoImage *volume, 26 | IsoDir *dir, char *disk_path, char *img_name, 27 | char *nominal_source, char *nominal_target, 28 | off_t offset, off_t cut_size, 29 | IsoNode **node, int flag); 30 | 31 | int Xorriso_add_tree(struct XorrisO *xorriso, IsoDir *dir, 32 | char *img_dir_path, char *disk_dir_path, 33 | struct LinkiteM *link_stack, int flag); 34 | 35 | int Xorriso_copy_implicit_properties(struct XorrisO *xorriso, IsoDir *dir, 36 | char *full_img_path, char *img_path, char *full_disk_path, int flag); 37 | 38 | int Xorriso_mkisofs_lower_r(struct XorrisO *xorriso, IsoNode *node, int flag); 39 | 40 | int Xorriso_widen_hardlink(struct XorrisO *xorriso, void * boss_iter, 41 | IsoNode *node, 42 | char *abs_path, char *iso_prefix, char *disk_prefix, 43 | int flag); 44 | 45 | 46 | int Xorriso_cannot_create_iter(struct XorrisO *xorriso, int iso_error, 47 | int flag); 48 | 49 | int Xorriso_findi_iter(struct XorrisO *xorriso, IsoDir *dir_node, off_t *mem, 50 | IsoDirIter **iter, 51 | IsoNode ***node_array, int *node_count, int *node_idx, 52 | IsoNode **iterated_node, int flag); 53 | 54 | int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job, 55 | IsoDirIter *boss_iter, off_t boss_mem, 56 | char *abs_path, char *show_path, 57 | IsoNode *node, int depth, int flag); 58 | 59 | int Xorriso_findi_headline(struct XorrisO *xorriso, struct FindjoB *job, 60 | int flag); 61 | 62 | int Xorriso_findi_sorted(struct XorrisO *xorriso, struct FindjoB *job, 63 | off_t boss_mem, int filec, char **filev, int flag); 64 | 65 | int Xorriso_all_node_array(struct XorrisO *xorriso, int addon_nodes, int flag); 66 | 67 | 68 | int Xorriso__file_start_lba(IsoNode *node, int *lba, int flag); 69 | 70 | int Xorriso__mark_update_xinfo(void *data, int flag); 71 | int Xorriso__mark_update_cloner(void *old_data, void **new_data, int flag); 72 | 73 | int Xorriso_get_blessing(struct XorrisO *xorriso, IsoNode *node, 74 | int *bless_idx, char bless_code[17], int flag); 75 | 76 | #endif /* ! Xorriso_pvt_iso_manip_includeD */ 77 | 78 | -------------------------------------------------------------------------------- /xorriso/iso_tree.h: -------------------------------------------------------------------------------- 1 | 2 | /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. 3 | 4 | Copyright 2007-2011 Thomas Schmitt, 5 | 6 | Provided under GPL version 2 or later. 7 | 8 | This file contains declarations of functions which access nodes of the 9 | libisofs tree model. 10 | */ 11 | 12 | 13 | #ifndef Xorriso_pvt_iso_tree_includeD 14 | #define Xorriso_pvt_iso_tree_includeD yes 15 | 16 | 17 | #define LIBISO_ISDIR(node) (iso_node_get_type(node) == LIBISO_DIR) 18 | #define LIBISO_ISREG(node) (iso_node_get_type(node) == LIBISO_FILE) 19 | #define LIBISO_ISLNK(node) (iso_node_get_type(node) == LIBISO_SYMLINK) 20 | #define LIBISO_ISCHR(node) (iso_node_get_type(node) == LIBISO_SPECIAL && \ 21 | S_ISCHR(iso_node_get_mode(node))) 22 | #define LIBISO_ISBLK(node) (iso_node_get_type(node) == LIBISO_SPECIAL && \ 23 | S_ISBLK(iso_node_get_mode(node))) 24 | #define LIBISO_ISFIFO(node) (iso_node_get_type(node) == LIBISO_SPECIAL && \ 25 | S_ISFIFO(iso_node_get_mode(node))) 26 | #define LIBISO_ISSOCK(node) (iso_node_get_type(node) == LIBISO_SPECIAL && \ 27 | S_ISSOCK(iso_node_get_mode(node))) 28 | #define LIBISO_ISBOOT(node) (iso_node_get_type(node) == LIBISO_BOOT) 29 | 30 | 31 | int Xorriso_node_from_path(struct XorrisO *xorriso, IsoImage *volume, 32 | char *path, IsoNode **node, int flag); 33 | 34 | int Xorriso_get_node_by_path(struct XorrisO *xorriso, 35 | char *in_path, char *eff_path, 36 | IsoNode **node, int flag); 37 | 38 | int Xorriso_dir_from_path(struct XorrisO *xorriso, char *purpose, 39 | char *path, IsoDir **dir_node, int flag); 40 | 41 | int Xorriso_node_get_dev(struct XorrisO *xorriso, IsoNode *node, 42 | char *path, dev_t *dev, int flag); 43 | 44 | int Xorriso_fake_stbuf(struct XorrisO *xorriso, char *path, struct stat *stbuf, 45 | IsoNode **node, int flag); 46 | 47 | int Xorriso_node_is_valid(struct XorrisO *xorriso, IsoNode *in_node, int flag); 48 | 49 | int Xorriso_path_from_node(struct XorrisO *xorriso, IsoNode *in_node, 50 | char path[SfileadrL], int flag); 51 | 52 | int Xorriso_path_from_lba(struct XorrisO *xorriso, IsoNode *node, int lba, 53 | char path[SfileadrL], int flag); 54 | 55 | int Xorriso_get_attr_value(struct XorrisO *xorriso, void *in_node, char *path, 56 | char *name, size_t *value_length, char **value, int flag); 57 | 58 | int Xorriso_stream_type(struct XorrisO *xorriso, IsoNode *node, 59 | IsoStream *stream, char type_text[], int flag); 60 | 61 | 62 | int Xorriso_show_du_subs(struct XorrisO *xorriso, IsoDir *dir_node, 63 | char *abs_path, char *rel_path, off_t *size, 64 | off_t boss_mem, int flag); 65 | 66 | int Xorriso_sorted_dir_i(struct XorrisO *xorriso, IsoDir *dir_node, 67 | int *filec, char ***filev, off_t boss_mem, int flag); 68 | 69 | int Xorriso_obtain_pattern_files_i( 70 | struct XorrisO *xorriso, char *wd, IsoDir *dir, 71 | int *filec, char **filev, int count_limit, off_t *mem, 72 | int *dive_count, int flag); 73 | 74 | int Xorriso__start_end_lbas(IsoNode *node, 75 | int *lba_count, int **start_lbas, int **end_lbas, 76 | off_t *size, int flag); 77 | 78 | int Xorriso__file_start_lba(IsoNode *node, 79 | int *lba, int flag); 80 | 81 | int Xorriso_file_eval_damage(struct XorrisO *xorriso, IsoNode *node, 82 | off_t *damage_start, off_t *damage_end, 83 | int flag); 84 | 85 | int Xorriso_report_lba(struct XorrisO *xorriso, char *show_path, 86 | IsoNode *node, int flag); 87 | 88 | int Xorriso_report_damage(struct XorrisO *xorriso, char *show_path, 89 | IsoNode *node, int flag); 90 | 91 | int Xorriso_getfname(struct XorrisO *xorriso, char *path, int flag); 92 | 93 | int Xorriso_retrieve_disk_path(struct XorrisO *xorriso, IsoNode *node, 94 | char disk_path[SfileadrL], int flag); 95 | 96 | #endif /* ! Xorriso_pvt_iso_tree_includeD */ 97 | 98 | -------------------------------------------------------------------------------- /xorriso/lib_mgt.h: -------------------------------------------------------------------------------- 1 | 2 | /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. 3 | 4 | Copyright 2007-2010 Thomas Schmitt, 5 | 6 | Provided under GPL version 2 or later. 7 | 8 | This file contains declarations of functions which manage the relation 9 | between xorriso and the libraries: libburn, libisofs, and libisoburn. 10 | */ 11 | 12 | 13 | #ifndef Xorriso_pvt_x_includeD 14 | #define Xorriso_pvt_x_includeD yes 15 | 16 | 17 | #ifndef Xorriso_standalonE 18 | 19 | /* The library which does the ISO 9660 / RockRidge manipulations */ 20 | #include 21 | 22 | /* The library which does MMC optical drive operations */ 23 | #include 24 | 25 | /* The library which enhances overwriteable media with ISO 9660 multi-session 26 | capabilities via the method invented by Andy Polyakov for growisofs */ 27 | #include 28 | 29 | /* The official xorriso options API. "No shortcuts" */ 30 | #include "xorriso.h" 31 | 32 | /* The inner description of XorrisO */ 33 | #include "xorriso_private.h" 34 | 35 | /* The inner isofs- and burn-library interface */ 36 | #include "xorrisoburn.h" 37 | 38 | #else /* ! Xorriso_standalonE */ 39 | 40 | #include "../libisofs/libisofs.h" 41 | #include "../libburn/libburn.h" 42 | #include "../libisoburn/libisoburn.h" 43 | #include "xorriso.h" 44 | #include "xorriso_private.h" 45 | #include "xorrisoburn.h" 46 | 47 | #endif /* Xorriso_standalonE */ 48 | 49 | 50 | int Xorriso_abort(struct XorrisO *xorriso, int flag); 51 | 52 | 53 | /* @param flag bit0= suppress messages below UPDATE 54 | bit1= suppress messages below FAILURE 55 | */ 56 | int Xorriso_set_image_severities(struct XorrisO *xorriso, int flag); 57 | 58 | int Xorriso__sev_to_text(int severity, char **severity_name, 59 | int flag); 60 | 61 | /* @param flag bit0= report libisofs error text 62 | bit1= victim is disk_path 63 | bit2= do not inquire libisofs, report msg_text and min_severity 64 | */ 65 | int Xorriso_report_iso_error(struct XorrisO *xorriso, char *victim, 66 | int iso_error_code, char msg_text[], int os_errno, 67 | char min_severity[], int flag); 68 | 69 | int Xorriso_process_msg_queues(struct XorrisO *xorriso, int flag); 70 | 71 | 72 | #endif /* ! Xorriso_pvt_x_includeD */ 73 | 74 | -------------------------------------------------------------------------------- /xorriso/make_docs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Produce man page xorriso/xorriso.1 and info file xorriso/xorriso.info 4 | # from base file xorriso/xorriso.texi. 5 | # Same for xorriso/xorrisofs.texi and xorriso/xorrecord.texi. 6 | 7 | ( cd xorriso ; makeinfo ./xorriso.texi ) 8 | ( cd xorriso ; makeinfo ./xorrisofs.texi ) 9 | ( cd xorriso ; makeinfo ./xorrecord.texi ) 10 | 11 | xorriso/make_xorriso_1 -auto 12 | xorriso/make_xorriso_1 -auto -xorrisofs 13 | xorriso/make_xorriso_1 -auto -xorrecord 14 | 15 | 16 | -------------------------------------------------------------------------------- /xorriso/match.h: -------------------------------------------------------------------------------- 1 | 2 | /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. 3 | 4 | Copyright 2007-2010 Thomas Schmitt, 5 | 6 | Provided under GPL version 2 or later. 7 | 8 | This file contains the implementation of functions for pattern matching. 9 | */ 10 | 11 | 12 | #ifndef Xorriso_pvt_match_includeD 13 | #define Xorriso_pvt_match_includeD yes 14 | 15 | 16 | int Xorriso_prepare_regex(struct XorrisO *xorriso, char *adr, int flag); 17 | 18 | /* @return 0=match , else no match 19 | */ 20 | int Xorriso_regexec(struct XorrisO *xorriso, char *to_match, int *failed_at, 21 | int flag); 22 | 23 | int Xorriso_is_in_patternlist(struct XorrisO *xorriso, 24 | struct Xorriso_lsT *patternlist, char *path, int flag); 25 | 26 | char *Xorriso_get_pattern(struct XorrisO *xorriso, 27 | struct Xorriso_lsT *patternlist, int index, int flag); 28 | 29 | int Xorriso_prepare_expansion_pattern(struct XorrisO *xorriso, char *pattern, 30 | int flag); 31 | 32 | /* @param flag bit0= count results rather than storing them 33 | @return <=0 error , 1 is root (end processing) , 34 | 2 is not root (go on processing) 35 | */ 36 | int Xorriso_check_for_root_pattern(struct XorrisO *xorriso, 37 | int *filec, char **filev, int count_limit, off_t *mem, int flag); 38 | 39 | /* @param flag bit0= count result rather than storing it 40 | bit1= unexpected change of number is a FATAL event 41 | */ 42 | int Xorriso_register_matched_adr(struct XorrisO *xorriso, 43 | char *adr, int count_limit, 44 | int *filec, char **filev, off_t *mem, int flag); 45 | 46 | int Xorriso_eval_nonmatch(struct XorrisO *xorriso, char *pattern, 47 | int *nonconst_mismatches, off_t *mem, int flag); 48 | 49 | /* @param flag bit0= a match count !=1 is a SORRY event 50 | */ 51 | int Xorriso_check_matchcount(struct XorrisO *xorriso, 52 | int count, int nonconst_mismatches, int num_patterns, 53 | char **patterns, int flag); 54 | 55 | int Xorriso_no_pattern_memory(struct XorrisO *xorriso, off_t mem, int flag); 56 | 57 | int Xorriso_alloc_pattern_mem(struct XorrisO *xorriso, off_t mem, 58 | int count, char ***filev, int flag); 59 | 60 | /* @param flag bit0= command without pattern capability 61 | bit1= disk_pattern rather than iso_rr_pattern 62 | */ 63 | int Xorriso_warn_of_wildcards(struct XorrisO *xorriso, char *path, int flag); 64 | 65 | /* @param flag bit0= a match count !=1 is a FAILURE event 66 | bit1= with bit0 tolerate 0 matches if pattern is a constant 67 | */ 68 | int Xorriso_expand_disk_pattern(struct XorrisO *xorriso, 69 | int num_patterns, char **patterns, int extra_filec, 70 | int *filec, char ***filev, off_t *mem, int flag); 71 | 72 | 73 | #endif /* ! Xorriso_pvt_match_includeD */ 74 | 75 | -------------------------------------------------------------------------------- /xorriso/misc_funct.h: -------------------------------------------------------------------------------- 1 | 2 | /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. 3 | 4 | Copyright 2007-2012 Thomas Schmitt, 5 | 6 | Provided under GPL version 2 or later. 7 | 8 | This file contains declarations of cellaneous helper functions of xorriso. 9 | */ 10 | 11 | 12 | #ifndef Xorriso_pvt_misc_includeD 13 | #define Xorriso_pvt_misc_includeD yes 14 | 15 | #include 16 | 17 | 18 | char *Text_shellsafe(char *in_text, char *out_text, int flag); 19 | 20 | int Sort_argv(int argc, char **argv, int flag); 21 | 22 | /* @param flag bit0= single letters */ 23 | char *Ftypetxt(mode_t st_mode, int flag); 24 | 25 | /* @param flag bit0=with year and seconds 26 | bit1=timestamp format YYYY.MM.DD.hhmmss 27 | */ 28 | char *Ftimetxt(time_t t, char timetext[40], int flag); 29 | 30 | int System_uname(char **sysname, char **release, char **version, 31 | char **machine, int flag); 32 | 33 | /** Convert a text into a number of type double and multiply it by unit code 34 | [kmgtpe] (2^10 to 2^60) or [s] (2048). (Also accepts capital letters.) 35 | @param text Input like "42", "2k", "3.14m" or "-1g" 36 | @param flag Bitfield for control purposes: 37 | bit0= return -1 rathern than 0 on failure 38 | @return The derived double value 39 | */ 40 | double Scanf_io_size(char *text, int flag); 41 | 42 | /* 43 | @flag bit0= do not initialize *diff_count 44 | @return <0 error , 0 = mismatch , 1 = match 45 | */ 46 | int Compare_text_lines(char *text1, char *text2, int *diff_count, int flag); 47 | 48 | time_t Decode_timestring(char *code, time_t *date, int flag); 49 | 50 | int Decode_ecma119_format(struct tm *erg, char *text, int flag); 51 | 52 | int Wait_for_input(int fd, int microsec, int flag); 53 | 54 | int Fileliste__target_source_limit(char *line, char sep, char **limit_pt, 55 | int flag); 56 | 57 | int Fileliste__escape_source_path(char *line, int size, int flag); 58 | 59 | int Hex_to_bin(char *hex, 60 | int bin_size, int *bin_count, unsigned char *bin_data, int flag); 61 | 62 | 63 | /* bit0= append (text!=NULL) */ 64 | int Sregex_string(char **handle, char *text, int flag); 65 | 66 | /* @param flag bit0= only test expression whether compilable 67 | */ 68 | int Sregex_match(char *pattern, char *text, int flag); 69 | 70 | /* 71 | vars[][0] points to the variable names, vars[][1] to their contents. 72 | start marks the begin of variable names. It must be non-empty. esc before 73 | start disables this meaning. start and esc may be equal but else they must 74 | have disjoint character sets. 75 | end marks the end of a variable name. It may be empty but if non-empty it 76 | must not appear in vars[][0]. 77 | @param flag bit0= Substitute unknown variables by empty text 78 | (else copy start,name,end unaltered to result). 79 | Parameter end must be non-empty for that. 80 | */ 81 | int Sregex_resolve_var(char *form, char *vars[][2], int num_vars, 82 | char *start, char *end, char *esc, 83 | char *result, int result_size, int flag); 84 | 85 | /* reg_expr should be twice as large as bourne_expr ( + 2 to be exact) */ 86 | /* return: 2= bourne_expr is surely a constant */ 87 | int Xorriso__bourne_to_reg(char bourne_expr[], char reg_expr[], int flag); 88 | 89 | 90 | int Xorriso__hide_mode(char *mode, int flag); 91 | 92 | char *Xorriso__hide_mode_text(int hide_mode, int flag); 93 | 94 | /* @return 0=truncated, 1=ok 95 | */ 96 | int Xorriso__to_upper(char *in, char *out, int out_size, int flag); 97 | 98 | #endif /* ! Xorriso_pvt_misc_includeD */ 99 | 100 | -------------------------------------------------------------------------------- /xorriso/parse_exec.h: -------------------------------------------------------------------------------- 1 | 2 | /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. 3 | 4 | Copyright 2007-2010 Thomas Schmitt, 5 | 6 | Provided under GPL version 2 or later. 7 | 8 | This file contains declarations of functions which deal with parsing 9 | and interpretation of command input. 10 | */ 11 | 12 | 13 | #ifndef Xorriso_pvt_cmd_includeD 14 | #define Xorriso_pvt_cmd_includeD yes 15 | 16 | 17 | /* @param flag bit0= do not warn of wildcards 18 | bit1= these are disk_paths 19 | */ 20 | int Xorriso_end_idx(struct XorrisO *xorriso, 21 | int argc, char **argv, int idx, int flag); 22 | 23 | int Xorriso_opt_args(struct XorrisO *xorriso, char *cmd, 24 | int argc, char **argv, int idx, 25 | int *end_idx, int *optc, char ***optv, int flag); 26 | 27 | int Xorriso_get_problem_status(struct XorrisO *xorriso, char severity[80], 28 | int flag); 29 | 30 | int Xorriso_set_problem_status(struct XorrisO *xorriso, char *severity, 31 | int flag); 32 | 33 | /** 34 | @param flag bit0= do not issue own event messages 35 | bit1= take xorriso->request_to_abort as reason for abort 36 | @return Gives the advice: 37 | 2= pardon was given, go on 38 | 1= no problem, go on 39 | 0= function failed but xorriso would not abort, go on 40 | <0= do abort 41 | -1 = due to problem_status 42 | -2 = due to xorriso->request_to_abort 43 | */ 44 | int Xorriso_eval_problem_status(struct XorrisO *xorriso, int ret, int flag); 45 | 46 | int Xorriso_cpmv_args(struct XorrisO *xorriso, char *cmd, 47 | int argc, char **argv, int *idx, 48 | int *optc, char ***optv, char eff_dest[SfileadrL], 49 | int flag); 50 | 51 | /* @param flag bit0= with adr_mode sbsector: adr_value is possibly 16 too high 52 | */ 53 | int Xorriso_decode_load_adr(struct XorrisO *xorriso, char *cmd, 54 | char *adr_mode, char *adr_value, 55 | int *entity_code, char entity_id[81], 56 | int flag); 57 | 58 | int Xorriso_check_name_len(struct XorrisO *xorriso, char *name, int size, 59 | char *cmd, int flag); 60 | 61 | /* @param flag bit0= prepend wd only if name does not begin by '/' 62 | bit2= prepend wd (automatically done if wd[0]!=0) 63 | */ 64 | int Xorriso_make_abs_adr(struct XorrisO *xorriso, char *wd, char *name, 65 | char adr[], int flag); 66 | 67 | /* @param flag bit0= do not complain in case of error, but set info_text */ 68 | int Xorriso_convert_datestring(struct XorrisO *xorriso, char *cmd, 69 | char *time_type, char *timestring, 70 | int *t_type, time_t *t, int flag); 71 | 72 | int Xorriso_check_temp_mem_limit(struct XorrisO *xorriso, off_t mem, int flag); 73 | 74 | /* @param flag bit0= use env_path to find the desired program 75 | */ 76 | int Xorriso_execv(struct XorrisO *xorriso, char *cmd, char *env_path, 77 | int *status, int flag); 78 | 79 | int Xorriso_path_is_excluded(struct XorrisO *xorriso, char *path, int flag); 80 | 81 | int Xorriso_path_is_hidden(struct XorrisO *xorriso, char *path, int flag); 82 | 83 | 84 | /* Normalize ACL and sort apart "access" ACL from "default" ACL. 85 | */ 86 | int Xorriso_normalize_acl_text(struct XorrisO *xorriso, char *in_text, 87 | char **access_acl_text, char **default_acl_text, int flag); 88 | 89 | int Xorriso_read_mkisofsrc(struct XorrisO *xorriso, int flag); 90 | 91 | /* @param flag bit0= list sorting order rather than looking for argv[idx] 92 | */ 93 | int Xorriso_cmd_sorting_rank(struct XorrisO *xorriso, 94 | int argc, char **argv, int idx, int flag); 95 | 96 | #endif /* ! Xorriso_pvt_cmd_includeD */ 97 | 98 | -------------------------------------------------------------------------------- /xorriso/read_run.h: -------------------------------------------------------------------------------- 1 | 2 | /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. 3 | 4 | Copyright 2007-2010 Thomas Schmitt, 5 | 6 | Provided under GPL version 2 or later. 7 | 8 | This file contains declarations of functions which 9 | */ 10 | 11 | 12 | #ifndef Xorriso_pvt_read_run_includeD 13 | #define Xorriso_pvt_read_run_includeD yes 14 | 15 | 16 | int Xorriso__read_pacifier(IsoImage *image, IsoFileSource *filesource); 17 | 18 | int Xorriso_restore_properties(struct XorrisO *xorriso, char *disk_path, 19 | IsoNode *node, int flag); 20 | 21 | int Xorriso_restore_implicit_properties(struct XorrisO *xorriso, 22 | char *full_disk_path, char *disk_path, char *full_img_path, int flag); 23 | 24 | int Xorriso_tree_restore_node(struct XorrisO *xorriso, IsoNode *node, 25 | char *img_path, off_t img_offset, 26 | char *disk_path, off_t disk_offset, off_t bytes, 27 | int flag); 28 | 29 | int Xorriso_restore_overwrite(struct XorrisO *xorriso, 30 | IsoNode *node, char *img_path, 31 | char *path, char *nominal_path, 32 | struct stat *stbuf, int flag); 33 | 34 | int Xorriso_restore_target_hl(struct XorrisO *xorriso, IsoNode *node, 35 | char *disk_path, int *node_idx, int flag); 36 | 37 | int Xorriso_restore_prefix_hl(struct XorrisO *xorriso, IsoNode *node, 38 | char *disk_path, int node_idx, int flag); 39 | 40 | int Xorriso_register_node_target(struct XorrisO *xorriso, int node_idx, 41 | char *disk_path, int flag); 42 | 43 | int Xorriso_restore_disk_object(struct XorrisO *xorriso, 44 | char *img_path, IsoNode *node, 45 | char *disk_path, 46 | off_t offset, off_t bytes, int flag); 47 | 48 | int Xorriso_handle_collision(struct XorrisO *xorriso, 49 | IsoNode *node, char *img_path, 50 | char *disk_path, char *nominal_disk_path, 51 | int *stbuf_ret, int flag); 52 | 53 | int Xorriso_restore_tree(struct XorrisO *xorriso, IsoDir *dir, 54 | char *img_dir_path, char *disk_dir_path, 55 | off_t boss_mem, 56 | struct LinkiteM *link_stack, int flag); 57 | 58 | int Xorriso_read_file_data(struct XorrisO *xorriso, IsoNode *node, 59 | char *img_path, char *disk_path, 60 | off_t img_offset, off_t disk_offset, 61 | off_t bytes, int flag); 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | #endif /* ! Xorriso_pvt_read_run_includeD */ 70 | 71 | -------------------------------------------------------------------------------- /xorriso/sfile.h: -------------------------------------------------------------------------------- 1 | 2 | /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. 3 | 4 | Copyright 2007-2012 Thomas Schmitt, 5 | 6 | Provided under GPL version 2 or later. 7 | 8 | This file contains declarations of functions around files and strings. 9 | */ 10 | 11 | 12 | #ifndef Xorriso_pvt_sfile_includeD 13 | #define Xorriso_pvt_sfile_includeD yes 14 | 15 | #define TSOB_FELD(typ, count) (typ *) calloc(1, (count)*sizeof(typ)); 16 | #define Smem_malloC malloc 17 | #define Smem_freE free 18 | 19 | #define Xorriso_alloc_meM(pt, typ, count) { \ 20 | pt= (typ *) calloc(1, (count) * sizeof(typ)); \ 21 | if(pt == NULL) { \ 22 | Xorriso_no_malloc_memory(xorriso, NULL, 0); \ 23 | ret= -1; \ 24 | goto ex; \ 25 | } } 26 | 27 | #define Xorriso_free_meM(pt) { \ 28 | if(pt != NULL) \ 29 | free((char *) pt); \ 30 | } 31 | 32 | 33 | #define SfileadrL 4096 34 | 35 | 36 | int Sfile_str(char target[SfileadrL], char *source, int flag); 37 | 38 | double Sfile_microtime(int flag); 39 | 40 | int Sfile_add_to_path(char path[SfileadrL], char *addon, int flag); 41 | 42 | int Sfile_scale(double value, char *result, int siz, double thresh, int flag); 43 | 44 | int Sfile_destroy_argv(int *argc, char ***argv, int flag); 45 | 46 | int Sfile_count_char(char *text, char to_count); 47 | 48 | 49 | /* 50 | bit0= do not ignore trailing slash 51 | bit1= do not ignore empty components (other than the empty root name) 52 | */ 53 | int Sfile_count_components(char *path, int flag); 54 | 55 | /* 56 | @param flag 57 | bit0= return -1 if file is missing 58 | bit1= return a hardlink with siblings as type 5 59 | bit2= evaluate eventual link target rather than the link object itself 60 | bit3= return a socket or a char device as types 7 or 8 rather than 0 61 | @return 62 | 0=unknown 63 | 1=regular 64 | 2=directory 65 | 3=symbolic link 66 | 4=named pipe 67 | 5=multiple hardlink (with bit1) 68 | 6=block device 69 | 7=socket (with bit3) 70 | 8=character device (with bit3) 71 | */ 72 | int Sfile_type(char *filename, int flag); 73 | 74 | /* @param flag bit0= only encode inside quotes 75 | bit1= encode < 32 outside quotes except 7, 8, 9, 10, 12, 13 76 | bit2= encode in any case above 126 77 | bit3= encode in any case shellsafe: 78 | <=42 , 59, 60, 62, 63, 92, 94, 96, >=123 79 | */ 80 | int Sfile_bsl_encoder(char **result, char *text, size_t text_len, int flag); 81 | 82 | int Sfile_argv_bsl(int argc, char ***argv, int flag); 83 | 84 | /* 85 | bit0= read progname as first argument from line 86 | bit1= just release argument list argv and return 87 | bit2= abort with return(0) if incomplete quotes are found 88 | bit3= eventually prepend missing '-' to first argument read from line 89 | bit4= like bit2 but only check quote completeness, do not allocate memory 90 | bit5+6= interpretation of backslashes: 91 | 0= no interpretation, leave unchanged 92 | 1= only inside double quotes 93 | 2= outside single quotes 94 | 3= everywhere 95 | bit7= append a NULL element to argv 96 | */ 97 | int Sfile_make_argv(char *progname, char *line, int *argc, char ***argv, 98 | int flag); 99 | int Sfile_sep_make_argv(char *progname, char *line, char *separators, 100 | int max_argc, int *argc, char ***argv, int flag); 101 | 102 | /* YYMMDD[.hhmm[ss]] */ 103 | int Sfile_decode_datestr(struct tm *reply, char *text, int flag); 104 | 105 | int Sfile_off_t_text(char text[80], off_t num, int flag); 106 | 107 | int Sfile_leafname(char *path, char leafname[SfileadrL], int flag); 108 | 109 | /* @param flag bit0= do not clip of carriage return at line end 110 | */ 111 | char *Sfile_fgets_n(char *line, int maxl, FILE *fp, int flag); 112 | 113 | /* 114 | bit0=with hours+minutes 115 | bit1=with seconds 116 | 117 | bit8= local time rather than UTC 118 | */ 119 | char *Sfile_datestr(time_t tim, short int flag); 120 | 121 | /* Converts backslash codes into single characters: 122 | \a BEL 7 , \b BS 8 , \e ESC 27 , \f FF 12 , \n LF 10 , \r CR 13 , 123 | \t HT 9 , \v VT 11 , \\ \ 92 124 | \[0-9][0-9][0-9] octal code , \x[0-9a-f][0-9a-f] hex code , 125 | \cX control-x (ascii(X)-64) 126 | @param upto maximum number of characters to examine for backslash. 127 | The scope of a backslash (0 to 3 characters) is not affected. 128 | @param eaten returns the difference in length between input and output 129 | @param flag bit0= only determine *eaten, do not convert 130 | bit1= allow to convert \000 to binary 0 131 | */ 132 | int Sfile_bsl_interpreter(char *text, int upto, int *eaten, int flag); 133 | 134 | int Sfile_prepend_path(char *prefix, char path[SfileadrL], int flag); 135 | 136 | int Sfile_home_adr_s(char *filename, char *fileadr, int fa_size, int flag); 137 | 138 | 139 | #endif /* ! Xorriso_pvt_sfile_includeD */ 140 | 141 | -------------------------------------------------------------------------------- /xorriso/sort_cmp.h: -------------------------------------------------------------------------------- 1 | 2 | /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. 3 | 4 | Copyright 2007-2010 Thomas Schmitt, 5 | 6 | Provided under GPL version 2 or later. 7 | 8 | This file contains declarations of functions which sort and compare 9 | tree nodes. 10 | */ 11 | 12 | 13 | #ifndef Xorriso_pvt_sort_cmp_includeD 14 | #define Xorriso_pvt_sort_cmp_includeD yes 15 | 16 | 17 | int Xorriso__findi_sorted_ino_cmp(const void *p1, const void *p2); 18 | 19 | int Xorriso__hln_cmp(const void *p1, const void *p2); 20 | 21 | int Xorriso__findi_sorted_cmp(const void *p1, const void *p2); 22 | 23 | int Xorriso__search_node(void *node_array[], int n, 24 | int (*cmp)(const void *p1, const void *p2), 25 | void *node, int *idx, int flag); 26 | 27 | int Xorriso_search_in_hln_array(struct XorrisO *xorriso, 28 | void *node, int *idx, int flag); 29 | 30 | int Xorriso__get_di(IsoNode *node, dev_t *dev, ino_t *ino, int flag); 31 | 32 | int Xorriso__di_ino_cmp(const void *p1, const void *p2); 33 | 34 | int Xorriso__di_cmp(const void *p1, const void *p2); 35 | 36 | int Xorriso__sort_di(void *node_array[], int count, int flag); 37 | 38 | int Xorriso_invalidate_di_item(struct XorrisO *xorriso, IsoNode *node, 39 | int flag); 40 | 41 | int Xorriso_search_di_range(struct XorrisO *xorriso, IsoNode *node, 42 | int *idx, int *low, int *high, int flag); 43 | 44 | int Xorriso__node_lba_cmp(const void *node1, const void *node2); 45 | 46 | int Xorriso__node_name_cmp(const void *node1, const void *node2); 47 | 48 | int Xorriso_sorted_node_array(struct XorrisO *xorriso, 49 | IsoDir *dir_node, 50 | int *nodec, IsoNode ***node_array, 51 | off_t boss_mem, int flag); 52 | 53 | int Xorriso_remake_hln_array(struct XorrisO *xorriso, int flag); 54 | 55 | int Xorriso_make_di_array(struct XorrisO *xorriso, int flag); 56 | 57 | int Xorriso_search_hardlinks(struct XorrisO *xorriso, IsoNode *node, 58 | int *node_idx, int *min_hl, int *max_hl, int flag); 59 | 60 | 61 | #endif /* ! Xorriso_pvt_sort_cmp_includeD */ 62 | 63 | -------------------------------------------------------------------------------- /xorriso/text_io.h: -------------------------------------------------------------------------------- 1 | 2 | /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. 3 | 4 | Copyright 2007-2010 Thomas Schmitt, 5 | 6 | Provided under GPL version 2 or later. 7 | 8 | This file contains declarations of text i/o functions. 9 | */ 10 | 11 | 12 | #ifndef Xorriso_pvt_textio_includeD 13 | #define Xorriso_pvt_textio_includeD yes 14 | 15 | 16 | int Xorriso_dialog_input(struct XorrisO *xorriso, char line[], int linesize, 17 | int flag); 18 | 19 | /** @return -1= abort , 0= no , 1= yes 20 | */ 21 | int Xorriso_reassure(struct XorrisO *xorriso, char *cmd, char *which_will, 22 | int flag); 23 | 24 | int Xorriso_request_confirmation(struct XorrisO *xorriso, int flag); 25 | 26 | /* @param flag bit0= quoted multiline mode 27 | bit1= release allocated memory and return 1 28 | bit2= with bit0: warn of empty text arguments 29 | bit3= deliver as single quoted text including all whitespace 30 | and without any backslash interpretation 31 | @return -1=out of memory , 0=line format error , 1=ok, go on , 2=done 32 | */ 33 | int Xorriso_read_lines(struct XorrisO *xorriso, FILE *fp, int *linecount, 34 | int *argc, char ***argv, int flag); 35 | 36 | int Xorriso_write_to_channel(struct XorrisO *xorriso, 37 | char *in_text, int channel_no, int flag); 38 | 39 | int Xorriso_result(struct XorrisO *xorriso, int flag); 40 | 41 | int Xorriso_restxt(struct XorrisO *xorriso, char *text); 42 | 43 | int Xorriso_info(struct XorrisO *xorriso, int flag); 44 | 45 | int Xorriso_mark(struct XorrisO *xorriso, int flag); 46 | 47 | 48 | int Xorriso_write_session_log(struct XorrisO *xorriso, int flag); 49 | 50 | 51 | int Xorriso_status_result(struct XorrisO *xorriso, char *filter, FILE *fp, 52 | int flag); 53 | 54 | int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag); 55 | 56 | int Xorriso_pacifier_reset(struct XorrisO *xorriso, int flag); 57 | 58 | /* This call is to be issued by long running workers in short intervals. 59 | It will check whether enough time has elapsed since the last pacifier 60 | message and eventually issue an update message. 61 | @param what_done A sparse description of the action, preferrably in past 62 | tense. E.g. "done" , "files added". 63 | @param count The number of objects processed so far. 64 | Is ignored if <=0. 65 | @param todo The number of objects to be done in total. 66 | Is ignored if <=0. 67 | @param current_object A string telling the object currently processed. 68 | Ignored if "". 69 | @param flag bit0= report unconditionally, no time check 70 | */ 71 | int Xorriso_pacifier_callback(struct XorrisO *xorriso, char *what_done, 72 | off_t count, off_t todo, char *current_object, 73 | int flag); 74 | 75 | int Xorriso_reset_counters(struct XorrisO *xorriso, int flag); 76 | 77 | int Xorriso_no_malloc_memory(struct XorrisO *xorriso, char **to_free, 78 | int flag); 79 | 80 | int Xorriso_much_too_long(struct XorrisO *xorriso, int len, int flag); 81 | 82 | int Xorriso_no_findjob(struct XorrisO *xorriso, char *cmd, int flag); 83 | 84 | int Xorriso_report_md5_outcome(struct XorrisO *xorriso, char *severity, 85 | int flag); 86 | 87 | int Xorriso_protect_stdout(struct XorrisO *xorriso, int flag); 88 | 89 | int Xorriso_msg_op_parse(struct XorrisO *xorriso, char *line, 90 | char *prefix, char *separators, 91 | int max_words, int pflag, int input_lines, 92 | int flag); 93 | 94 | int Xorriso_msg_op_parse_bulk(struct XorrisO *xorriso, 95 | char *prefix, char *separators, 96 | int max_words, int pflag, int bulk_lines, 97 | int flag); 98 | 99 | int Xorriso_launch_frontend(struct XorrisO *xorriso, int argc, char **argv, 100 | char *cmd_pipe_adr, char *reply_pipe_adr, int flag); 101 | 102 | #endif /* ! Xorriso_pvt_textio_includeD */ 103 | 104 | -------------------------------------------------------------------------------- /xorriso/write_run.h: -------------------------------------------------------------------------------- 1 | 2 | /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. 3 | 4 | Copyright 2007-2010 Thomas Schmitt, 5 | 6 | Provided under GPL version 2 or later. 7 | 8 | This file contains declarations of functions which are needed to write 9 | sessions. 10 | */ 11 | 12 | 13 | #ifndef Xorriso_pvt_write_run_includeD 14 | #define Xorriso_pvt_write_run_includeD yes 15 | 16 | 17 | /* CD specs say one shall not write tracks < 600 kiB */ 18 | #define Xorriso_cd_min_track_sizE 300 19 | 20 | 21 | /* Default setting for -compliance */ 22 | #define Xorriso_relax_compliance_defaulT \ 23 | (isoburn_igopt_allow_deep_paths | isoburn_igopt_allow_longer_paths | \ 24 | isoburn_igopt_always_gmt | isoburn_igopt_dir_rec_mtime | \ 25 | isoburn_igopt_rrip_version_1_10 | isoburn_igopt_aaip_susp_1_10 | \ 26 | isoburn_igopt_only_iso_versions | isoburn_igopt_no_j_force_dots) 27 | 28 | 29 | int Xorriso_make_write_options( 30 | struct XorrisO *xorriso, struct burn_drive *drive, 31 | struct burn_write_opts **burn_options, int flag); 32 | 33 | int Xorriso_sanitize_image_size(struct XorrisO *xorriso, 34 | struct burn_drive *drive, struct burn_disc *disc, 35 | struct burn_write_opts *burn_options, int flag); 36 | 37 | int Xorriso_auto_format(struct XorrisO *xorriso, int flag); 38 | 39 | int Xorriso_set_system_area(struct XorrisO *xorriso, struct burn_drive *drive, 40 | IsoImage *img, struct isoburn_imgen_opts *sopts, 41 | int flag); 42 | 43 | int Xorriso_check_burn_abort(struct XorrisO *xorriso, int flag); 44 | 45 | int Xorriso_pacifier_loop(struct XorrisO *xorriso, struct burn_drive *drive, 46 | int flag); 47 | 48 | int Xorriso_set_isolinux_options(struct XorrisO *xorriso, 49 | IsoImage *image, int flag); 50 | 51 | 52 | #endif /* ! Xorriso_pvt_write_run_includeD */ 53 | 54 | -------------------------------------------------------------------------------- /xorriso/xorriso_buildstamp.h: -------------------------------------------------------------------------------- 1 | #ifndef Xorriso_build_timestamP 2 | #define Xorriso_build_timestamP "-none-given-" 3 | #endif 4 | -------------------------------------------------------------------------------- /xorriso/xorriso_buildstamp_none.h: -------------------------------------------------------------------------------- 1 | #ifndef Xorriso_build_timestamP 2 | #define Xorriso_build_timestamP "-none-given-" 3 | #endif 4 | -------------------------------------------------------------------------------- /xorriso/xorriso_timestamp.h: -------------------------------------------------------------------------------- 1 | #define Xorriso_timestamP "2013.05.17.140001" 2 | --------------------------------------------------------------------------------