libisofs  1.2.6
libisofs-1.2.6/libisofs/libisofs.h
Go to the documentation of this file.
00001 
00002 #ifndef LIBISO_LIBISOFS_H_
00003 #define LIBISO_LIBISOFS_H_
00004 
00005 /*
00006  * Copyright (c) 2007-2008 Vreixo Formoso, Mario Danic
00007  * Copyright (c) 2009-2013 Thomas Schmitt
00008  *
00009  * This file is part of the libisofs project; you can redistribute it and/or
00010  * modify it under the terms of the GNU General Public License version 2 
00011  * or later as published by the Free Software Foundation. 
00012  * See COPYING file for details.
00013  */
00014 
00015 /* Important: If you add a public API function then add its name to file
00016                  libisofs/libisofs.ver 
00017 */
00018 
00019 /* 
00020  *
00021  * Applications must use 64 bit off_t.
00022  * E.g. on 32-bit GNU/Linux by defining
00023  *   #define _LARGEFILE_SOURCE
00024  *   #define _FILE_OFFSET_BITS 64
00025  * The minimum requirement is to interface with the library by 64 bit signed
00026  * integers where libisofs.h or libisoburn.h prescribe off_t.
00027  * Failure to do so may result in surprising malfunction or memory faults.
00028  * 
00029  * Application files which include libisofs/libisofs.h must provide
00030  * definitions for uint32_t and uint8_t.
00031  * This can be achieved either:
00032  * - by using autotools which will define HAVE_STDINT_H or HAVE_INTTYPES_H
00033  *   according to its ./configure tests,
00034  * - or by defining the macros HAVE_STDINT_H resp. HAVE_INTTYPES_H according
00035  *   to the local situation,
00036  * - or by appropriately defining uint32_t and uint8_t by other means,
00037  *   e.g. by including inttypes.h before including libisofs.h
00038  */
00039 #ifdef HAVE_STDINT_H
00040 #include <stdint.h>
00041 #else
00042 #ifdef HAVE_INTTYPES_H
00043 #include <inttypes.h>
00044 #endif
00045 #endif
00046 
00047 
00048 /*
00049  * Normally this API is operated via public functions and opaque object
00050  * handles. But it also exposes several C structures which may be used to
00051  * provide custom functionality for the objects of the API. The same
00052  * structures are used for internal objects of libisofs, too.
00053  * You are not supposed to manipulate the entrails of such objects if they
00054  * are not your own custom extensions.
00055  *
00056  * See for an example IsoStream = struct iso_stream below.
00057  */
00058 
00059 
00060 #include <sys/stat.h>
00061 
00062 #include <stdlib.h>
00063 
00064 
00065 /**
00066  * The following two functions and three macros are utilities to help ensuring
00067  * version match of application, compile time header, and runtime library.
00068  */
00069 /**
00070  * These three release version numbers tell the revision of this header file
00071  * and of the API it describes. They are memorized by applications at
00072  * compile time.
00073  * They must show the same values as these symbols in ./configure.ac
00074  *     LIBISOFS_MAJOR_VERSION=...
00075  *     LIBISOFS_MINOR_VERSION=...
00076  *     LIBISOFS_MICRO_VERSION=...
00077  * Note to anybody who does own work inside libisofs:
00078  * Any change of configure.ac or libisofs.h has to keep up this equality !
00079  *
00080  * Before usage of these macros on your code, please read the usage discussion
00081  * below.
00082  *
00083  * @since 0.6.2
00084  */
00085 #define iso_lib_header_version_major  1
00086 #define iso_lib_header_version_minor  2
00087 #define iso_lib_header_version_micro  6
00088 
00089 /**
00090  * Get version of the libisofs library at runtime.
00091  * NOTE: This function may be called before iso_init().
00092  *
00093  * @since 0.6.2
00094  */
00095 void iso_lib_version(int *major, int *minor, int *micro);
00096 
00097 /**
00098  * Check at runtime if the library is ABI compatible with the given version.
00099  * NOTE: This function may be called before iso_init().
00100  *
00101  * @return
00102  *      1 lib is compatible, 0 is not.
00103  *
00104  * @since 0.6.2
00105  */
00106 int iso_lib_is_compatible(int major, int minor, int micro);
00107 
00108 /**
00109  * Usage discussion:
00110  *
00111  * Some developers of the libburnia project have differing opinions how to
00112  * ensure the compatibility of libaries and applications.
00113  *
00114  * It is about whether to use at compile time and at runtime the version
00115  * numbers provided here. Thomas Schmitt advises to use them. Vreixo Formoso
00116  * advises to use other means.
00117  *
00118  * At compile time:
00119  *
00120  * Vreixo Formoso advises to leave proper version matching to properly
00121  * programmed checks in the the application's build system, which will
00122  * eventually refuse compilation.
00123  *
00124  * Thomas Schmitt advises to use the macros defined here for comparison with
00125  * the application's requirements of library revisions and to eventually
00126  * break compilation.
00127  *
00128  * Both advises are combinable. I.e. be master of your build system and have
00129  * #if checks in the source code of your application, nevertheless.
00130  *
00131  * At runtime (via iso_lib_is_compatible()):
00132  *
00133  * Vreixo Formoso advises to compare the application's requirements of
00134  * library revisions with the runtime library. This is to allow runtime
00135  * libraries which are young enough for the application but too old for
00136  * the lib*.h files seen at compile time.
00137  *
00138  * Thomas Schmitt advises to compare the header revisions defined here with
00139  * the runtime library. This is to enforce a strictly monotonous chain of
00140  * revisions from app to header to library, at the cost of excluding some older
00141  * libraries.
00142  *
00143  * These two advises are mutually exclusive.
00144  */
00145 
00146 struct burn_source;
00147 
00148 /**
00149  * Context for image creation. It holds the files that will be added to image,
00150  * and several options to control libisofs behavior.
00151  *
00152  * @since 0.6.2
00153  */
00154 typedef struct Iso_Image IsoImage;
00155 
00156 /*
00157  * A node in the iso tree, i.e. a file that will be written to image.
00158  *
00159  * It can represent any kind of files. When needed, you can get the type with
00160  * iso_node_get_type() and cast it to the appropiate subtype. Useful macros
00161  * are provided, see below.
00162  *
00163  * @since 0.6.2
00164  */
00165 typedef struct Iso_Node IsoNode;
00166 
00167 /**
00168  * A directory in the iso tree. It is an special type of IsoNode and can be
00169  * casted to it in any case.
00170  *
00171  * @since 0.6.2
00172  */
00173 typedef struct Iso_Dir IsoDir;
00174 
00175 /**
00176  * A symbolic link in the iso tree. It is an special type of IsoNode and can be
00177  * casted to it in any case.
00178  *
00179  * @since 0.6.2
00180  */
00181 typedef struct Iso_Symlink IsoSymlink;
00182 
00183 /**
00184  * A regular file in the iso tree. It is an special type of IsoNode and can be
00185  * casted to it in any case.
00186  *
00187  * @since 0.6.2
00188  */
00189 typedef struct Iso_File IsoFile;
00190 
00191 /**
00192  * An special file in the iso tree. This is used to represent any POSIX file
00193  * other that regular files, directories or symlinks, i.e.: socket, block and
00194  * character devices, and fifos.
00195  * It is an special type of IsoNode and can be casted to it in any case.
00196  *
00197  * @since 0.6.2
00198  */
00199 typedef struct Iso_Special IsoSpecial;
00200 
00201 /**
00202  * The type of an IsoNode.
00203  *
00204  * When an user gets an IsoNode from an image, (s)he can use
00205  * iso_node_get_type() to get the current type of the node, and then
00206  * cast to the appropriate subtype. For example:
00207  *
00208  * ...
00209  * IsoNode *node;
00210  * res = iso_dir_iter_next(iter, &node);
00211  * if (res == 1 && iso_node_get_type(node) == LIBISO_DIR) {
00212  *      IsoDir *dir = (IsoDir *)node;
00213  *      ...
00214  * }
00215  *
00216  * @since 0.6.2
00217  */
00218 enum IsoNodeType {
00219     LIBISO_DIR,
00220     LIBISO_FILE,
00221     LIBISO_SYMLINK,
00222     LIBISO_SPECIAL,
00223     LIBISO_BOOT
00224 };
00225 
00226 /* macros to check node type */
00227 #define ISO_NODE_IS_DIR(n) (iso_node_get_type(n) == LIBISO_DIR)
00228 #define ISO_NODE_IS_FILE(n) (iso_node_get_type(n) == LIBISO_FILE)
00229 #define ISO_NODE_IS_SYMLINK(n) (iso_node_get_type(n) == LIBISO_SYMLINK)
00230 #define ISO_NODE_IS_SPECIAL(n) (iso_node_get_type(n) == LIBISO_SPECIAL)
00231 #define ISO_NODE_IS_BOOTCAT(n) (iso_node_get_type(n) == LIBISO_BOOT)
00232 
00233 /* macros for safe downcasting */
00234 #define ISO_DIR(n) ((IsoDir*)(ISO_NODE_IS_DIR(n) ? n : NULL))
00235 #define ISO_FILE(n) ((IsoFile*)(ISO_NODE_IS_FILE(n) ? n : NULL))
00236 #define ISO_SYMLINK(n) ((IsoSymlink*)(ISO_NODE_IS_SYMLINK(n) ? n : NULL))
00237 #define ISO_SPECIAL(n) ((IsoSpecial*)(ISO_NODE_IS_SPECIAL(n) ? n : NULL))
00238 
00239 #define ISO_NODE(n) ((IsoNode*)n)
00240 
00241 /**
00242  * File section in an old image.
00243  *
00244  * @since 0.6.8
00245  */
00246 struct iso_file_section
00247 {
00248     uint32_t block;
00249     uint32_t size;
00250 };
00251 
00252 /* If you get here because of a compilation error like
00253 
00254        /usr/include/libisofs/libisofs.h:166: error:
00255        expected specifier-qualifier-list before 'uint32_t'
00256 
00257    then see the paragraph above about the definition of uint32_t.
00258 */
00259 
00260 
00261 /**
00262  * Context for iterate on directory children.
00263  * @see iso_dir_get_children()
00264  *
00265  * @since 0.6.2
00266  */
00267 typedef struct Iso_Dir_Iter IsoDirIter;
00268 
00269 /**
00270  * It represents an El-Torito boot image.
00271  *
00272  * @since 0.6.2
00273  */
00274 typedef struct el_torito_boot_image ElToritoBootImage;
00275 
00276 /**
00277  * An special type of IsoNode that acts as a placeholder for an El-Torito
00278  * boot catalog. Once written, it will appear as a regular file.
00279  *
00280  * @since 0.6.2
00281  */
00282 typedef struct Iso_Boot IsoBoot;
00283 
00284 /**
00285  * Flag used to hide a file in the RR/ISO or Joliet tree.
00286  *
00287  * @see iso_node_set_hidden
00288  * @since 0.6.2
00289  */
00290 enum IsoHideNodeFlag {
00291     /** Hide the node in the ECMA-119 / RR tree */
00292     LIBISO_HIDE_ON_RR = 1 << 0,
00293     /** Hide the node in the Joliet tree, if Joliet extension are enabled */
00294     LIBISO_HIDE_ON_JOLIET = 1 << 1,
00295     /** Hide the node in the ISO-9660:1999 tree, if that format is enabled */
00296     LIBISO_HIDE_ON_1999 = 1 << 2,
00297 
00298     /** Hide the node in the HFS+ tree, if that format is enabled.
00299         @since 1.2.4
00300     */
00301     LIBISO_HIDE_ON_HFSPLUS = 1 << 4,
00302 
00303     /** Hide the node in the FAT tree, if that format is enabled.
00304         @since 1.2.4
00305     */
00306     LIBISO_HIDE_ON_FAT = 1 << 5,
00307 
00308     /** With IsoNode and IsoBoot: Write data content even if the node is
00309      *                            not visible in any tree.
00310      *  With directory nodes    : Write data content of IsoNode and IsoBoot
00311      *                            in the directory's tree unless they are
00312      *                            explicitely marked LIBISO_HIDE_ON_RR
00313      *                            without LIBISO_HIDE_BUT_WRITE.
00314      *  @since 0.6.34
00315      */
00316     LIBISO_HIDE_BUT_WRITE = 1 << 3
00317 };
00318 
00319 /**
00320  * El-Torito bootable image type.
00321  *
00322  * @since 0.6.2
00323  */
00324 enum eltorito_boot_media_type {
00325     ELTORITO_FLOPPY_EMUL,
00326     ELTORITO_HARD_DISC_EMUL,
00327     ELTORITO_NO_EMUL
00328 };
00329 
00330 /**
00331  * Replace mode used when addding a node to a file.
00332  * This controls how libisofs will act when you tried to add to a dir a file
00333  * with the same name that an existing file.
00334  *
00335  * @since 0.6.2
00336  */
00337 enum iso_replace_mode {
00338     /**
00339      * Never replace an existing node, and instead fail with
00340      * ISO_NODE_NAME_NOT_UNIQUE.
00341      */
00342     ISO_REPLACE_NEVER,
00343     /**
00344      * Always replace the old node with the new.
00345      */
00346     ISO_REPLACE_ALWAYS,
00347     /**
00348      * Replace with the new node if it is the same file type
00349      */
00350     ISO_REPLACE_IF_SAME_TYPE,
00351     /**
00352      * Replace with the new node if it is the same file type and its ctime
00353      * is newer than the old one.
00354      */
00355     ISO_REPLACE_IF_SAME_TYPE_AND_NEWER,
00356     /**
00357      * Replace with the new node if its ctime is newer than the old one.
00358      */
00359     ISO_REPLACE_IF_NEWER
00360     /*
00361      * TODO #00006 define more values
00362      *  -if both are dirs, add contents (and what to do with conflicts?)
00363      */
00364 };
00365 
00366 /**
00367  * Options for image written.
00368  * @see iso_write_opts_new()
00369  * @since 0.6.2
00370  */
00371 typedef struct iso_write_opts IsoWriteOpts;
00372 
00373 /**
00374  * Options for image reading or import.
00375  * @see iso_read_opts_new()
00376  * @since 0.6.2
00377  */
00378 typedef struct iso_read_opts IsoReadOpts;
00379 
00380 /**
00381  * Source for image reading.
00382  *
00383  * @see struct iso_data_source
00384  * @since 0.6.2
00385  */
00386 typedef struct iso_data_source IsoDataSource;
00387 
00388 /**
00389  * Data source used by libisofs for reading an existing image.
00390  *
00391  * It offers homogeneous read access to arbitrary blocks to different sources
00392  * for images, such as .iso files, CD/DVD drives, etc...
00393  *
00394  * To create a multisession image, libisofs needs a IsoDataSource, that the
00395  * user must provide. The function iso_data_source_new_from_file() constructs
00396  * an IsoDataSource that uses POSIX I/O functions to access data. You can use
00397  * it with regular .iso images, and also with block devices that represent a
00398  * drive.
00399  *
00400  * @since 0.6.2
00401  */
00402 struct iso_data_source
00403 {
00404 
00405     /* reserved for future usage, set to 0 */
00406     int version;
00407 
00408     /**
00409      * Reference count for the data source. Should be 1 when a new source
00410      * is created. Don't access it directly, but with iso_data_source_ref()
00411      * and iso_data_source_unref() functions.
00412      */
00413     unsigned int refcount;
00414 
00415     /**
00416      * Opens the given source. You must open() the source before any attempt
00417      * to read data from it. The open is the right place for grabbing the
00418      * underlying resources.
00419      *
00420      * @return
00421      *      1 if success, < 0 on error (has to be a valid libisofs error code)
00422      */
00423     int (*open)(IsoDataSource *src);
00424 
00425     /**
00426      * Close a given source, freeing all system resources previously grabbed in
00427      * open().
00428      *
00429      * @return
00430      *      1 if success, < 0 on error (has to be a valid libisofs error code)
00431      */
00432     int (*close)(IsoDataSource *src);
00433 
00434     /**
00435      * Read an arbitrary block (2048 bytes) of data from the source.
00436      *
00437      * @param lba
00438      *     Block to be read.
00439      * @param buffer
00440      *     Buffer where the data will be written. It should have at least
00441      *     2048 bytes.
00442      * @return
00443      *      1 if success,
00444      *    < 0 if error. This function has to emit a valid libisofs error code.
00445      *        Predifined (but not mandatory) for this purpose are:
00446      *          ISO_DATA_SOURCE_SORRY ,   ISO_DATA_SOURCE_MISHAP,
00447      *          ISO_DATA_SOURCE_FAILURE , ISO_DATA_SOURCE_FATAL
00448      */
00449     int (*read_block)(IsoDataSource *src, uint32_t lba, uint8_t *buffer);
00450 
00451     /**
00452      * Clean up the source specific data. Never call this directly, it is
00453      * automatically called by iso_data_source_unref() when refcount reach
00454      * 0.
00455      */
00456     void (*free_data)(IsoDataSource *src);
00457 
00458     /** Source specific data */
00459     void *data;
00460 };
00461 
00462 /**
00463  * Return information for image. This is optionally allocated by libisofs,
00464  * as a way to inform user about the features of an existing image, such as
00465  * extensions present, size, ...
00466  *
00467  * @see iso_image_import()
00468  * @since 0.6.2
00469  */
00470 typedef struct iso_read_image_features IsoReadImageFeatures;
00471 
00472 /**
00473  * POSIX abstraction for source files.
00474  *
00475  * @see struct iso_file_source
00476  * @since 0.6.2
00477  */
00478 typedef struct iso_file_source IsoFileSource;
00479 
00480 /**
00481  * Abstract for source filesystems.
00482  *
00483  * @see struct iso_filesystem
00484  * @since 0.6.2
00485  */
00486 typedef struct iso_filesystem IsoFilesystem;
00487 
00488 /**
00489  * Interface that defines the operations (methods) available for an
00490  * IsoFileSource.
00491  *
00492  * @see struct IsoFileSource_Iface
00493  * @since 0.6.2
00494  */
00495 typedef struct IsoFileSource_Iface IsoFileSourceIface;
00496 
00497 /**
00498  * IsoFilesystem implementation to deal with ISO images, and to offer a way to
00499  * access specific information of the image, such as several volume attributes,
00500  * extensions being used, El-Torito artifacts...
00501  *
00502  * @since 0.6.2
00503  */
00504 typedef IsoFilesystem IsoImageFilesystem;
00505 
00506 /**
00507  * See IsoFilesystem->get_id() for info about this.
00508  * @since 0.6.2
00509  */
00510 extern unsigned int iso_fs_global_id;
00511 
00512 /**
00513  * An IsoFilesystem is a handler for a source of files, or a "filesystem".
00514  * That is defined as a set of files that are organized in a hierarchical
00515  * structure.
00516  *
00517  * A filesystem allows libisofs to access files from several sources in
00518  * an homogeneous way, thus abstracting the underlying operations needed to
00519  * access and read file contents. Note that this doesn't need to be tied
00520  * to the disc filesystem used in the partition being accessed. For example,
00521  * we have an IsoFilesystem implementation to access any mounted filesystem,
00522  * using standard POSIX functions. It is also legal, of course, to implement
00523  * an IsoFilesystem to deal with a specific filesystem over raw partitions.
00524  * That is what we do, for example, to access an ISO Image.
00525  *
00526  * Each file inside an IsoFilesystem is represented as an IsoFileSource object,
00527  * that defines POSIX-like interface for accessing files.
00528  *
00529  * @since 0.6.2
00530  */
00531 struct iso_filesystem
00532 {
00533     /**
00534      * Type of filesystem.
00535      * "file" -> local filesystem
00536      * "iso " -> iso image filesystem
00537      */
00538     char type[4];
00539 
00540     /* reserved for future usage, set to 0 */
00541     int version;
00542 
00543     /**
00544      * Get the root of a filesystem.
00545      *
00546      * @return
00547      *    1 on success, < 0 on error (has to be a valid libisofs error code)
00548      */
00549     int (*get_root)(IsoFilesystem *fs, IsoFileSource **root);
00550 
00551     /**
00552      * Retrieve a file from its absolute path inside the filesystem.
00553      * @param file
00554      *     Returns a pointer to a IsoFileSource object representing the
00555      *     file. It has to be disposed by iso_file_source_unref() when
00556      *     no longer needed.
00557      * @return
00558      *     1 success, < 0 error (has to be a valid libisofs error code)
00559      *      Error codes:
00560      *         ISO_FILE_ACCESS_DENIED
00561      *         ISO_FILE_BAD_PATH
00562      *         ISO_FILE_DOESNT_EXIST
00563      *         ISO_OUT_OF_MEM
00564      *         ISO_FILE_ERROR
00565      *         ISO_NULL_POINTER
00566      */
00567     int (*get_by_path)(IsoFilesystem *fs, const char *path,
00568                        IsoFileSource **file);
00569 
00570     /**
00571      * Get filesystem identifier.
00572      *
00573      * If the filesystem is able to generate correct values of the st_dev
00574      * and st_ino fields for the struct stat of each file, this should
00575      * return an unique number, greater than 0.
00576      *
00577      * To get a identifier for your filesystem implementation you should
00578      * use iso_fs_global_id, incrementing it by one each time.
00579      *
00580      * Otherwise, if you can't ensure values in the struct stat are valid,
00581      * this should return 0.
00582      */
00583     unsigned int (*get_id)(IsoFilesystem *fs);
00584 
00585     /**
00586      * Opens the filesystem for several read operations. Calling this funcion
00587      * is not needed at all, each time that the underlying system resource
00588      * needs to be accessed, it is openned propertly.
00589      * However, if you plan to execute several operations on the filesystem,
00590      * it is a good idea to open it previously, to prevent several open/close
00591      * operations to occur.
00592      *
00593      * @return 1 on success, < 0 on error (has to be a valid libisofs error code)
00594      */
00595     int (*open)(IsoFilesystem *fs);
00596 
00597     /**
00598      * Close the filesystem, thus freeing all system resources. You should
00599      * call this function if you have previously open() it.
00600      * Note that you can open()/close() a filesystem several times.
00601      *
00602      * @return 1 on success, < 0 on error (has to be a valid libisofs error code)
00603      */
00604     int (*close)(IsoFilesystem *fs);
00605 
00606     /**
00607      * Free implementation specific data. Should never be called by user.
00608      * Use iso_filesystem_unref() instead.
00609      */
00610     void (*free)(IsoFilesystem *fs);
00611 
00612     /* internal usage, do never access them directly */
00613     unsigned int refcount;
00614     void *data;
00615 };
00616 
00617 /**
00618  * Interface definition for an IsoFileSource. Defines the POSIX-like function
00619  * to access files and abstract underlying source.
00620  *
00621  * @since 0.6.2
00622  */
00623 struct IsoFileSource_Iface
00624 {
00625     /**
00626      * Tells the version of the interface:
00627      * Version 0 provides functions up to (*lseek)().
00628      * @since 0.6.2
00629      * Version 1 additionally provides function *(get_aa_string)().
00630      * @since 0.6.14
00631      * Version 2 additionally provides function *(clone_src)().
00632      * @since 1.0.2
00633      */
00634     int version;
00635 
00636     /**
00637      * Get the absolute path in the filesystem this file source belongs to.
00638      *
00639      * @return
00640      *     the path of the FileSource inside the filesystem, it should be
00641      *     freed when no more needed.
00642      */
00643     char* (*get_path)(IsoFileSource *src);
00644 
00645     /**
00646      * Get the name of the file, with the dir component of the path.
00647      *
00648      * @return
00649      *     the name of the file, it should be freed when no more needed.
00650      */
00651     char* (*get_name)(IsoFileSource *src);
00652 
00653     /**
00654      * Get information about the file. It is equivalent to lstat(2).
00655      *
00656      * @return
00657      *    1 success, < 0 error (has to be a valid libisofs error code)
00658      *      Error codes:
00659      *         ISO_FILE_ACCESS_DENIED
00660      *         ISO_FILE_BAD_PATH
00661      *         ISO_FILE_DOESNT_EXIST
00662      *         ISO_OUT_OF_MEM
00663      *         ISO_FILE_ERROR
00664      *         ISO_NULL_POINTER
00665      */
00666     int (*lstat)(IsoFileSource *src, struct stat *info);
00667 
00668     /**
00669      * Get information about the file. If the file is a symlink, the info
00670      * returned refers to the destination. It is equivalent to stat(2).
00671      *
00672      * @return
00673      *    1 success, < 0 error
00674      *      Error codes:
00675      *         ISO_FILE_ACCESS_DENIED
00676      *         ISO_FILE_BAD_PATH
00677      *         ISO_FILE_DOESNT_EXIST
00678      *         ISO_OUT_OF_MEM
00679      *         ISO_FILE_ERROR
00680      *         ISO_NULL_POINTER
00681      */
00682     int (*stat)(IsoFileSource *src, struct stat *info);
00683 
00684     /**
00685      * Check if the process has access to read file contents. Note that this
00686      * is not necessarily related with (l)stat functions. For example, in a
00687      * filesystem implementation to deal with an ISO image, if the user has
00688      * read access to the image it will be able to read all files inside it,
00689      * despite of the particular permission of each file in the RR tree, that
00690      * are what the above functions return.
00691      *
00692      * @return
00693      *     1 if process has read access, < 0 on error (has to be a valid
00694      *     libisofs error code)
00695      *      Error codes:
00696      *         ISO_FILE_ACCESS_DENIED
00697      *         ISO_FILE_BAD_PATH
00698      *         ISO_FILE_DOESNT_EXIST
00699      *         ISO_OUT_OF_MEM
00700      *         ISO_FILE_ERROR
00701      *         ISO_NULL_POINTER
00702      */
00703     int (*access)(IsoFileSource *src);
00704 
00705     /**
00706      * Opens the source.
00707      * @return 1 on success, < 0 on error (has to be a valid libisofs error code)
00708      *      Error codes:
00709      *         ISO_FILE_ALREADY_OPENED
00710      *         ISO_FILE_ACCESS_DENIED
00711      *         ISO_FILE_BAD_PATH
00712      *         ISO_FILE_DOESNT_EXIST
00713      *         ISO_OUT_OF_MEM
00714      *         ISO_FILE_ERROR
00715      *         ISO_NULL_POINTER
00716      */
00717     int (*open)(IsoFileSource *src);
00718 
00719     /**
00720      * Close a previuously openned file
00721      * @return 1 on success, < 0 on error
00722      *      Error codes:
00723      *         ISO_FILE_ERROR
00724      *         ISO_NULL_POINTER
00725      *         ISO_FILE_NOT_OPENED
00726      */
00727     int (*close)(IsoFileSource *src);
00728 
00729     /**
00730      * Attempts to read up to count bytes from the given source into
00731      * the buffer starting at buf.
00732      *
00733      * The file src must be open() before calling this, and close() when no
00734      * more needed. Not valid for dirs. On symlinks it reads the destination
00735      * file.
00736      *
00737      * @return
00738      *     number of bytes read, 0 if EOF, < 0 on error (has to be a valid
00739      *     libisofs error code)
00740      *      Error codes:
00741      *         ISO_FILE_ERROR
00742      *         ISO_NULL_POINTER
00743      *         ISO_FILE_NOT_OPENED
00744      *         ISO_WRONG_ARG_VALUE -> if count == 0
00745      *         ISO_FILE_IS_DIR
00746      *         ISO_OUT_OF_MEM
00747      *         ISO_INTERRUPTED
00748      */
00749     int (*read)(IsoFileSource *src, void *buf, size_t count);
00750 
00751     /**
00752      * Read a directory.
00753      *
00754      * Each call to this function will return a new children, until we reach
00755      * the end of file (i.e, no more children), in that case it returns 0.
00756      *
00757      * The dir must be open() before calling this, and close() when no more
00758      * needed. Only valid for dirs.
00759      *
00760      * Note that "." and ".." children MUST NOT BE returned.
00761      *
00762      * @param child
00763      *     pointer to be filled with the given child. Undefined on error or OEF
00764      * @return
00765      *     1 on success, 0 if EOF (no more children), < 0 on error (has to be
00766      *     a valid libisofs error code)
00767      *      Error codes:
00768      *         ISO_FILE_ERROR
00769      *         ISO_NULL_POINTER
00770      *         ISO_FILE_NOT_OPENED
00771      *         ISO_FILE_IS_NOT_DIR
00772      *         ISO_OUT_OF_MEM
00773      */
00774     int (*readdir)(IsoFileSource *src, IsoFileSource **child);
00775 
00776     /**
00777      * Read the destination of a symlink. You don't need to open the file
00778      * to call this.
00779      *
00780      * @param buf
00781      *     allocated buffer of at least bufsiz bytes.
00782      *     The dest. will be copied there, and it will be NULL-terminated
00783      * @param bufsiz
00784      *     characters to be copied. Destination link will be truncated if
00785      *     it is larger than given size. This include the 0x0 character.
00786      * @return
00787      *     1 on success, < 0 on error (has to be a valid libisofs error code)
00788      *      Error codes:
00789      *         ISO_FILE_ERROR
00790      *         ISO_NULL_POINTER
00791      *         ISO_WRONG_ARG_VALUE -> if bufsiz <= 0
00792      *         ISO_FILE_IS_NOT_SYMLINK
00793      *         ISO_OUT_OF_MEM
00794      *         ISO_FILE_BAD_PATH
00795      *         ISO_FILE_DOESNT_EXIST
00796      *
00797      */
00798     int (*readlink)(IsoFileSource *src, char *buf, size_t bufsiz);
00799 
00800     /**
00801      * Get the filesystem for this source. No extra ref is added, so you
00802      * musn't unref the IsoFilesystem.
00803      *
00804      * @return
00805      *     The filesystem, NULL on error
00806      */
00807     IsoFilesystem* (*get_filesystem)(IsoFileSource *src);
00808 
00809     /**
00810      * Free implementation specific data. Should never be called by user.
00811      * Use iso_file_source_unref() instead.
00812      */
00813     void (*free)(IsoFileSource *src);
00814 
00815     /**
00816      * Repositions the offset of the IsoFileSource (must be opened) to the
00817      * given offset according to the value of flag.
00818      *
00819      * @param offset
00820      *      in bytes
00821      * @param flag
00822      *      0 The offset is set to offset bytes (SEEK_SET)
00823      *      1 The offset is set to its current location plus offset bytes
00824      *        (SEEK_CUR)
00825      *      2 The offset is set to the size of the file plus offset bytes
00826      *        (SEEK_END).
00827      * @return
00828      *      Absolute offset position of the file, or < 0 on error. Cast the
00829      *      returning value to int to get a valid libisofs error.
00830      *
00831      * @since 0.6.4
00832      */
00833     off_t (*lseek)(IsoFileSource *src, off_t offset, int flag);
00834 
00835     /* Add-ons of .version 1 begin here */
00836 
00837     /**
00838      * Valid only if .version is > 0. See above.
00839      * Get the AAIP string with encoded ACL and xattr.
00840      * (Not to be confused with ECMA-119 Extended Attributes).
00841      *
00842      * bit1 and bit2 of flag should be implemented so that freshly fetched
00843      * info does not include the undesired ACL or xattr. Nevertheless if the
00844      * aa_string is cached, then it is permissible that ACL and xattr are still
00845      * delivered.
00846      *
00847      * @param flag       Bitfield for control purposes
00848      *                   bit0= Transfer ownership of AAIP string data.
00849      *                         src will free the eventual cached data and might
00850      *                         not be able to produce it again.
00851      *                   bit1= No need to get ACL (no guarantee of exclusion)
00852      *                   bit2= No need to get xattr (no guarantee of exclusion)
00853      * @param aa_string  Returns a pointer to the AAIP string data. If no AAIP
00854      *                   string is available, *aa_string becomes NULL.
00855      *                   (See doc/susp_aaip_*_*.txt for the meaning of AAIP and
00856      *                    libisofs/aaip_0_2.h for encoding and decoding.)
00857      *                   The caller is responsible for finally calling free()
00858      *                   on non-NULL results.
00859      * @return           1 means success (*aa_string == NULL is possible)
00860      *                  <0 means failure and must b a valid libisofs error code
00861      *                     (e.g. ISO_FILE_ERROR if no better one can be found).
00862      * @since 0.6.14
00863      */
00864     int (*get_aa_string)(IsoFileSource *src,
00865                                      unsigned char **aa_string, int flag);
00866 
00867     /**
00868      * Produce a copy of a source. It must be possible to operate both source
00869      * objects concurrently.
00870      * 
00871      * @param old_src
00872      *     The existing source object to be copied
00873      * @param new_stream
00874      *     Will return a pointer to the copy
00875      * @param flag
00876      *     Bitfield for control purposes. Submit 0 for now.
00877      *     The function shall return ISO_STREAM_NO_CLONE on unknown flag bits.
00878      *
00879      * @since 1.0.2
00880      * Present if .version is 2 or higher.
00881      */
00882     int (*clone_src)(IsoFileSource *old_src, IsoFileSource **new_src, 
00883                      int flag);
00884 
00885     /*
00886      * TODO #00004 Add a get_mime_type() function.
00887      * This can be useful for GUI apps, to choose the icon of the file
00888      */
00889 };
00890 
00891 #ifndef __cplusplus
00892 #ifndef Libisofs_h_as_cpluspluS
00893 
00894 /**
00895  * An IsoFile Source is a POSIX abstraction of a file.
00896  *
00897  * @since 0.6.2
00898  */
00899 struct iso_file_source
00900 {
00901     const IsoFileSourceIface *class;
00902     int refcount;
00903     void *data;
00904 };
00905 
00906 #endif /* ! Libisofs_h_as_cpluspluS */
00907 #endif /* ! __cplusplus */
00908 
00909 
00910 /* A class of IsoStream is implemented by a class description
00911  *    IsoStreamIface = struct IsoStream_Iface
00912  * and a structure of data storage for each instance of IsoStream.
00913  * This structure shall be known to the functions of the IsoStreamIface.
00914  * To create a custom IsoStream class:
00915  * - Define the structure of the custom instance data.
00916  * - Implement the methods which are described by the definition of
00917  *   struct IsoStream_Iface (see below),
00918  * - Create a static instance of IsoStreamIface which lists the methods as
00919  *   C function pointers. (Example in libisofs/stream.c : fsrc_stream_class)
00920  * To create an instance of that class:
00921  * - Allocate sizeof(IsoStream) bytes of memory and initialize it as
00922  *   struct iso_stream :
00923  *   - Point to the custom IsoStreamIface by member .class .
00924  *   - Set member .refcount to 1.
00925  *   - Let member .data point to the custom instance data.
00926  *
00927  * Regrettably the choice of the structure member name "class" makes it
00928  * impossible to implement this generic interface in C++ language directly.
00929  * If C++ is absolutely necessary then you will have to make own copies
00930  * of the public API structures. Use other names but take care to maintain
00931  * the same memory layout.
00932  */
00933 
00934 /**
00935  * Representation of file contents. It is an stream of bytes, functionally
00936  * like a pipe.
00937  *
00938  * @since 0.6.4
00939  */
00940 typedef struct iso_stream IsoStream;
00941 
00942 /**
00943  * Interface that defines the operations (methods) available for an
00944  * IsoStream.
00945  *
00946  * @see struct IsoStream_Iface
00947  * @since 0.6.4
00948  */
00949 typedef struct IsoStream_Iface IsoStreamIface;
00950 
00951 /**
00952  * Serial number to be used when you can't get a valid id for a Stream by other
00953  * means. If you use this, both fs_id and dev_id should be set to 0.
00954  * This must be incremented each time you get a reference to it.
00955  *
00956  * @see IsoStreamIface->get_id()
00957  * @since 0.6.4
00958  */
00959 extern ino_t serial_id;
00960 
00961 /**
00962  * Interface definition for IsoStream methods. It is public to allow
00963  * implementation of own stream types.
00964  * The methods defined here typically make use of stream.data which points
00965  * to the individual state data of stream instances.
00966  * 
00967  * @since 0.6.4
00968  */
00969 
00970 struct IsoStream_Iface
00971 {
00972     /*
00973      * Current version of the interface.
00974      * Version 0 (since 0.6.4)
00975      *    deprecated but still valid.
00976      * Version 1 (since 0.6.8) 
00977      *    update_size() added.
00978      * Version 2 (since 0.6.18)
00979      *    get_input_stream() added.
00980      *    A filter stream must have version 2 at least.
00981      * Version 3 (since 0.6.20)
00982      *    compare() added.
00983      *    A filter stream should have version 3 at least.
00984      * Version 4 (since 1.0.2)
00985      *    clone_stream() added.
00986      */
00987     int version;
00988 
00989     /**
00990      * Type of Stream.
00991      * "fsrc" -> Read from file source
00992      * "cout" -> Cut out interval from disk file
00993      * "mem " -> Read from memory
00994      * "boot" -> Boot catalog
00995      * "extf" -> External filter program
00996      * "ziso" -> zisofs compression
00997      * "osiz" -> zisofs uncompression
00998      * "gzip" -> gzip compression
00999      * "pizg" -> gzip uncompression (gunzip)
01000      * "user" -> User supplied stream
01001      */
01002     char type[4];
01003 
01004     /**
01005      * Opens the stream.
01006      *
01007      * @return
01008      *     1 on success, 2 file greater than expected, 3 file smaller than
01009      *     expected, < 0 on error (has to be a valid libisofs error code)
01010      */
01011     int (*open)(IsoStream *stream);
01012 
01013     /**
01014      * Close the Stream.
01015      * @return
01016      *     1 on success, < 0 on error (has to be a valid libisofs error code)
01017      */
01018     int (*close)(IsoStream *stream);
01019 
01020     /**
01021      * Get the size (in bytes) of the stream. This function should always
01022      * return the same size, even if the underlying source size changes,
01023      * unless you call update_size() method.
01024      */
01025     off_t (*get_size)(IsoStream *stream);
01026 
01027     /**
01028      * Attempt to read up to count bytes from the given stream into
01029      * the buffer starting at buf. The implementation has to make sure that
01030      * either the full desired count of bytes is delivered or that the
01031      * next call to this function will return EOF or error.
01032      * I.e. only the last read block may be shorter than parameter count.
01033      *
01034      * The stream must be open() before calling this, and close() when no
01035      * more needed.
01036      *
01037      * @return
01038      *     number of bytes read, 0 if EOF, < 0 on error (has to be a valid
01039      *     libisofs error code)
01040      */
01041     int (*read)(IsoStream *stream, void *buf, size_t count);
01042 
01043     /**
01044      * Tell whether this IsoStream can be read several times, with the same
01045      * results. For example, a regular file is repeatable, you can read it
01046      * as many times as you want. However, a pipe is not.
01047      *
01048      * @return
01049      *     1 if stream is repeatable, 0 if not,
01050      *     < 0 on error (has to be a valid libisofs error code)
01051      */
01052     int (*is_repeatable)(IsoStream *stream);
01053 
01054     /**
01055      * Get an unique identifier for the IsoStream.
01056      */
01057     void (*get_id)(IsoStream *stream, unsigned int *fs_id, dev_t *dev_id,
01058                   ino_t *ino_id);
01059 
01060     /**
01061      * Free implementation specific data. Should never be called by user.
01062      * Use iso_stream_unref() instead.
01063      */
01064     void (*free)(IsoStream *stream);
01065 
01066     /**
01067      * Update the size of the IsoStream with the current size of the underlying
01068      * source, if the source is prone to size changes. After calling this,
01069      * get_size() shall eventually return the new size.
01070      * This will never be called after iso_image_create_burn_source() was
01071      * called and before the image was completely written.
01072      * (The API call to update the size of all files in the image is
01073      *  iso_image_update_sizes()).
01074      *
01075      * @return
01076      *     1 if ok, < 0 on error (has to be a valid libisofs error code)
01077      *
01078      * @since 0.6.8
01079      * Present if .version is 1 or higher.
01080      */
01081     int (*update_size)(IsoStream *stream);
01082 
01083     /**
01084      * Retrieve the eventual input stream of a filter stream.
01085      *
01086      * @param stream
01087      *     The eventual filter stream to be inquired.
01088      * @param flag
01089      *     Bitfield for control purposes. 0 means normal behavior.
01090      * @return
01091      *     The input stream, if one exists. Elsewise NULL.
01092      *     No extra reference to the stream shall be taken by this call.
01093      *
01094      * @since 0.6.18
01095      * Present if .version is 2 or higher.
01096      */
01097     IsoStream *(*get_input_stream)(IsoStream *stream, int flag);
01098 
01099     /**
01100      * Compare two streams whether they are based on the same input and will
01101      * produce the same output. If in any doubt, then this comparison should
01102      * indicate no match. A match might allow hardlinking of IsoFile objects.
01103      *
01104      * If this function cannot accept one of the given stream types, then
01105      * the decision must be delegated to
01106      *    iso_stream_cmp_ino(s1, s2, 1);
01107      * This is also appropriate if one has reason to implement stream.cmp_ino()
01108      * without having an own special comparison algorithm.
01109      *
01110      * With filter streams, the decision whether the underlying chains of
01111      * streams match, should be delegated to
01112      *    iso_stream_cmp_ino(iso_stream_get_input_stream(s1, 0),
01113      *                       iso_stream_get_input_stream(s2, 0), 0);
01114      *
01115      * The stream.cmp_ino() function has to establish an equivalence and order
01116      * relation: 
01117      *   cmp_ino(A,A) == 0
01118      *   cmp_ino(A,B) == -cmp_ino(B,A) 
01119      *   if cmp_ino(A,B) == 0 && cmp_ino(B,C) == 0 then cmp_ino(A,C) == 0
01120      *   if cmp_ino(A,B) < 0 && cmp_ino(B,C) < 0 then cmp_ino(A,C) < 0
01121      *
01122      * A big hazard to the last constraint are tests which do not apply to some 
01123      * types of streams.Thus it is mandatory to let iso_stream_cmp_ino(s1,s2,1)
01124      * decide in this case.
01125      *
01126      * A function s1.(*cmp_ino)() must only accept stream s2 if function
01127      * s2.(*cmp_ino)() would accept s1. Best is to accept only the own stream
01128      * type or to have the same function for a family of similar stream types.
01129      *
01130      * @param s1
01131      *     The first stream to compare. Expect foreign stream types.
01132      * @param s2
01133      *     The second stream to compare. Expect foreign stream types.
01134      * @return
01135      *     -1 if s1 is smaller s2 , 0 if s1 matches s2 , 1 if s1 is larger s2
01136      *
01137      * @since 0.6.20
01138      * Present if .version is 3 or higher.
01139      */
01140     int (*cmp_ino)(IsoStream *s1, IsoStream *s2);
01141 
01142     /**
01143      * Produce a copy of a stream. It must be possible to operate both stream
01144      * objects concurrently.
01145      * 
01146      * @param old_stream
01147      *     The existing stream object to be copied
01148      * @param new_stream
01149      *     Will return a pointer to the copy
01150      * @param flag
01151      *     Bitfield for control purposes. 0 means normal behavior.
01152      *     The function shall return ISO_STREAM_NO_CLONE on unknown flag bits.
01153      * @return
01154      *     1 in case of success, or an error code < 0
01155      *
01156      * @since 1.0.2
01157      * Present if .version is 4 or higher.
01158      */
01159     int (*clone_stream)(IsoStream *old_stream, IsoStream **new_stream,
01160                         int flag);
01161 
01162 };
01163 
01164 #ifndef __cplusplus
01165 #ifndef Libisofs_h_as_cpluspluS
01166 
01167 /**
01168  * Representation of file contents as a stream of bytes.
01169  *
01170  * @since 0.6.4
01171  */
01172 struct iso_stream
01173 {
01174     IsoStreamIface *class;
01175     int refcount;
01176     void *data;
01177 };
01178 
01179 #endif /* ! Libisofs_h_as_cpluspluS */
01180 #endif /* ! __cplusplus */
01181 
01182 
01183 /**
01184  * Initialize libisofs. Before any usage of the library you must either call
01185  * this function or iso_init_with_flag().
01186  * Only exception from this rule: iso_lib_version(), iso_lib_is_compatible().
01187  * @return 1 on success, < 0 on error
01188  *
01189  * @since 0.6.2
01190  */
01191 int iso_init();
01192 
01193 /**
01194  * Initialize libisofs. Before any usage of the library you must either call
01195  * this function or iso_init() which is equivalent to iso_init_with_flag(0).
01196  * Only exception from this rule: iso_lib_version(), iso_lib_is_compatible().
01197  * @param flag
01198  *      Bitfield for control purposes
01199  *      bit0= do not set up locale by LC_* environment variables
01200  * @return 1 on success, < 0 on error
01201  *
01202  * @since 0.6.18
01203  */
01204 int iso_init_with_flag(int flag);
01205 
01206 /**
01207  * Finalize libisofs.
01208  *
01209  * @since 0.6.2
01210  */
01211 void iso_finish();
01212 
01213 /**
01214  * Override the reply of libc function nl_langinfo(CODESET) which may or may
01215  * not give the name of the character set which is in effect for your
01216  * environment. So this call can compensate for inconsistent terminal setups.
01217  * Another use case is to choose UTF-8 as intermediate character set for a
01218  * conversion from an exotic input character set to an exotic output set.
01219  *
01220  * @param name
01221  *     Name of the character set to be assumed as "local" one.
01222  * @param flag
01223  *     Unused yet. Submit 0.
01224  * @return
01225  *     1 indicates success, <=0 failure
01226  *
01227  * @since 0.6.12
01228  */
01229 int iso_set_local_charset(char *name, int flag);
01230 
01231 /**
01232  * Obtain the local charset as currently assumed by libisofs.
01233  * The result points to internal memory. It is volatile and must not be
01234  * altered.
01235  *
01236  * @param flag
01237  *     Unused yet. Submit 0.
01238  *
01239  * @since 0.6.12
01240  */
01241 char *iso_get_local_charset(int flag);
01242 
01243 /**
01244  * Create a new image, empty.
01245  *
01246  * The image will be owned by you and should be unref() when no more needed.
01247  *
01248  * @param name
01249  *     Name of the image. This will be used as volset_id and volume_id.
01250  * @param image
01251  *     Location where the image pointer will be stored.
01252  * @return
01253  *     1 sucess, < 0 error
01254  *
01255  * @since 0.6.2
01256  */
01257 int iso_image_new(const char *name, IsoImage **image);
01258 
01259 
01260 /**
01261  * Control whether ACL and xattr will be imported from external filesystems
01262  * (typically the local POSIX filesystem) when new nodes get inserted. If
01263  * enabled by iso_write_opts_set_aaip() they will later be written into the
01264  * image as AAIP extension fields.
01265  *
01266  * A change of this setting does neither affect existing IsoNode objects
01267  * nor the way how ACL and xattr are handled when loading an ISO image.
01268  * The latter is controlled by iso_read_opts_set_no_aaip().
01269  *
01270  * @param image
01271  *     The image of which the behavior is to be controlled
01272  * @param what
01273  *     A bit field which sets the behavior:
01274  *     bit0= ignore ACLs if the external file object bears some
01275  *     bit1= ignore xattr if the external file object bears some
01276  *     all other bits are reserved
01277  *
01278  * @since 0.6.14
01279  */
01280 void iso_image_set_ignore_aclea(IsoImage *image, int what);
01281 
01282 
01283 /**
01284  * Creates an IsoWriteOpts for writing an image. You should set the options
01285  * desired with the correspondent setters.
01286  *
01287  * Options by default are determined by the selected profile. Fifo size is set
01288  * by default to 2 MB.
01289  *
01290  * @param opts
01291  *     Pointer to the location where the newly created IsoWriteOpts will be
01292  *     stored. You should free it with iso_write_opts_free() when no more
01293  *     needed.
01294  * @param profile
01295  *     Default profile for image creation. For now the following values are
01296  *     defined:
01297  *     ---> 0 [BASIC]
01298  *        No extensions are enabled, and ISO level is set to 1. Only suitable
01299  *        for usage for very old and limited systems (like MS-DOS), or by a
01300  *        start point from which to set your custom options.
01301  *     ---> 1 [BACKUP]
01302  *        POSIX compatibility for backup. Simple settings, ISO level is set to
01303  *        3 and RR extensions are enabled. Useful for backup purposes.
01304  *        Note that ACL and xattr are not enabled by default.
01305  *        If you enable them, expect them not to show up in the mounted image.
01306  *        They will have to be retrieved by libisofs applications like xorriso.
01307  *     ---> 2 [DISTRIBUTION]
01308  *        Setting for information distribution. Both RR and Joliet are enabled
01309  *        to maximize compatibility with most systems. Permissions are set to
01310  *        default values, and timestamps to the time of recording.
01311  * @return
01312  *      1 success, < 0 error
01313  *
01314  * @since 0.6.2
01315  */
01316 int iso_write_opts_new(IsoWriteOpts **opts, int profile);
01317 
01318 /**
01319  * Free an IsoWriteOpts previously allocated with iso_write_opts_new().
01320  *
01321  * @since 0.6.2
01322  */
01323 void iso_write_opts_free(IsoWriteOpts *opts);
01324 
01325 /**
01326  * Announce that only the image size is desired, that the struct burn_source
01327  * which is set to consume the image output stream will stay inactive,
01328  * and that the write thread will be cancelled anyway by the .cancel() method
01329  * of the struct burn_source.
01330  * This avoids to create a write thread which would begin production of the
01331  * image stream and would generate a MISHAP event when burn_source.cancel()
01332  * gets into effect.
01333  * 
01334  * @param opts
01335  *      The option set to be manipulated.
01336  * @param will_cancel
01337  *      0= normal image generation
01338  *      1= prepare for being canceled before image stream output is completed
01339  * @return
01340  *      1 success, < 0 error
01341  *
01342  * @since 0.6.40
01343  */
01344 int iso_write_opts_set_will_cancel(IsoWriteOpts *opts, int will_cancel);
01345 
01346 /**
01347  * Set the ISO-9960 level to write at.
01348  *
01349  * @param opts
01350  *      The option set to be manipulated.
01351  * @param level
01352  *      -> 1 for higher compatibility with old systems. With this level
01353  *      filenames are restricted to 8.3 characters.
01354  *      -> 2 to allow up to 31 filename characters.
01355  *      -> 3 to allow files greater than 4GB
01356  * @return
01357  *      1 success, < 0 error
01358  *
01359  * @since 0.6.2
01360  */
01361 int iso_write_opts_set_iso_level(IsoWriteOpts *opts, int level);
01362 
01363 /**
01364  * Whether to use or not Rock Ridge extensions.
01365  *
01366  * This are standard extensions to ECMA-119, intended to add POSIX filesystem
01367  * features to ECMA-119 images. Thus, usage of this flag is highly recommended
01368  * for images used on GNU/Linux systems. With the usage of RR extension, the
01369  * resulting image will have long filenames (up to 255 characters), deeper
01370  * directory structure, POSIX permissions and owner info on files and
01371  * directories, support for symbolic links or special files... All that
01372  * attributes can be modified/setted with the appropiate function.
01373  *
01374  * @param opts
01375  *      The option set to be manipulated.
01376  * @param enable
01377  *      1 to enable RR extension, 0 to not add them
01378  * @return
01379  *      1 success, < 0 error
01380  *
01381  * @since 0.6.2
01382  */
01383 int iso_write_opts_set_rockridge(IsoWriteOpts *opts, int enable);
01384 
01385 /**
01386  * Whether to add the non-standard Joliet extension to the image.
01387  *
01388  * This extensions are heavily used in Microsoft Windows systems, so if you
01389  * plan to use your disc on such a system you should add this extension.
01390  * Usage of Joliet supplies longer filesystem length (up to 64 unicode
01391  * characters), and deeper directory structure.
01392  *
01393  * @param opts
01394  *      The option set to be manipulated.
01395  * @param enable
01396  *      1 to enable Joliet extension, 0 to not add them
01397  * @return
01398  *      1 success, < 0 error
01399  *
01400  * @since 0.6.2
01401  */
01402 int iso_write_opts_set_joliet(IsoWriteOpts *opts, int enable);
01403 
01404 /**
01405  * Whether to add a HFS+ filesystem to the image which points to the same
01406  * file content as the other directory trees.
01407  * It will get marked by an Apple Partition Map in the System Area of the ISO
01408  * image. This may collide with data submitted by
01409  *   iso_write_opts_set_system_area()
01410  * and with settings made by 
01411  *   el_torito_set_isolinux_options()
01412  * The first 8 bytes of the System Area get overwritten by
01413  *   {0x45, 0x52, 0x08 0x00, 0xeb, 0x02, 0xff, 0xff}
01414  * which can be executed as x86 machine code without negative effects.
01415  * So if an MBR gets combined with this feature, then its first 8 bytes
01416  * should contain no essential commands.
01417  * The next blocks of 2 KiB in the System Area will be occupied by APM entries.
01418  * The first one covers the part of the ISO image before the HFS+ filesystem
01419  * metadata. The second one marks the range from HFS+ metadata to the end
01420  * of file content data. If more ISO image data follow, then a third partition
01421  * entry gets produced. Other features of libisofs might cause the need for
01422  * more APM entries.
01423  *
01424  * @param opts
01425  *      The option set to be manipulated.
01426  * @param enable
01427  *      1 to enable HFS+ extension, 0 to not add HFS+ metadata and APM
01428  * @return
01429  *      1 success, < 0 error
01430  *
01431  * @since 1.2.4
01432  */
01433 int iso_write_opts_set_hfsplus(IsoWriteOpts *opts, int enable);
01434 
01435 /**
01436  * >>> Production of FAT32 is not implemented yet.
01437  * >>> This call exists only as preparation for implementation.
01438  *
01439  * Whether to add a FAT32 filesystem to the image which points to the same
01440  * file content as the other directory trees.
01441  *
01442  * >>> FAT32 is planned to get implemented in co-existence with HFS+
01443  * >>> Describe impact on MBR
01444  *
01445  * @param opts
01446  *      The option set to be manipulated.
01447  * @param enable
01448  *      1 to enable FAT32 extension, 0 to not add FAT metadata
01449  * @return
01450  *      1 success, < 0 error
01451  *
01452  * @since 1.2.4
01453  */
01454 int iso_write_opts_set_fat(IsoWriteOpts *opts, int enable);
01455 
01456 /**
01457  * Supply a serial number for the HFS+ extension of the emerging image.
01458  *
01459  * @param opts
01460  *      The option set to be manipulated.
01461  * @param serial_number
01462  *      8 bytes which should be unique to the image.
01463  *      If all bytes are 0, then the serial number will be generated as
01464  *      random number by libisofs. This is the default setting.
01465  * @return
01466  *      1 success, < 0 error
01467  *
01468  * @since 1.2.4
01469  */
01470 int iso_write_opts_set_hfsp_serial_number(IsoWriteOpts *opts,
01471                                           uint8_t serial_number[8]);
01472 
01473 /**
01474  * Set the block size for Apple Partition Map and for HFS+.
01475  *
01476  * @param opts
01477  *      The option set to be manipulated.
01478  * @param hfsp_block_size
01479  *      The allocation block size to be used by the HFS+ fileystem.
01480  *      0, 512, or 2048
01481  * @param hfsp_block_size
01482  *      The block size to be used for and within the Apple Partition Map.
01483  *      0, 512, or 2048.
01484  *      Size 512 is not compatible with options which produce GPT.
01485  * @return
01486  *      1 success, < 0 error
01487  *
01488  * @since 1.2.4
01489  */
01490 int iso_write_opts_set_hfsp_block_size(IsoWriteOpts *opts,
01491                                      int hfsp_block_size, int apm_block_size);
01492 
01493 
01494 /**
01495  * Whether to use newer ISO-9660:1999 version.
01496  *
01497  * This is the second version of ISO-9660. It allows longer filenames and has
01498  * less restrictions than old ISO-9660. However, nobody is using it so there
01499  * are no much reasons to enable this.
01500  *
01501  * @since 0.6.2
01502  */
01503 int iso_write_opts_set_iso1999(IsoWriteOpts *opts, int enable);
01504 
01505 /**
01506  * Control generation of non-unique inode numbers for the emerging image.
01507  * Inode numbers get written as "file serial number" with PX entries as of
01508  * RRIP-1.12. They may mark families of hardlinks.
01509  * RRIP-1.10 prescribes a PX entry without file serial number. If not overriden
01510  * by iso_write_opts_set_rrip_1_10_px_ino() there will be no file serial number
01511  * written into RRIP-1.10 images.
01512  *
01513  * Inode number generation does not affect IsoNode objects which imported their
01514  * inode numbers from the old ISO image (see iso_read_opts_set_new_inos())
01515  * and which have not been altered since import. It rather applies to IsoNode
01516  * objects which were newly added to the image, or to IsoNode which brought no
01517  * inode number from the old image, or to IsoNode where certain properties 
01518  * have been altered since image import.
01519  *
01520  * If two IsoNode are found with same imported inode number but differing
01521  * properties, then one of them will get assigned a new unique inode number.
01522  * I.e. the hardlink relation between both IsoNode objects ends.
01523  *
01524  * @param opts
01525  *      The option set to be manipulated.
01526  * @param enable 
01527  *      1 = Collect IsoNode objects which have identical data sources and
01528  *          properties.
01529  *      0 = Generate unique inode numbers for all IsoNode objects which do not
01530  *          have a valid inode number from an imported ISO image.
01531  *      All other values are reserved.
01532  *
01533  * @since 0.6.20
01534  */
01535 int iso_write_opts_set_hardlinks(IsoWriteOpts *opts, int enable);
01536 
01537 /**
01538  * Control writing of AAIP informations for ACL and xattr.
01539  * For importing ACL and xattr when inserting nodes from external filesystems
01540  * (e.g. the local POSIX filesystem) see iso_image_set_ignore_aclea().
01541  * For loading of this information from images see iso_read_opts_set_no_aaip().
01542  *
01543  * @param opts
01544  *      The option set to be manipulated.
01545  * @param enable
01546  *      1 = write AAIP information from nodes into the image
01547  *      0 = do not write AAIP information into the image
01548  *      All other values are reserved.
01549  *
01550  * @since 0.6.14
01551  */
01552 int iso_write_opts_set_aaip(IsoWriteOpts *opts, int enable);
01553 
01554 /**
01555  * Use this only if you need to reproduce a suboptimal behavior of older
01556  * versions of libisofs. They used address 0 for links and device files,
01557  * and the address of the Volume Descriptor Set Terminator for empty data
01558  * files.
01559  * New versions let symbolic links, device files, and empty data files point
01560  * to a dedicated block of zero-bytes after the end of the directory trees.
01561  * (Single-pass reader libarchive needs to see all directory info before
01562  *  processing any data files.)
01563  *
01564  * @param opts
01565  *      The option set to be manipulated.
01566  * @param enable
01567  *      1 = use the suboptimal block addresses in the range of 0 to 115.
01568  *      0 = use the address of a block after the directory tree. (Default)
01569  *
01570  * @since 1.0.2
01571  */
01572 int iso_write_opts_set_old_empty(IsoWriteOpts *opts, int enable);
01573 
01574 /**
01575  * Caution: This option breaks any assumptions about names that
01576  *          are supported by ECMA-119 specifications. 
01577  * Try to omit any translation which would make a file name compliant to the
01578  * ECMA-119 rules. This includes and exceeds omit_version_numbers,
01579  * max_37_char_filenames, no_force_dots bit0, allow_full_ascii. Further it
01580  * prevents the conversion from local character set to ASCII.
01581  * The maximum name length is given by this call. If a filename exceeds
01582  * this length or cannot be recorded untranslated for other reasons, then
01583  * image production is aborted with ISO_NAME_NEEDS_TRANSL.
01584  * Currently the length limit is 96 characters, because an ECMA-119 directory
01585  * record may at most have 254 bytes and up to 158 other bytes must fit into
01586  * the record. Probably 96 more bytes can be made free for the name in future.
01587  * @param opts
01588  *      The option set to be manipulated.
01589  * @param len
01590  *      0 = disable this feature and perform name translation according to
01591  *          other settings.
01592  *     >0 = Omit any translation. Eventually abort image production
01593  *          if a name is longer than the given value.
01594  *     -1 = Like >0. Allow maximum possible length (currently 96)
01595  * @return >=0 success, <0 failure
01596  *         In case of >=0 the return value tells the effectively set len.
01597  *         E.g. 96 after using len == -1.
01598  * @since 1.0.0
01599  */
01600 int iso_write_opts_set_untranslated_name_len(IsoWriteOpts *opts, int len);
01601 
01602 /**
01603  * Convert directory names for ECMA-119 similar to other file names, but do
01604  * not force a dot or add a version number.
01605  * This violates ECMA-119 by allowing one "." and especially ISO level 1 
01606  * by allowing DOS style 8.3 names rather than only 8 characters.
01607  * (mkisofs and its clones seem to do this violation.)
01608  * @param opts
01609  *      The option set to be manipulated.
01610  * @param allow
01611  *      1= allow dots , 0= disallow dots and convert them
01612  * @return
01613  *      1 success, < 0 error
01614  * @since 1.0.0
01615  */
01616 int iso_write_opts_set_allow_dir_id_ext(IsoWriteOpts *opts, int allow);
01617 
01618 /**
01619  * Omit the version number (";1") at the end of the ISO-9660 identifiers.
01620  * This breaks ECMA-119 specification, but version numbers are usually not
01621  * used, so it should work on most systems. Use with caution.
01622  * @param opts
01623  *      The option set to be manipulated.
01624  * @param omit
01625  *      bit0= omit version number with ECMA-119 and Joliet
01626  *      bit1= omit version number with Joliet alone (@since 0.6.30)
01627  * @since 0.6.2
01628  */
01629 int iso_write_opts_set_omit_version_numbers(IsoWriteOpts *opts, int omit);
01630 
01631 /**
01632  * Allow ISO-9660 directory hierarchy to be deeper than 8 levels.
01633  * This breaks ECMA-119 specification. Use with caution.
01634  *
01635  * @since 0.6.2
01636  */
01637 int iso_write_opts_set_allow_deep_paths(IsoWriteOpts *opts, int allow);
01638 
01639 /**
01640  * This call describes the directory where to store Rock Ridge relocated
01641  * directories.
01642  * If not iso_write_opts_set_allow_deep_paths(,1) is in effect, then it may
01643  * become necessary to relocate directories so that no ECMA-119 file path
01644  * has more than 8 components. These directories are grafted into either
01645  * the root directory of the ISO image or into a dedicated relocation
01646  * directory.
01647  * For Rock Ridge, the relocated directories are linked forth and back to
01648  * placeholders at their original positions in path level 8. Directories
01649  * marked by Rock Ridge entry RE are to be considered artefacts of relocation
01650  * and shall not be read into a Rock Ridge tree. Instead they are to be read
01651  * via their placeholders and their links.
01652  * For plain ECMA-119, the relocation directory and the relocated directories
01653  * are just normal directories which contain normal files and directories.
01654  * @param opts
01655  *      The option set to be manipulated.
01656  * @param name
01657  *      The name of the relocation directory in the root directory. Do not
01658  *      prepend "/". An empty name or NULL will direct relocated directories
01659  *      into the root directory. This is the default.
01660  *      If the given name does not exist in the root directory when
01661  *      iso_image_create_burn_source() is called, and if there are directories
01662  *      at path level 8, then directory /name will be created automatically.
01663  *      The name given by this call will be compared with iso_node_get_name()
01664  *      of the directories in the root directory, not with the final ECMA-119
01665  *      names of those directories.
01666  * @parm flags
01667  *      Bitfield for control purposes.
01668  *      bit0= Mark the relocation directory by a Rock Ridge RE entry, if it
01669  *            gets created during iso_image_create_burn_source(). This will
01670  *            make it invisible for most Rock Ridge readers.
01671  *      bit1= not settable via API (used internally)
01672  * @return
01673  *      1 success, < 0 error
01674  * @since 1.2.2
01675 */
01676 int iso_write_opts_set_rr_reloc(IsoWriteOpts *opts, char *name, int flags);
01677 
01678 /**
01679  * Allow path in the ISO-9660 tree to have more than 255 characters.
01680  * This breaks ECMA-119 specification. Use with caution.
01681  *
01682  * @since 0.6.2
01683  */
01684 int iso_write_opts_set_allow_longer_paths(IsoWriteOpts *opts, int allow);
01685 
01686 /**
01687  * Allow a single file or directory identifier to have up to 37 characters.
01688  * This is larger than the 31 characters allowed by ISO level 2, and the
01689  * extra space is taken from the version number, so this also forces
01690  * omit_version_numbers.
01691  * This breaks ECMA-119 specification and could lead to buffer overflow
01692  * problems on old systems. Use with caution.
01693  *
01694  * @since 0.6.2
01695  */
01696 int iso_write_opts_set_max_37_char_filenames(IsoWriteOpts *opts, int allow);
01697 
01698 /**
01699  * ISO-9660 forces filenames to have a ".", that separates file name from
01700  * extension. libisofs adds it if original filename doesn't has one. Set
01701  * this to 1 to prevent this behavior.
01702  * This breaks ECMA-119 specification. Use with caution.
01703  *
01704  * @param opts
01705  *      The option set to be manipulated.
01706  * @param no
01707  *      bit0= no forced dot with ECMA-119
01708  *      bit1= no forced dot with Joliet (@since 0.6.30)
01709  *
01710  * @since 0.6.2
01711  */
01712 int iso_write_opts_set_no_force_dots(IsoWriteOpts *opts, int no);
01713 
01714 /**
01715  * Allow lowercase characters in ISO-9660 filenames. By default, only
01716  * uppercase characters, numbers and a few other characters are allowed.
01717  * This breaks ECMA-119 specification. Use with caution.
01718  * If lowercase is not allowed then those letters get mapped to uppercase
01719  * letters.
01720  *
01721  * @since 0.6.2
01722  */
01723 int iso_write_opts_set_allow_lowercase(IsoWriteOpts *opts, int allow);
01724 
01725 /**
01726  * Allow all 8-bit characters to appear on an ISO-9660 filename. Note
01727  * that "/" and 0x0 characters are never allowed, even in RR names.
01728  * This breaks ECMA-119 specification. Use with caution.
01729  *
01730  * @since 0.6.2
01731  */
01732 int iso_write_opts_set_allow_full_ascii(IsoWriteOpts *opts, int allow);
01733 
01734 /**
01735  * If not iso_write_opts_set_allow_full_ascii() is set to 1:
01736  * Allow all 7-bit characters that would be allowed by allow_full_ascii, but
01737  * map lowercase to uppercase if iso_write_opts_set_allow_lowercase()
01738  * is not set to 1.
01739  * @param opts    
01740  *      The option set to be manipulated.
01741  * @param allow
01742  *      If not zero, then allow what is described above.
01743  *
01744  * @since 1.2.2
01745  */
01746 int iso_write_opts_set_allow_7bit_ascii(IsoWriteOpts *opts, int allow);
01747 
01748 /**
01749  * Allow all characters to be part of Volume and Volset identifiers on
01750  * the Primary Volume Descriptor. This breaks ISO-9660 contraints, but
01751  * should work on modern systems.
01752  *
01753  * @since 0.6.2
01754  */
01755 int iso_write_opts_set_relaxed_vol_atts(IsoWriteOpts *opts, int allow);
01756 
01757 /**
01758  * Allow paths in the Joliet tree to have more than 240 characters.
01759  * This breaks Joliet specification. Use with caution.
01760  *
01761  * @since 0.6.2
01762  */
01763 int iso_write_opts_set_joliet_longer_paths(IsoWriteOpts *opts, int allow);
01764 
01765 /**
01766  * Allow leaf names in the Joliet tree to have up to 103 characters.
01767  * Normal limit is 64. 
01768  * This breaks Joliet specification. Use with caution.
01769  *
01770  * @since 1.0.6
01771  */
01772 int iso_write_opts_set_joliet_long_names(IsoWriteOpts *opts, int allow);
01773 
01774 /**
01775  * Write Rock Ridge info as of specification RRIP-1.10 rather than RRIP-1.12:
01776  * signature "RRIP_1991A" rather than "IEEE_1282", field PX without file
01777  * serial number.
01778  *
01779  * @since 0.6.12
01780  */
01781 int iso_write_opts_set_rrip_version_1_10(IsoWriteOpts *opts, int oldvers);
01782 
01783 /**
01784  * Write field PX with file serial number (i.e. inode number) even if
01785  * iso_write_opts_set_rrip_version_1_10(,1) is in effect.
01786  * This clearly violates the RRIP-1.10 specs. But it is done by mkisofs since
01787  * a while and no widespread protest is visible in the web.
01788  * If this option is not enabled, then iso_write_opts_set_hardlinks() will
01789  * only have an effect with iso_write_opts_set_rrip_version_1_10(,0).
01790  * 
01791  * @since 0.6.20
01792  */
01793 int iso_write_opts_set_rrip_1_10_px_ino(IsoWriteOpts *opts, int enable);
01794 
01795 /**
01796  * Write AAIP as extension according to SUSP 1.10 rather than SUSP 1.12.
01797  * I.e. without announcing it by an ER field and thus without the need
01798  * to preceed the RRIP fields and the AAIP field by ES fields.
01799  * This saves 5 to 10 bytes per file and might avoid problems with readers
01800  * which dislike ER fields other than the ones for RRIP.
01801  * On the other hand, SUSP 1.12 frowns on such unannounced extensions 
01802  * and prescribes ER and ES. It does this since the year 1994.
01803  *
01804  * In effect only if above iso_write_opts_set_aaip() enables writing of AAIP.
01805  *
01806  * @since 0.6.14
01807  */
01808 int iso_write_opts_set_aaip_susp_1_10(IsoWriteOpts *opts, int oldvers);
01809 
01810 /**
01811  * Store as ECMA-119 Directory Record timestamp the mtime of the source node
01812  * rather than the image creation time.
01813  * If storing of mtime is enabled, then the settings of
01814  * iso_write_opts_set_replace_timestamps() apply. (replace==1 will revoke,
01815  * replace==2 will override mtime by iso_write_opts_set_default_timestamp().
01816  *
01817  * Since version 1.2.0 this may apply also to Joliet and ISO 9660:1999. To
01818  * reduce the probability of unwanted behavior changes between pre-1.2.0 and
01819  * post-1.2.0, the bits for Joliet and ISO 9660:1999 also enable ECMA-119.
01820  * The hopefully unlikely bit14 may then be used to disable mtime for ECMA-119.
01821  *
01822  * To enable mtime for all three directory trees, submit 7.
01823  * To disable this feature completely, submit 0.
01824  *
01825  * @param opts    
01826  *      The option set to be manipulated.
01827  * @param allow
01828  *      If this parameter is negative, then mtime is enabled only for ECMA-119.
01829  *      With positive numbers, the parameter is interpreted as bit field :
01830  *          bit0= enable mtime for ECMA-119 
01831  *          bit1= enable mtime for Joliet and ECMA-119
01832  *          bit2= enable mtime for ISO 9660:1999 and ECMA-119
01833  *          bit14= disable mtime for ECMA-119 although some of the other bits
01834  *                 would enable it
01835  *          @since 1.2.0
01836  *      Before version 1.2.0 this applied only to ECMA-119 :
01837  *          0 stored image creation time in ECMA-119 tree.
01838  *          Any other value caused storing of mtime.
01839  *          Joliet and ISO 9660:1999 always stored the image creation time.
01840  * @since 0.6.12
01841  */
01842 int iso_write_opts_set_dir_rec_mtime(IsoWriteOpts *opts, int allow);
01843 
01844 /**
01845  * Whether to sort files based on their weight.
01846  *
01847  * @see iso_node_set_sort_weight
01848  * @since 0.6.2
01849  */
01850 int iso_write_opts_set_sort_files(IsoWriteOpts *opts, int sort);
01851 
01852 /**
01853  * Whether to compute and record MD5 checksums for the whole session and/or
01854  * for each single IsoFile object. The checksums represent the data as they
01855  * were written into the image output stream, not necessarily as they were
01856  * on hard disk at any point of time.
01857  * See also calls iso_image_get_session_md5() and iso_file_get_md5().
01858  * @param opts
01859  *      The option set to be manipulated.
01860  * @param session
01861  *      If bit0 set: Compute session checksum
01862  * @param files
01863  *      If bit0 set: Compute a checksum for each single IsoFile object which
01864  *                   gets its data content written into the session. Copy
01865  *                   checksums from files which keep their data in older
01866  *                   sessions.
01867  *      If bit1 set: Check content stability (only with bit0). I.e.  before
01868  *                   writing the file content into to image stream, read it
01869  *                   once and compute a MD5. Do a second reading for writing
01870  *                   into the image stream. Afterwards compare both MD5 and
01871  *                   issue a MISHAP event ISO_MD5_STREAM_CHANGE if they do not
01872  *                   match.
01873  *                   Such a mismatch indicates content changes between the
01874  *                   time point when the first MD5 reading started and the
01875  *                   time point when the last block was read for writing.
01876  *                   So there is high risk that the image stream was fed from
01877  *                   changing and possibly inconsistent file content.
01878  *                   
01879  * @since 0.6.22
01880  */
01881 int iso_write_opts_set_record_md5(IsoWriteOpts *opts, int session, int files);
01882 
01883 /**
01884  * Set the parameters "name" and "timestamp" for a scdbackup checksum tag.
01885  * It will be appended to the libisofs session tag if the image starts at
01886  * LBA 0 (see iso_write_opts_set_ms_block()). The scdbackup tag can be used
01887  * to verify the image by command scdbackup_verify device -auto_end.
01888  * See scdbackup/README appendix VERIFY for its inner details.
01889  *
01890  * @param opts
01891  *      The option set to be manipulated.
01892  * @param name
01893  *      A word of up to 80 characters. Typically volno_totalno telling
01894  *      that this is volume volno of a total of totalno volumes.
01895  * @param timestamp
01896  *      A string of 13 characters YYMMDD.hhmmss (e.g. A90831.190324).
01897  *      A9 = 2009, B0 = 2010, B1 = 2011, ... C0 = 2020, ...
01898  * @param tag_written
01899  *      Either NULL or the address of an array with at least 512 characters.
01900  *      In the latter case the eventually produced scdbackup tag will be
01901  *      copied to this array when the image gets written. This call sets
01902  *      scdbackup_tag_written[0] = 0 to mark its preliminary invalidity.
01903  * @return
01904  *      1 indicates success, <0 is error
01905  *
01906  * @since 0.6.24
01907  */
01908 int iso_write_opts_set_scdbackup_tag(IsoWriteOpts *opts,
01909                                      char *name, char *timestamp,
01910                                      char *tag_written);
01911 
01912 /**
01913  * Whether to set default values for files and directory permissions, gid and
01914  * uid. All these take one of three values: 0, 1 or 2.
01915  *
01916  * If 0, the corresponding attribute will be kept as set in the IsoNode.
01917  * Unless you have changed it, it corresponds to the value on disc, so it
01918  * is suitable for backup purposes. If set to 1, the corresponding attrib.
01919  * will be changed by a default suitable value. Finally, if you set it to
01920  * 2, the attrib. will be changed with the value specified by the functioins
01921  * below. Note that for mode attributes, only the permissions are set, the
01922  * file type remains unchanged.
01923  *
01924  * @see iso_write_opts_set_default_dir_mode
01925  * @see iso_write_opts_set_default_file_mode
01926  * @see iso_write_opts_set_default_uid
01927  * @see iso_write_opts_set_default_gid
01928  * @since 0.6.2
01929  */
01930 int iso_write_opts_set_replace_mode(IsoWriteOpts *opts, int dir_mode,
01931                                     int file_mode, int uid, int gid);
01932 
01933 /**
01934  * Set the mode to use on dirs when you set the replace_mode of dirs to 2.
01935  *
01936  * @see iso_write_opts_set_replace_mode
01937  * @since 0.6.2
01938  */
01939 int iso_write_opts_set_default_dir_mode(IsoWriteOpts *opts, mode_t dir_mode);
01940 
01941 /**
01942  * Set the mode to use on files when you set the replace_mode of files to 2.
01943  *
01944  * @see iso_write_opts_set_replace_mode
01945  * @since 0.6.2
01946  */
01947 int iso_write_opts_set_default_file_mode(IsoWriteOpts *opts, mode_t file_mode);
01948 
01949 /**
01950  * Set the uid to use when you set the replace_uid to 2.
01951  *
01952  * @see iso_write_opts_set_replace_mode
01953  * @since 0.6.2
01954  */
01955 int iso_write_opts_set_default_uid(IsoWriteOpts *opts, uid_t uid);
01956 
01957 /**
01958  * Set the gid to use when you set the replace_gid to 2.
01959  *
01960  * @see iso_write_opts_set_replace_mode
01961  * @since 0.6.2
01962  */
01963 int iso_write_opts_set_default_gid(IsoWriteOpts *opts, gid_t gid);
01964 
01965 /**
01966  * 0 to use IsoNode timestamps, 1 to use recording time, 2 to use
01967  * values from timestamp field. This applies to the timestamps of Rock Ridge
01968  * and if the use of mtime is enabled by iso_write_opts_set_dir_rec_mtime().
01969  * In the latter case, value 1 will revoke the recording of mtime, value
01970  * 2 will override mtime by iso_write_opts_set_default_timestamp().
01971  *
01972  * @see iso_write_opts_set_default_timestamp
01973  * @since 0.6.2
01974  */
01975 int iso_write_opts_set_replace_timestamps(IsoWriteOpts *opts, int replace);
01976 
01977 /**
01978  * Set the timestamp to use when you set the replace_timestamps to 2.
01979  *
01980  * @see iso_write_opts_set_replace_timestamps
01981  * @since 0.6.2
01982  */
01983 int iso_write_opts_set_default_timestamp(IsoWriteOpts *opts, time_t timestamp);
01984 
01985 /**
01986  * Whether to always record timestamps in GMT.
01987  *
01988  * By default, libisofs stores local time information on image. You can set
01989  * this to always store timestamps converted to GMT. This prevents any
01990  * discrimination of the timezone of the image preparer by the image reader.
01991  *
01992  * It is useful if you want to hide your timezone, or you live in a timezone
01993  * that can't be represented in ECMA-119. These are timezones with an offset
01994  * from GMT greater than +13 hours, lower than -12 hours, or not a multiple
01995  * of 15 minutes.
01996  * Negative timezones (west of GMT) can trigger bugs in some operating systems
01997  * which typically appear in mounted ISO images as if the timezone shift from
01998  * GMT was applied twice (e.g. in New York 22:36 becomes 17:36).
01999  *
02000  * @since 0.6.2
02001  */
02002 int iso_write_opts_set_always_gmt(IsoWriteOpts *opts, int gmt);
02003 
02004 /**
02005  * Set the charset to use for the RR names of the files that will be created
02006  * on the image.
02007  * NULL to use default charset, that is the locale charset.
02008  * You can obtain the list of charsets supported on your system executing
02009  * "iconv -l" in a shell.
02010  *
02011  * @since 0.6.2
02012  */
02013 int iso_write_opts_set_output_charset(IsoWriteOpts *opts, const char *charset);
02014 
02015 /**
02016  * Set the type of image creation in case there was already an existing
02017  * image imported. Libisofs supports two types of creation:
02018  * stand-alone and appended.
02019  *
02020  * A stand-alone image is an image that does not need the old image any more
02021  * for being mounted by the operating system or imported by libisofs. It may
02022  * be written beginning with byte 0 of optical media or disk file objects. 
02023  * There will be no distinction between files from the old image and those
02024  * which have been added by the new image generation.
02025  *
02026  * On the other side, an appended image is not self contained. It may refer
02027  * to files that stay stored in the imported existing image.
02028  * This usage model is inspired by CD multi-session. It demands that the
02029  * appended image is finally written to the same media resp. disk file
02030  * as the imported image at an address behind the end of that imported image.
02031  * The exact address may depend on media peculiarities and thus has to be
02032  * announced by the application via iso_write_opts_set_ms_block().
02033  * The real address where the data will be written is under control of the
02034  * consumer of the struct burn_source which takes the output of libisofs
02035  * image generation. It may be the one announced to libisofs or an intermediate
02036  * one. Nevertheless, the image will be readable only at the announced address.
02037  *
02038  * If you have not imported a previous image by iso_image_import(), then the
02039  * image will always be a stand-alone image, as there is no previous data to
02040  * refer to. 
02041  *
02042  * @param opts
02043  *      The option set to be manipulated.
02044  * @param append
02045  *      1 to create an appended image, 0 for an stand-alone one.
02046  *
02047  * @since 0.6.2
02048  */
02049 int iso_write_opts_set_appendable(IsoWriteOpts *opts, int append);
02050 
02051 /**
02052  * Set the start block of the image. It is supposed to be the lba where the
02053  * first block of the image will be written on disc. All references inside the
02054  * ISO image will take this into account, thus providing a mountable image.
02055  *
02056  * For appendable images, that are written to a new session, you should
02057  * pass here the lba of the next writable address on disc.
02058  *
02059  * In stand alone images this is usually 0. However, you may want to
02060  * provide a different ms_block if you don't plan to burn the image in the
02061  * first session on disc, such as in some CD-Extra disc whether the data
02062  * image is written in a new session after some audio tracks.
02063  *
02064  * @since 0.6.2
02065  */
02066 int iso_write_opts_set_ms_block(IsoWriteOpts *opts, uint32_t ms_block);
02067 
02068 /**
02069  * Sets the buffer where to store the descriptors which shall be written
02070  * at the beginning of an overwriteable media to point to the newly written
02071  * image.
02072  * This is needed if the write start address of the image is not 0.
02073  * In this case the first 64 KiB of the media have to be overwritten
02074  * by the buffer content after the session was written and the buffer
02075  * was updated by libisofs. Otherwise the new session would not be
02076  * found by operating system function mount() or by libisoburn.
02077  * (One could still mount that session if its start address is known.)
02078  *
02079  * If you do not need this information, for example because you are creating a
02080  * new image for LBA 0 or because you will create an image for a true
02081  * multisession media, just do not use this call or set buffer to NULL.
02082  *
02083  * Use cases:
02084  *
02085  * - Together with iso_write_opts_set_appendable(opts, 1) the buffer serves
02086  *   for the growing of an image as done in growisofs by Andy Polyakov.
02087  *   This allows appending of a new session to non-multisession media, such
02088  *   as DVD+RW. The new session will refer to the data of previous sessions
02089  *   on the same media.
02090  *   libisoburn emulates multisession appendability on overwriteable media
02091  *   and disk files by performing this use case.
02092  *
02093  * - Together with iso_write_opts_set_appendable(opts, 0) the buffer allows
02094  *   to write the first session on overwriteable media to start addresses
02095  *   other than 0.
02096  *   This address must not be smaller than 32 blocks plus the eventual
02097  *   partition offset as defined by iso_write_opts_set_part_offset().
02098  *   libisoburn in most cases writes the first session on overwriteable media
02099  *   and disk files to LBA (32 + partition_offset) in order to preserve its
02100  *   descriptors from the subsequent overwriting by the descriptor buffer of
02101  *   later sessions.
02102  *
02103  * @param opts
02104  *      The option set to be manipulated.
02105  * @param overwrite
02106  *      When not NULL, it should point to at least 64KiB of memory, where
02107  *      libisofs will install the contents that shall be written at the
02108  *      beginning of overwriteable media.
02109  *      You should initialize the buffer either with 0s, or with the contents
02110  *      of the first 32 blocks of the image you are growing. In most cases,
02111  *      0 is good enought.
02112  *      IMPORTANT: If you use iso_write_opts_set_part_offset() then the
02113  *                 overwrite buffer must be larger by the offset defined there.
02114  *
02115  * @since 0.6.2
02116  */
02117 int iso_write_opts_set_overwrite_buf(IsoWriteOpts *opts, uint8_t *overwrite);
02118 
02119 /**
02120  * Set the size, in number of blocks, of the ring buffer used between the
02121  * writer thread and the burn_source. You have to provide at least a 32
02122  * blocks buffer. Default value is set to 2MB, if that is ok for you, you
02123  * don't need to call this function.
02124  *
02125  * @since 0.6.2
02126  */
02127 int iso_write_opts_set_fifo_size(IsoWriteOpts *opts, size_t fifo_size);
02128 
02129 /*
02130  * Attach 32 kB of binary data which shall get written to the first 32 kB 
02131  * of the ISO image, the ECMA-119 System Area. This space is intended for
02132  * system dependent boot software, e.g. a Master Boot Record which allows to
02133  * boot from USB sticks or hard disks. ECMA-119 makes no own assumptions or
02134  * prescriptions about the byte content.
02135  *
02136  * If system area data are given or options bit0 is set, then bit1 of
02137  * el_torito_set_isolinux_options() is automatically disabled.
02138  *
02139  * @param opts
02140  *      The option set to be manipulated.
02141  * @param data
02142  *        Either NULL or 32 kB of data. Do not submit less bytes !
02143  * @param options
02144  *        Can cause manipulations of submitted data before they get written:
02145  *        bit0= Only with System area type 0 = MBR
02146  *              Apply a --protective-msdos-label as of grub-mkisofs.
02147  *              This means to patch bytes 446 to 512 of the system area so
02148  *              that one partition is defined which begins at the second
02149  *              512-byte block of the image and ends where the image ends.
02150  *              This works with and without system_area_data.
02151  *        bit1= Only with System area type 0 = MBR
02152  *              Apply isohybrid MBR patching to the system area.
02153  *              This works only with system area data from SYSLINUX plus an
02154  *              ISOLINUX boot image (see iso_image_set_boot_image()) and
02155  *              only if not bit0 is set.
02156  *        bit2-7= System area type
02157  *              0= with bit0 or bit1: MBR
02158  *                 else: unspecified type which will be used unaltered.
02159  *              @since 0.6.38
02160  *              1= MIPS Big Endian Volume Header
02161  *                 Submit up to 15 MIPS Big Endian boot files by
02162  *                 iso_image_add_mips_boot_file().
02163  *                 This will overwrite the first 512 bytes of the submitted
02164  *                 data.
02165  *              2= DEC Boot Block for MIPS Little Endian
02166  *                 The first boot file submitted by
02167  *                 iso_image_add_mips_boot_file() will be activated.
02168  *                 This will overwrite the first 512 bytes of the submitted
02169  *                 data.
02170  *              @since 0.6.40
02171  *              3= SUN Disk Label for SUN SPARC
02172  *                 Submit up to 7 SPARC boot images by
02173  *                 iso_write_opts_set_partition_img() for partition numbers 2
02174  *                 to 8.
02175  *                 This will overwrite the first 512 bytes of the submitted
02176  *        bit8-9= Only with System area type 0 = MBR
02177  *              @since 1.0.4
02178  *              Cylinder alignment mode eventually pads the image to make it
02179  *              end at a cylinder boundary.
02180  *                0 = auto (align if bit1)
02181  *                1 = always align to cylinder boundary
02182  *                2 = never align to cylinder boundary
02183  *                3 = always align, additionally pad up and align partitions
02184  *                    which were appended by iso_write_opts_set_partition_img()
02185  *                    @since 1.2.6
02186  *        bit10-13= System area sub type
02187  *              @since 1.2.4
02188  *              With type 0 = MBR:
02189  *                Gets overridden by bit0 and bit1.
02190  *                0 = no particular sub type
02191  *                1 = CHRP: A single MBR partition of type 0x96 covers the
02192  *                          ISO image. Not compatible with any other feature
02193  *                          which needs to have own MBR partition entries.
02194  * @param flag
02195  *        bit0 = invalidate any attached system area data. Same as data == NULL
02196  *               (This re-activates eventually loaded image System Area data.
02197  *                To erase those, submit 32 kB of zeros without flag bit0.)
02198  *        bit1 = keep data unaltered
02199  *        bit2 = keep options unaltered
02200  * @return
02201  *      ISO_SUCCESS or error
02202  * @since 0.6.30
02203  */
02204 int iso_write_opts_set_system_area(IsoWriteOpts *opts, char data[32768],
02205                                    int options, int flag);
02206 
02207 /**
02208  * Set a name for the system area. This setting is ignored unless system area
02209  * type 3 "SUN Disk Label" is in effect by iso_write_opts_set_system_area().
02210  * In this case it will replace the default text at the start of the image:
02211  *   "CD-ROM Disc with Sun sparc boot created by libisofs"
02212  *
02213  * @param opts
02214  *      The option set to be manipulated.
02215  * @param label
02216  *      A text of up to 128 characters.
02217  * @return
02218  *      ISO_SUCCESS or error
02219  * @since 0.6.40
02220 */
02221 int iso_write_opts_set_disc_label(IsoWriteOpts *opts, char *label);
02222 
02223 /**
02224  * Explicitely set the four timestamps of the emerging Primary Volume
02225  * Descriptor and in the volume descriptors of Joliet and ISO 9660:1999,
02226  * if those are to be generated.
02227  * Default with all parameters is 0.
02228  *
02229  * ECMA-119 defines them as:
02230  * @param opts
02231  *        The option set to be manipulated.
02232  * @param vol_creation_time
02233  *        When "the information in the volume was created."
02234  *        A value of 0 means that the timepoint of write start is to be used.
02235  * @param vol_modification_time
02236  *        When "the information in the volume was last modified."
02237  *        A value of 0 means that the timepoint of write start is to be used.
02238  * @param vol_expiration_time
02239  *        When "the information in the volume may be regarded as obsolete."
02240  *        A value of 0 means that the information never shall expire.
02241  * @param vol_effective_time
02242  *        When "the information in the volume may be used."
02243  *        A value of 0 means that not such retention is intended.
02244  * @param vol_uuid
02245  *        If this text is not empty, then it overrides vol_creation_time and
02246  *        vol_modification_time by copying the first 16 decimal digits from
02247  *        uuid, eventually padding up with decimal '1', and writing a NUL-byte
02248  *        as timezone.
02249  *        Other than with vol_*_time the resulting string in the ISO image
02250  *        is fully predictable and free of timezone pitfalls.
02251  *        It should express a reasonable time in form  YYYYMMDDhhmmsscc
02252  *        E.g.:  "2010040711405800" = 7 Apr 2010 11:40:58 (+0 centiseconds)
02253  * @return
02254  *        ISO_SUCCESS or error
02255  *
02256  * @since 0.6.30
02257  */
02258 int iso_write_opts_set_pvd_times(IsoWriteOpts *opts,
02259                         time_t vol_creation_time, time_t vol_modification_time,
02260                         time_t vol_expiration_time, time_t vol_effective_time,
02261                         char *vol_uuid);
02262 
02263 
02264 /*
02265  * Control production of a second set of volume descriptors (superblock)
02266  * and directory trees, together with a partition table in the MBR where the
02267  * first partition has non-zero start address and the others are zeroed.
02268  * The first partition stretches to the end of the whole ISO image.
02269  * The additional volume descriptor set and trees will allow to mount the
02270  * ISO image at the start of the first partition, while it is still possible
02271  * to mount it via the normal first volume descriptor set and tree at the
02272  * start of the image resp. storage device.
02273  * This makes few sense on optical media. But on USB sticks it creates a
02274  * conventional partition table which makes it mountable on e.g. Linux via
02275  * /dev/sdb and /dev/sdb1 alike.
02276  * IMPORTANT: When submitting memory by iso_write_opts_set_overwrite_buf()
02277  *            then its size must be at least 64 KiB + partition offset. 
02278  *
02279  * @param opts
02280  *        The option set to be manipulated.
02281  * @param block_offset_2k
02282  *        The offset of the partition start relative to device start.
02283  *        This is counted in 2 kB blocks. The partition table will show the
02284  *        according number of 512 byte sectors.
02285  *        Default is 0 which causes no special partition table preparations.
02286  *        If it is not 0 then it must not be smaller than 16.
02287  * @param secs_512_per_head
02288  *        Number of 512 byte sectors per head. 1 to 63. 0=automatic.
02289  * @param heads_per_cyl
02290  *        Number of heads per cylinder. 1 to 255. 0=automatic.
02291  * @return
02292  *        ISO_SUCCESS or error
02293  *
02294  * @since 0.6.36
02295  */
02296 int iso_write_opts_set_part_offset(IsoWriteOpts *opts,
02297                                    uint32_t block_offset_2k,
02298                                    int secs_512_per_head, int heads_per_cyl);
02299 
02300 
02301 /** The minimum version of libjte to be used with this version of libisofs
02302     at compile time. The use of libjte is optional and depends on configure
02303     tests. It can be prevented by ./configure option --disable-libjte .
02304     @since 0.6.38
02305 */
02306 #define iso_libjte_req_major 1
02307 #define iso_libjte_req_minor 0
02308 #define iso_libjte_req_micro 0
02309 
02310 /** 
02311  * Associate a libjte environment object to the upcomming write run.
02312  * libjte implements Jigdo Template Extraction as of Steve McIntyre and
02313  * Richard Atterer.
02314  * The call will fail if no libjte support was enabled at compile time.
02315  * @param opts
02316  *        The option set to be manipulated.
02317  * @param libjte_handle
02318  *        Pointer to a struct libjte_env e.g. created by libjte_new().
02319  *        It must stay existent from the start of image generation by
02320  *        iso_image_create_burn_source() until the write thread has ended.
02321  *        This can be inquired by iso_image_generator_is_running().
02322  *        In order to keep the libisofs API identical with and without
02323  *        libjte support the parameter type is (void *).
02324  * @return
02325  *        ISO_SUCCESS or error
02326  *
02327  * @since 0.6.38
02328 */
02329 int iso_write_opts_attach_jte(IsoWriteOpts *opts, void *libjte_handle);
02330 
02331 /**
02332  * Remove eventual association to a libjte environment handle.
02333  * The call will fail if no libjte support was enabled at compile time.
02334  * @param opts
02335  *        The option set to be manipulated.
02336  * @param libjte_handle
02337  *        If not submitted as NULL, this will return the previously set
02338  *        libjte handle. 
02339  * @return
02340  *        ISO_SUCCESS or error
02341  *
02342  * @since 0.6.38
02343 */
02344 int iso_write_opts_detach_jte(IsoWriteOpts *opts, void **libjte_handle);
02345 
02346 
02347 /**
02348  * Cause a number of blocks with zero bytes to be written after the payload
02349  * data, but before the eventual checksum data. Unlike libburn tail padding,
02350  * these blocks are counted as part of the image and covered by eventual
02351  * image checksums.
02352  * A reason for such padding can be the wish to prevent the Linux read-ahead
02353  * bug by sacrificial data which still belong to image and Jigdo template.
02354  * Normally such padding would be the job of the burn program which should know
02355  * that it is needed with CD write type TAO if Linux read(2) shall be able
02356  * to read all payload blocks.
02357  * 150 blocks = 300 kB is the traditional sacrifice to the Linux kernel.
02358  * @param opts
02359  *        The option set to be manipulated.
02360  * @param num_blocks
02361  *        Number of extra 2 kB blocks to be written.
02362  * @return
02363  *        ISO_SUCCESS or error
02364  *
02365  * @since 0.6.38
02366  */
02367 int iso_write_opts_set_tail_blocks(IsoWriteOpts *opts, uint32_t num_blocks);
02368 
02369 /**
02370  * Copy a data file from the local filesystem into the emerging ISO image.
02371  * Mark it by an MBR partition entry as PreP partition and also cause
02372  * protective MBR partition entries before and after this partition.
02373  * Vladimir Serbinenko stated aboy PreP = PowerPC Reference Platform :
02374  *   "PreP [...] refers mainly to IBM hardware. PreP boot is a partition
02375  *    containing only raw ELF and having type 0x41."
02376  *
02377  * This feature is only combinable with system area type 0
02378  * and currently not combinable with ISOLINUX isohybrid production.
02379  * It overrides --protective-msdos-label. See iso_write_opts_set_system_area().
02380  * Only partition 4 stays available for iso_write_opts_set_partition_img().
02381  * It is compatible with HFS+/FAT production by storing the PreP partition
02382  * before the start of the HFS+/FAT partition.
02383  *
02384  * @param opts
02385  *        The option set to be manipulated.
02386  * @param image_path
02387  *        File address in the local file system.
02388  *        NULL revokes production of the PreP partition.
02389  * @param flag
02390  *        Reserved for future usage, set to 0.
02391  * @return
02392  *        ISO_SUCCESS or error
02393  *
02394  * @since 1.2.4
02395  */
02396 int iso_write_opts_set_prep_img(IsoWriteOpts *opts, char *image_path,
02397                                 int flag);
02398 
02399 /**
02400  * Copy a data file from the local filesystem into the emerging ISO image.
02401  * Mark it by an GPT partition entry as EFI System partition, and also cause
02402  * protective GPT partition entries before and after the partition.
02403  * GPT = Globally Unique Identifier Partition Table
02404  *
02405  * This feature may collide with data submitted by
02406  *   iso_write_opts_set_system_area()
02407  * and with settings made by
02408  *   el_torito_set_isolinux_options()
02409  * It is compatible with HFS+/FAT production by storing the EFI partition
02410  * before the start of the HFS+/FAT partition.
02411  * The GPT overwrites byte 0x0200 to 0x03ff of the system area and all
02412  * further bytes above 0x0800 which are not used by an Apple Partition Map.
02413  *
02414  * @param opts
02415  *        The option set to be manipulated.
02416  * @param image_path
02417  *        File address in the local file system.
02418  *        NULL revokes production of the EFI boot partition.
02419  * @param flag
02420  *        Reserved for future usage, set to 0.
02421  * @return
02422  *        ISO_SUCCESS or error
02423  *
02424  * @since 1.2.4
02425  */
02426 int iso_write_opts_set_efi_bootp(IsoWriteOpts *opts, char *image_path, 
02427                                  int flag);
02428 
02429 /**
02430  * Cause an arbitrary data file to be appended to the ISO image and to be
02431  * described by a partition table entry in an MBR or SUN Disk Label at the
02432  * start of the ISO image.
02433  * The partition entry will bear the size of the image file rounded up to
02434  * the next multiple of 2048 bytes.
02435  * MBR or SUN Disk Label are selected by iso_write_opts_set_system_area()
02436  * system area type: 0 selects MBR partition table. 3 selects a SUN partition
02437  * table with 320 kB start alignment.
02438  *
02439  * @param opts
02440  *        The option set to be manipulated.
02441  * @param partition_number
02442  *        Depicts the partition table entry which shall describe the
02443  *        appended image.
02444  *        Range with MBR: 1 to 4. 1 will cause the whole ISO image to be
02445  *                        unclaimable space before partition 1.
02446  *        Range with SUN Disk Label: 2 to 8.
02447  * @param image_path
02448  *        File address in the local file system.
02449  *        With SUN Disk Label: an empty name causes the partition to become
02450  *        a copy of the next lower partition.
02451  * @param image_type
02452  *        The MBR partition type. E.g. FAT12 = 0x01 , FAT16 = 0x06, 
02453  *        Linux Native Partition = 0x83. See fdisk command L.
02454  *        This parameter is ignored with SUN Disk Label.
02455  * @param flag
02456  *        Reserved for future usage, set to 0.
02457  * @return
02458  *        ISO_SUCCESS or error
02459  *
02460  * @since 0.6.38
02461  */
02462 int iso_write_opts_set_partition_img(IsoWriteOpts *opts, int partition_number,
02463                            uint8_t partition_type, char *image_path, int flag);
02464 
02465 
02466 /**
02467  * Inquire the start address of the file data blocks after having used
02468  * IsoWriteOpts with iso_image_create_burn_source().
02469  * @param opts
02470  *        The option set that was used when starting image creation
02471  * @param data_start
02472  *        Returns the logical block address if it is already valid
02473  * @param flag
02474  *        Reserved for future usage, set to 0.
02475  * @return
02476  *        1 indicates valid data_start, <0 indicates invalid data_start
02477  *
02478  * @since 0.6.16
02479  */
02480 int iso_write_opts_get_data_start(IsoWriteOpts *opts, uint32_t *data_start,
02481                                   int flag);
02482 
02483 /**
02484  * Update the sizes of all files added to image.
02485  *
02486  * This may be called just before iso_image_create_burn_source() to force
02487  * libisofs to check the file sizes again (they're already checked when added
02488  * to IsoImage). It is useful if you have changed some files after adding then
02489  * to the image.
02490  *
02491  * @return
02492  *    1 on success, < 0 on error
02493  * @since 0.6.8
02494  */
02495 int iso_image_update_sizes(IsoImage *image);
02496 
02497 /**
02498  * Create a burn_source and a thread which immediately begins to generate
02499  * the image. That burn_source can be used with libburn as a data source
02500  * for a track. A copy of its public declaration in libburn.h can be found
02501  * further below in this text.
02502  *
02503  * If image generation shall be aborted by the application program, then
02504  * the .cancel() method of the burn_source must be called to end the
02505  * generation thread:  burn_src->cancel(burn_src);
02506  *
02507  * @param image
02508  *     The image to write.
02509  * @param opts
02510  *     The options for image generation. All needed data will be copied, so
02511  *     you can free the given struct once this function returns.
02512  * @param burn_src
02513  *     Location where the pointer to the burn_source will be stored
02514  * @return
02515  *     1 on success, < 0 on error
02516  *
02517  * @since 0.6.2
02518  */
02519 int iso_image_create_burn_source(IsoImage *image, IsoWriteOpts *opts,
02520                                  struct burn_source **burn_src);
02521 
02522 /**
02523  * Inquire whether the image generator thread is still at work. As soon as the
02524  * reply is 0, the caller of iso_image_create_burn_source() may assume that
02525  * the image generation has ended.
02526  * Nevertheless there may still be readily formatted output data pending in
02527  * the burn_source or its consumers. So the final delivery of the image has
02528  * also to be checked at the data consumer side,e.g. by burn_drive_get_status()
02529  * in case of libburn as consumer.
02530  * @param image
02531  *     The image to inquire.
02532  * @return
02533  *     1 generating of image stream is still in progress
02534  *     0 generating of image stream has ended meanwhile
02535  *
02536  * @since 0.6.38
02537  */
02538 int iso_image_generator_is_running(IsoImage *image);
02539 
02540 /**
02541  * Creates an IsoReadOpts for reading an existent image. You should set the
02542  * options desired with the correspondent setters. Note that you may want to
02543  * set the start block value.
02544  *
02545  * Options by default are determined by the selected profile.
02546  *
02547  * @param opts
02548  *     Pointer to the location where the newly created IsoReadOpts will be
02549  *     stored. You should free it with iso_read_opts_free() when no more
02550  *     needed.
02551  * @param profile
02552  *     Default profile for image reading. For now the following values are
02553  *     defined:
02554  *     ---> 0 [STANDARD]
02555  *         Suitable for most situations. Most extension are read. When both
02556  *         Joliet and RR extension are present, RR is used.
02557  *         AAIP for ACL and xattr is not enabled by default.
02558  * @return
02559  *      1 success, < 0 error
02560  *
02561  * @since 0.6.2
02562  */
02563 int iso_read_opts_new(IsoReadOpts **opts, int profile);
02564 
02565 /**
02566  * Free an IsoReadOpts previously allocated with iso_read_opts_new().
02567  *
02568  * @since 0.6.2
02569  */
02570 void iso_read_opts_free(IsoReadOpts *opts);
02571 
02572 /**
02573  * Set the block where the image begins. It is usually 0, but may be different
02574  * on a multisession disc.
02575  *
02576  * @since 0.6.2
02577  */
02578 int iso_read_opts_set_start_block(IsoReadOpts *opts, uint32_t block);
02579 
02580 /**
02581  * Do not read Rock Ridge extensions.
02582  * In most cases you don't want to use this. It could be useful if RR info
02583  * is damaged, or if you want to use the Joliet tree.
02584  *
02585  * @since 0.6.2
02586  */
02587 int iso_read_opts_set_no_rockridge(IsoReadOpts *opts, int norr);
02588 
02589 /**
02590  * Do not read Joliet extensions.
02591  *
02592  * @since 0.6.2
02593  */
02594 int iso_read_opts_set_no_joliet(IsoReadOpts *opts, int nojoliet);
02595 
02596 /**
02597  * Do not read ISO 9660:1999 enhanced tree
02598  *
02599  * @since 0.6.2
02600  */
02601 int iso_read_opts_set_no_iso1999(IsoReadOpts *opts, int noiso1999);
02602 
02603 /**
02604  * Control reading of AAIP informations about ACL and xattr when loading
02605  * existing images.
02606  * For importing ACL and xattr when inserting nodes from external filesystems
02607  * (e.g. the local POSIX filesystem) see iso_image_set_ignore_aclea().
02608  * For eventual writing of this information see iso_write_opts_set_aaip().
02609  *
02610  * @param opts
02611  *       The option set to be manipulated
02612  * @param noaaip
02613  *       1 = Do not read AAIP information
02614  *       0 = Read AAIP information if available
02615  *       All other values are reserved.
02616  * @since 0.6.14
02617  */
02618 int iso_read_opts_set_no_aaip(IsoReadOpts *opts, int noaaip);
02619 
02620 /**
02621  * Control reading of an array of MD5 checksums which is eventually stored
02622  * at the end of a session. See also iso_write_opts_set_record_md5().
02623  * Important: Loading of the MD5 array will only work if AAIP is enabled
02624  *            because its position and layout is recorded in xattr "isofs.ca".
02625  *
02626  * @param opts
02627  *       The option set to be manipulated
02628  * @param no_md5
02629  *       0 = Read MD5 array if available, refuse on non-matching MD5 tags
02630  *       1 = Do not read MD5 checksum array
02631  *       2 = Read MD5 array, but do not check MD5 tags
02632  *           @since 1.0.4
02633  *       All other values are reserved.
02634  *
02635  * @since 0.6.22
02636  */
02637 int iso_read_opts_set_no_md5(IsoReadOpts *opts, int no_md5);
02638 
02639 
02640 /**
02641  * Control discarding of eventual inode numbers from existing images.
02642  * Such numbers may come from RRIP 1.12 entries PX. If not discarded they
02643  * get written unchanged when the file object gets written into an ISO image. 
02644  * If this inode number is missing with a file in the imported image,
02645  * or if it has been discarded during image reading, then a unique inode number
02646  * will be generated at some time before the file gets written into an ISO
02647  * image.
02648  * Two image nodes which have the same inode number represent two hardlinks
02649  * of the same file object. So discarding the numbers splits hardlinks.
02650  *
02651  * @param opts
02652  *       The option set to be manipulated
02653  * @param new_inos
02654  *     1 = Discard imported inode numbers and finally hand out a unique new
02655  *         one to each single file before it gets written into an ISO image.
02656  *     0 = Keep eventual inode numbers from PX entries.
02657  *         All other values are reserved.
02658  * @since 0.6.20
02659  */
02660 int iso_read_opts_set_new_inos(IsoReadOpts *opts, int new_inos);
02661 
02662 /**
02663  * Whether to prefer Joliet over RR. libisofs usually prefers RR over
02664  * Joliet, as it give us much more info about files. So, if both extensions
02665  * are present, RR is used. You can set this if you prefer Joliet, but
02666  * note that this is not very recommended. This doesn't mean than RR
02667  * extensions are not read: if no Joliet is present, libisofs will read
02668  * RR tree.
02669  *
02670  * @since 0.6.2
02671  */
02672 int iso_read_opts_set_preferjoliet(IsoReadOpts *opts, int preferjoliet);
02673 
02674 /**
02675  * Set default uid for files when RR extensions are not present.
02676  *
02677  * @since 0.6.2
02678  */
02679 int iso_read_opts_set_default_uid(IsoReadOpts *opts, uid_t uid);
02680 
02681 /**
02682  * Set default gid for files when RR extensions are not present.
02683  *
02684  * @since 0.6.2
02685  */
02686 int iso_read_opts_set_default_gid(IsoReadOpts *opts, gid_t gid);
02687 
02688 /**
02689  * Set default permissions for files when RR extensions are not present.
02690  *
02691  * @param opts
02692  *       The option set to be manipulated
02693  * @param file_perm
02694  *      Permissions for files.
02695  * @param dir_perm
02696  *      Permissions for directories.
02697  *
02698  * @since 0.6.2
02699  */
02700 int iso_read_opts_set_default_permissions(IsoReadOpts *opts, mode_t file_perm,
02701                                           mode_t dir_perm);
02702 
02703 /**
02704  * Set the input charset of the file names on the image. NULL to use locale
02705  * charset. You have to specify a charset if the image filenames are encoded
02706  * in a charset different that the local one. This could happen, for example,
02707  * if the image was created on a system with different charset.
02708  *
02709  * @param opts
02710  *       The option set to be manipulated
02711  * @param charset
02712  *      The charset to use as input charset.  You can obtain the list of
02713  *      charsets supported on your system executing "iconv -l" in a shell.
02714  *
02715  * @since 0.6.2
02716  */
02717 int iso_read_opts_set_input_charset(IsoReadOpts *opts, const char *charset);
02718 
02719 /**
02720  * Enable or disable methods to automatically choose an input charset.
02721  * This eventually overrides the name set via iso_read_opts_set_input_charset()
02722  *
02723  * @param opts
02724  *       The option set to be manipulated
02725  * @param mode
02726  *       Bitfield for control purposes:
02727  *       bit0= Allow to use the input character set name which is eventually
02728  *             stored in attribute "isofs.cs" of the root directory.
02729  *             Applications may attach this xattr by iso_node_set_attrs() to
02730  *             the root node, call iso_write_opts_set_output_charset() with the
02731  *             same name and enable iso_write_opts_set_aaip() when writing
02732  *             an image.
02733  *       Submit any other bits with value 0.
02734  *
02735  * @since 0.6.18
02736  *
02737  */
02738 int iso_read_opts_auto_input_charset(IsoReadOpts *opts, int mode);
02739 
02740 /**
02741  * Enable or disable loading of the first 32768 bytes of the session.
02742  *
02743  * @param opts
02744  *       The option set to be manipulated
02745  * @param mode
02746  *       Bitfield for control purposes:
02747  *       bit0= Load System Area data and attach them to the image so that they
02748  *             get written by the next session, if not overridden by
02749  *             iso_write_opts_set_system_area().
02750  *       Submit any other bits with value 0.
02751  *
02752  * @since 0.6.30
02753  *
02754  */
02755 int iso_read_opts_load_system_area(IsoReadOpts *opts, int mode);
02756 
02757 /**
02758  * Import a previous session or image, for growing or modify.
02759  *
02760  * @param image
02761  *     The image context to which old image will be imported. Note that all
02762  *     files added to image, and image attributes, will be replaced with the
02763  *     contents of the old image.
02764  *     TODO #00025 support for merging old image files
02765  * @param src
02766  *     Data Source from which old image will be read. A extra reference is
02767  *     added, so you still need to iso_data_source_unref() yours.
02768  * @param opts
02769  *     Options for image import. All needed data will be copied, so you
02770  *     can free the given struct once this function returns.
02771  * @param features
02772  *     If not NULL, a new IsoReadImageFeatures will be allocated and filled
02773  *     with the features of the old image. It should be freed with
02774  *     iso_read_image_features_destroy() when no more needed. You can pass
02775  *     NULL if you're not interested on them.
02776  * @return
02777  *     1 on success, < 0 on error
02778  *
02779  * @since 0.6.2
02780  */
02781 int iso_image_import(IsoImage *image, IsoDataSource *src, IsoReadOpts *opts,
02782                      IsoReadImageFeatures **features);
02783 
02784 /**
02785  * Destroy an IsoReadImageFeatures object obtained with iso_image_import.
02786  *
02787  * @since 0.6.2
02788  */
02789 void iso_read_image_features_destroy(IsoReadImageFeatures *f);
02790 
02791 /**
02792  * Get the size (in 2048 byte block) of the image, as reported in the PVM.
02793  *
02794  * @since 0.6.2
02795  */
02796 uint32_t iso_read_image_features_get_size(IsoReadImageFeatures *f);
02797 
02798 /**
02799  * Whether RockRidge extensions are present in the image imported.
02800  *
02801  * @since 0.6.2
02802  */
02803 int iso_read_image_features_has_rockridge(IsoReadImageFeatures *f);
02804 
02805 /**
02806  * Whether Joliet extensions are present in the image imported.
02807  *
02808  * @since 0.6.2
02809  */
02810 int iso_read_image_features_has_joliet(IsoReadImageFeatures *f);
02811 
02812 /**
02813  * Whether the image is recorded according to ISO 9660:1999, i.e. it has
02814  * a version 2 Enhanced Volume Descriptor.
02815  *
02816  * @since 0.6.2
02817  */
02818 int iso_read_image_features_has_iso1999(IsoReadImageFeatures *f);
02819 
02820 /**
02821  * Whether El-Torito boot record is present present in the image imported.
02822  *
02823  * @since 0.6.2
02824  */
02825 int iso_read_image_features_has_eltorito(IsoReadImageFeatures *f);
02826 
02827 /**
02828  * Increments the reference counting of the given image.
02829  *
02830  * @since 0.6.2
02831  */
02832 void iso_image_ref(IsoImage *image);
02833 
02834 /**
02835  * Decrements the reference couting of the given image.
02836  * If it reaches 0, the image is free, together with its tree nodes (whether
02837  * their refcount reach 0 too, of course).
02838  *
02839  * @since 0.6.2
02840  */
02841 void iso_image_unref(IsoImage *image);
02842 
02843 /**
02844  * Attach user defined data to the image. Use this if your application needs
02845  * to store addition info together with the IsoImage. If the image already
02846  * has data attached, the old data will be freed.
02847  *
02848  * @param image
02849  *      The image to which data shall be attached.
02850  * @param data
02851  *      Pointer to application defined data that will be attached to the
02852  *      image. You can pass NULL to remove any already attached data.
02853  * @param give_up
02854  *      Function that will be called when the image does not need the data
02855  *      any more. It receives the data pointer as an argumente, and eventually
02856  *      causes data to be freed. It can be NULL if you don't need it.
02857  * @return
02858  *      1 on succes, < 0 on error
02859  *
02860  * @since 0.6.2
02861  */
02862 int iso_image_attach_data(IsoImage *image, void *data, void (*give_up)(void*));
02863 
02864 /**
02865  * The the data previously attached with iso_image_attach_data()
02866  *
02867  * @since 0.6.2
02868  */
02869 void *iso_image_get_attached_data(IsoImage *image);
02870 
02871 /**
02872  * Get the root directory of the image.
02873  * No extra ref is added to it, so you musn't unref it. Use iso_node_ref()
02874  * if you want to get your own reference.
02875  *
02876  * @since 0.6.2
02877  */
02878 IsoDir *iso_image_get_root(const IsoImage *image);
02879 
02880 /**
02881  * Fill in the volset identifier for a image.
02882  *
02883  * @since 0.6.2
02884  */
02885 void iso_image_set_volset_id(IsoImage *image, const char *volset_id);
02886 
02887 /**
02888  * Get the volset identifier.
02889  * The returned string is owned by the image and should not be freed nor
02890  * changed.
02891  *
02892  * @since 0.6.2
02893  */
02894 const char *iso_image_get_volset_id(const IsoImage *image);
02895 
02896 /**
02897  * Fill in the volume identifier for a image.
02898  *
02899  * @since 0.6.2
02900  */
02901 void iso_image_set_volume_id(IsoImage *image, const char *volume_id);
02902 
02903 /**
02904  * Get the volume identifier.
02905  * The returned string is owned by the image and should not be freed nor
02906  * changed.
02907  *
02908  * @since 0.6.2
02909  */
02910 const char *iso_image_get_volume_id(const IsoImage *image);
02911 
02912 /**
02913  * Fill in the publisher for a image.
02914  *
02915  * @since 0.6.2
02916  */
02917 void iso_image_set_publisher_id(IsoImage *image, const char *publisher_id);
02918 
02919 /**
02920  * Get the publisher of a image.
02921  * The returned string is owned by the image and should not be freed nor
02922  * changed.
02923  *
02924  * @since 0.6.2
02925  */
02926 const char *iso_image_get_publisher_id(const IsoImage *image);
02927 
02928 /**
02929  * Fill in the data preparer for a image.
02930  *
02931  * @since 0.6.2
02932  */
02933 void iso_image_set_data_preparer_id(IsoImage *image,
02934                                     const char *data_preparer_id);
02935 
02936 /**
02937  * Get the data preparer of a image.
02938  * The returned string is owned by the image and should not be freed nor
02939  * changed.
02940  *
02941  * @since 0.6.2
02942  */
02943 const char *iso_image_get_data_preparer_id(const IsoImage *image);
02944 
02945 /**
02946  * Fill in the system id for a image. Up to 32 characters.
02947  *
02948  * @since 0.6.2
02949  */
02950 void iso_image_set_system_id(IsoImage *image, const char *system_id);
02951 
02952 /**
02953  * Get the system id of a image.
02954  * The returned string is owned by the image and should not be freed nor
02955  * changed.
02956  *
02957  * @since 0.6.2
02958  */
02959 const char *iso_image_get_system_id(const IsoImage *image);
02960 
02961 /**
02962  * Fill in the application id for a image. Up to 128 chars.
02963  *
02964  * @since 0.6.2
02965  */
02966 void iso_image_set_application_id(IsoImage *image, const char *application_id);
02967 
02968 /**
02969  * Get the application id of a image.
02970  * The returned string is owned by the image and should not be freed nor
02971  * changed.
02972  *
02973  * @since 0.6.2
02974  */
02975 const char *iso_image_get_application_id(const IsoImage *image);
02976 
02977 /**
02978  * Fill copyright information for the image. Usually this refers
02979  * to a file on disc. Up to 37 characters.
02980  *
02981  * @since 0.6.2
02982  */
02983 void iso_image_set_copyright_file_id(IsoImage *image,
02984                                      const char *copyright_file_id);
02985 
02986 /**
02987  * Get the copyright information of a image.
02988  * The returned string is owned by the image and should not be freed nor
02989  * changed.
02990  *
02991  * @since 0.6.2
02992  */
02993 const char *iso_image_get_copyright_file_id(const IsoImage *image);
02994 
02995 /**
02996  * Fill abstract information for the image. Usually this refers
02997  * to a file on disc. Up to 37 characters.
02998  *
02999  * @since 0.6.2
03000  */
03001 void iso_image_set_abstract_file_id(IsoImage *image,
03002                                     const char *abstract_file_id);
03003 
03004 /**
03005  * Get the abstract information of a image.
03006  * The returned string is owned by the image and should not be freed nor
03007  * changed.
03008  *
03009  * @since 0.6.2
03010  */
03011 const char *iso_image_get_abstract_file_id(const IsoImage *image);
03012 
03013 /**
03014  * Fill biblio information for the image. Usually this refers
03015  * to a file on disc. Up to 37 characters.
03016  *
03017  * @since 0.6.2
03018  */
03019 void iso_image_set_biblio_file_id(IsoImage *image, const char *biblio_file_id);
03020 
03021 /**
03022  * Get the biblio information of a image.
03023  * The returned string is owned by the image and should not be freed nor
03024  * changed.
03025  *
03026  * @since 0.6.2
03027  */
03028 const char *iso_image_get_biblio_file_id(const IsoImage *image);
03029 
03030 /**
03031  * Create a new set of El-Torito bootable images by adding a boot catalog
03032  * and the default boot image.
03033  * Further boot images may then be added by iso_image_add_boot_image().
03034  *
03035  * @param image
03036  *      The image to make bootable. If it was already bootable this function
03037  *      returns an error and the image remains unmodified.
03038  * @param image_path
03039  *      The absolute path of a IsoFile to be used as default boot image.
03040  * @param type
03041  *      The boot media type. This can be one of 3 types:
03042  *             - Floppy emulation: Boot image file must be exactly
03043  *               1200 kB, 1440 kB or 2880 kB.
03044  *             - Hard disc emulation: The image must begin with a master
03045  *               boot record with a single image.
03046  *             - No emulation. You should specify load segment and load size
03047  *               of image.
03048  * @param catalog_path
03049  *      The absolute path in the image tree where the catalog will be stored.
03050  *      The directory component of this path must be a directory existent on
03051  *      the image tree, and the filename component must be unique among all
03052  *      children of that directory on image. Otherwise a correspodent error
03053  *      code will be returned. This function will add an IsoBoot node that acts
03054  *      as a placeholder for the real catalog, that will be generated at image
03055  *      creation time.
03056  * @param boot
03057  *      Location where a pointer to the added boot image will be stored. That
03058  *      object is owned by the IsoImage and should not be freed by the user,
03059  *      nor dereferenced once the last reference to the IsoImage was disposed
03060  *      via iso_image_unref(). A NULL value is allowed if you don't need a
03061  *      reference to the boot image.
03062  * @return
03063  *      1 on success, < 0 on error
03064  *
03065  * @since 0.6.2
03066  */
03067 int iso_image_set_boot_image(IsoImage *image, const char *image_path,
03068                              enum eltorito_boot_media_type type,
03069                              const char *catalog_path,
03070                              ElToritoBootImage **boot);
03071 
03072 /**
03073  * Add a further boot image to the set of El-Torito bootable images.
03074  * This set has already to be created by iso_image_set_boot_image().
03075  * Up to 31 further boot images may be added.
03076  *
03077  * @param image
03078  *      The image to which the boot image shall be added.
03079  *      returns an error and the image remains unmodified.
03080  * @param image_path
03081  *      The absolute path of a IsoFile to be used as default boot image.
03082  * @param type
03083  *      The boot media type. See iso_image_set_boot_image
03084  * @param flag
03085  *      Bitfield for control purposes. Unused yet. Submit 0.
03086  * @param boot
03087  *      Location where a pointer to the added boot image will be stored.
03088  *      See iso_image_set_boot_image
03089  * @return
03090  *      1 on success, < 0 on error
03091  *                    ISO_BOOT_NO_CATALOG means iso_image_set_boot_image()
03092  *                    was not called first.
03093  *
03094  * @since 0.6.32
03095  */
03096 int iso_image_add_boot_image(IsoImage *image, const char *image_path,
03097                              enum eltorito_boot_media_type type, int flag,
03098                              ElToritoBootImage **boot);
03099 
03100 /**
03101  * Get the El-Torito boot catalog and the default boot image of an ISO image.
03102  *
03103  * This can be useful, for example, to check if a volume read from a previous
03104  * session or an existing image is bootable. It can also be useful to get
03105  * the image and catalog tree nodes. An application would want those, for
03106  * example, to prevent the user removing it.
03107  *
03108  * Both nodes are owned by libisofs and should not be freed. You can get your
03109  * own ref with iso_node_ref(). You can also check if the node is already
03110  * on the tree by getting its parent (note that when reading El-Torito info
03111  * from a previous image, the nodes might not be on the tree even if you haven't
03112  * removed them). Remember that you'll need to get a new ref
03113  * (with iso_node_ref()) before inserting them again to the tree, and probably
03114  * you will also need to set the name or permissions.
03115  *
03116  * @param image
03117  *      The image from which to get the boot image.
03118  * @param boot
03119  *      If not NULL, it will be filled with a pointer to the boot image, if
03120  *      any. That  object is owned by the IsoImage and should not be freed by
03121  *      the user, nor dereferenced once the last reference to the IsoImage was
03122  *      disposed via iso_image_unref().
03123  * @param imgnode
03124  *      When not NULL, it will be filled with the image tree node. No extra ref
03125  *      is added, you can use iso_node_ref() to get one if you need it.
03126  * @param catnode
03127  *      When not NULL, it will be filled with the catnode tree node. No extra
03128  *      ref is added, you can use iso_node_ref() to get one if you need it.
03129  * @return
03130  *      1 on success, 0 is the image is not bootable (i.e., it has no El-Torito
03131  *      image), < 0 error.
03132  *
03133  * @since 0.6.2
03134  */
03135 int iso_image_get_boot_image(IsoImage *image, ElToritoBootImage **boot,
03136                              IsoFile **imgnode, IsoBoot **catnode);
03137 
03138 /**
03139  * Get detailed information about the boot catalog that was loaded from
03140  * an ISO image.
03141  * The boot catalog links the El Torito boot record at LBA 17 with the 
03142  * boot images which are IsoFile objects in the image. The boot catalog
03143  * itself is not a regular file and thus will not deliver an IsoStream.
03144  * Its content is usually quite short and can be obtained by this call.
03145  *
03146  * @param image
03147  *      The image to inquire.
03148  * @param catnode
03149  *      Will return the boot catalog tree node. No extra ref is taken.
03150  * @param lba
03151  *      Will return the block address of the boot catalog in the image.
03152  * @param content
03153  *      Will return either NULL or an allocated memory buffer with the
03154  *      content bytes of the boot catalog.
03155  *      Dispose it by free() when no longer needed.
03156  * @param size
03157  *      Will return the number of bytes in content.
03158  * @return
03159  *      1 if reply is valid, 0 if not boot catalog was loaded, < 0 on error.
03160  *
03161  * @since 1.1.2
03162  */
03163 int iso_image_get_bootcat(IsoImage *image, IsoBoot **catnode, uint32_t *lba,
03164                           char **content, off_t *size);
03165 
03166 
03167 /**
03168  * Get all El-Torito boot images of an ISO image.
03169  *
03170  * The first of these boot images is the same as returned by
03171  * iso_image_get_boot_image(). The others are alternative boot images. 
03172  *
03173  * @param image
03174  *      The image from which to get the boot images.
03175  * @param num_boots
03176  *      The number of available array elements in boots and bootnodes.
03177  * @param boots
03178  *      Returns NULL or an allocated array of pointers to boot images.
03179  *      Apply system call free(boots) to dispose it.
03180  * @param bootnodes
03181  *      Returns NULL or an allocated array of pointers to the IsoFile nodes
03182  *      which bear the content of the boot images in boots.
03183  * @param flag
03184  *      Bitfield for control purposes. Unused yet. Submit 0.
03185  * @return
03186  *      1 on success, 0 no El-Torito catalog and boot image attached,
03187  *      < 0 error.
03188  *
03189  * @since 0.6.32
03190  */
03191 int iso_image_get_all_boot_imgs(IsoImage *image, int *num_boots,
03192                    ElToritoBootImage ***boots, IsoFile ***bootnodes, int flag);
03193 
03194 
03195 /**
03196  * Removes all El-Torito boot images from the ISO image.
03197  *
03198  * The IsoBoot node that acts as placeholder for the catalog is also removed
03199  * for the image tree, if there.
03200  * If the image is not bootable (don't have el-torito boot image) this function
03201  * just returns.
03202  *
03203  * @since 0.6.2
03204  */
03205 void iso_image_remove_boot_image(IsoImage *image);
03206 
03207 /**
03208  * Sets the sort weight of the boot catalog that is attached to an IsoImage.
03209  * 
03210  * For the meaning of sort weights see iso_node_set_sort_weight().
03211  * That function cannot be applied to the emerging boot catalog because
03212  * it is not represented by an IsoFile.
03213  *
03214  * @param image
03215  *      The image to manipulate.
03216  * @param sort_weight
03217  *      The larger this value, the lower will be the block address of the
03218  *      boot catalog record.
03219  * @return
03220  *      0= no boot catalog attached , 1= ok , <0 = error
03221  *
03222  * @since 0.6.32
03223  */
03224 int iso_image_set_boot_catalog_weight(IsoImage *image, int sort_weight);
03225 
03226 /**
03227  * Hides the boot catalog file from directory trees.
03228  * 
03229  * For the meaning of hiding files see iso_node_set_hidden().
03230  *
03231  * 
03232  * @param image
03233  *      The image to manipulate.
03234  * @param hide_attrs
03235  *      Or-combination of values from enum IsoHideNodeFlag to set the trees
03236  *      in which the record.
03237  * @return
03238  *      0= no boot catalog attached , 1= ok , <0 = error
03239  *
03240  * @since 0.6.34
03241  */
03242 int iso_image_set_boot_catalog_hidden(IsoImage *image, int hide_attrs);
03243 
03244 
03245 /**
03246  * Get the boot media type as of parameter "type" of iso_image_set_boot_image()
03247  * resp. iso_image_add_boot_image().
03248  *
03249  * @param bootimg
03250  *      The image to inquire
03251  * @param media_type
03252  *      Returns the media type
03253  * @return
03254  *      1 = ok , < 0 = error
03255  *
03256  * @since 0.6.32
03257  */
03258 int el_torito_get_boot_media_type(ElToritoBootImage *bootimg, 
03259                                   enum eltorito_boot_media_type *media_type);
03260 
03261 /**
03262  * Sets the platform ID of the boot image.
03263  * 
03264  * The Platform ID gets written into the boot catalog at byte 1 of the
03265  * Validation Entry, or at byte 1 of a Section Header Entry.
03266  * If Platform ID and ID String of two consequtive bootimages are the same
03267  *
03268  * @param bootimg
03269  *      The image to manipulate.
03270  * @param id
03271  *      A Platform ID as of
03272  *      El Torito 1.0  : 0x00= 80x86,  0x01= PowerPC,  0x02= Mac
03273  *      Others         : 0xef= EFI
03274  * @return
03275  *      1 ok , <=0 error
03276  *
03277  * @since 0.6.32
03278  */
03279 int el_torito_set_boot_platform_id(ElToritoBootImage *bootimg, uint8_t id);
03280 
03281 /**
03282  * Get the platform ID value. See el_torito_set_boot_platform_id().
03283  *
03284  * @param bootimg
03285  *      The image to inquire
03286  * @return
03287  *      0 - 255 : The platform ID 
03288  *      < 0     : error
03289  *
03290  * @since 0.6.32
03291  */
03292 int el_torito_get_boot_platform_id(ElToritoBootImage *bootimg);
03293 
03294 /**
03295  * Sets the load segment for the initial boot image. This is only for
03296  * no emulation boot images, and is a NOP for other image types.
03297  *
03298  * @since 0.6.2
03299  */
03300 void el_torito_set_load_seg(ElToritoBootImage *bootimg, short segment);
03301 
03302 /**
03303  * Get the load segment value. See el_torito_set_load_seg().
03304  *
03305  * @param bootimg
03306  *      The image to inquire
03307  * @return
03308  *      0 - 65535 : The load segment value 
03309  *      < 0       : error
03310  *
03311  * @since 0.6.32
03312  */
03313 int el_torito_get_load_seg(ElToritoBootImage *bootimg);
03314 
03315 /**
03316  * Sets the number of sectors (512b) to be load at load segment during
03317  * the initial boot procedure. This is only for
03318  * no emulation boot images, and is a NOP for other image types.
03319  *
03320  * @since 0.6.2
03321  */
03322 void el_torito_set_load_size(ElToritoBootImage *bootimg, short sectors);
03323 
03324 /**
03325  * Get the load size. See el_torito_set_load_size().
03326  *
03327  * @param bootimg
03328  *      The image to inquire
03329  * @return
03330  *      0 - 65535 : The load size value
03331  *      < 0       : error
03332  *
03333  * @since 0.6.32
03334  */
03335 int el_torito_get_load_size(ElToritoBootImage *bootimg);
03336 
03337 /**
03338  * Marks the specified boot image as not bootable
03339  *
03340  * @since 0.6.2
03341  */
03342 void el_torito_set_no_bootable(ElToritoBootImage *bootimg);
03343 
03344 /**
03345  * Get the bootability flag. See el_torito_set_no_bootable().
03346  *
03347  * @param bootimg
03348  *      The image to inquire
03349  * @return
03350  *      0 = not bootable, 1 = bootable , <0 = error
03351  *
03352  * @since 0.6.32
03353  */
03354 int el_torito_get_bootable(ElToritoBootImage *bootimg);
03355 
03356 /**
03357  * Set the id_string of the Validation Entry resp. Sector Header Entry which
03358  * will govern the boot image Section Entry in the El Torito Catalog.
03359  *
03360  * @param bootimg
03361  *      The image to manipulate.
03362  * @param id_string
03363  *      The first boot image puts 24 bytes of ID string into the Validation
03364  *      Entry, where they shall "identify the manufacturer/developer of
03365  *      the CD-ROM".
03366  *      Further boot images put 28 bytes into their Section Header.
03367  *      El Torito 1.0 states that "If the BIOS understands the ID string, it
03368  *      may choose to boot the system using one of these entries in place
03369  *      of the INITIAL/DEFAULT entry." (The INITIAL/DEFAULT entry points to the
03370  *      first boot image.)
03371  * @return
03372  *      1 = ok , <0 = error
03373  *
03374  * @since 0.6.32
03375  */
03376 int el_torito_set_id_string(ElToritoBootImage *bootimg, uint8_t id_string[28]);
03377 
03378 /** 
03379  * Get the id_string as of el_torito_set_id_string().
03380  *
03381  * @param bootimg
03382  *      The image to inquire
03383  * @param id_string
03384  *      Returns 28 bytes of id string
03385  * @return
03386  *      1 = ok , <0 = error
03387  *
03388  * @since 0.6.32
03389  */
03390 int el_torito_get_id_string(ElToritoBootImage *bootimg, uint8_t id_string[28]);
03391 
03392 /**
03393  * Set the Selection Criteria of a boot image.
03394  *
03395  * @param bootimg
03396  *      The image to manipulate.
03397  * @param crit
03398  *      The first boot image has no selection criteria. They will be ignored.
03399  *      Further boot images put 1 byte of Selection Criteria Type and 19
03400  *      bytes of data into their Section Entry.
03401  *      El Torito 1.0 states that "The format of the selection criteria is
03402  *      a function of the BIOS vendor. In the case of a foreign language
03403  *      BIOS three bytes would be used to identify the language".
03404  *      Type byte == 0 means "no criteria",
03405  *      type byte == 1 means "Language and Version Information (IBM)".
03406  * @return
03407  *      1 = ok , <0 = error
03408  *
03409  * @since 0.6.32
03410  */
03411 int el_torito_set_selection_crit(ElToritoBootImage *bootimg, uint8_t crit[20]);
03412 
03413 /** 
03414  * Get the Selection Criteria bytes as of el_torito_set_selection_crit().
03415  *
03416  * @param bootimg
03417  *      The image to inquire
03418  * @param id_string
03419  *      Returns 20 bytes of type and data
03420  * @return
03421  *      1 = ok , <0 = error
03422  *
03423  * @since 0.6.32
03424  */
03425 int el_torito_get_selection_crit(ElToritoBootImage *bootimg, uint8_t crit[20]);
03426 
03427 
03428 /**
03429  * Makes a guess whether the boot image was patched by a boot information
03430  * table. It is advisable to patch such boot images if their content gets
03431  * copied to a new location. See el_torito_set_isolinux_options().
03432  * Note: The reply can be positive only if the boot image was imported
03433  *       from an existing ISO image.
03434  *
03435  * @param bootimg
03436  *      The image to inquire
03437  * @param flag
03438  *        Reserved for future usage, set to 0.
03439  * @return
03440  *      1 = seems to contain oot info table , 0 = quite surely not
03441  * @since 0.6.32
03442  */
03443 int el_torito_seems_boot_info_table(ElToritoBootImage *bootimg, int flag);
03444 
03445 /**
03446  * Specifies options for ISOLINUX or GRUB boot images. This should only be used
03447  * if the type of boot image is known.
03448  *
03449  * @param bootimg
03450  *      The image to set options on 
03451  * @param options
03452  *        bitmask style flag. The following values are defined:
03453  *
03454  *        bit0= Patch the boot info table of the boot image.
03455  *              This does the same as mkisofs option -boot-info-table.
03456  *              Needed for ISOLINUX or GRUB boot images with platform ID 0.
03457  *              The table is located at byte 8 of the boot image file.
03458  *              Its size is 56 bytes. 
03459  *              The original boot image file on disk will not be modified.
03460  *
03461  *              One may use el_torito_seems_boot_info_table() for a
03462  *              qualified guess whether a boot info table is present in
03463  *              the boot image. If the result is 1 then it should get bit0
03464  *              set if its content gets copied to a new LBA.
03465  *
03466  *        bit1= Generate a ISOLINUX isohybrid image with MBR.
03467  *              ----------------------------------------------------------
03468  *              @deprecated since 31 Mar 2010:
03469  *              The author of syslinux, H. Peter Anvin requested that this
03470  *              feature shall not be used any more. He intends to cease
03471  *              support for the MBR template that is included in libisofs.
03472  *              ----------------------------------------------------------
03473  *              A hybrid image is a boot image that boots from either
03474  *              CD/DVD media or from disk-like media, e.g. USB stick.
03475  *              For that you need isolinux.bin from SYSLINUX 3.72 or later.
03476  *              IMPORTANT: The application has to take care that the image
03477  *                         on media gets padded up to the next full MB.
03478  *                         Under seiveral circumstances it might get aligned
03479  *                         automatically. But there is no warranty.
03480  *        bit2-7= Mentioning in isohybrid GPT
03481  *                0= Do not mention in GPT
03482  *                1= Mention as Basic Data partition.
03483  *                   This cannot be combined with GPT partitions as of
03484  *                   iso_write_opts_set_efi_bootp()
03485  *                   @since 1.2.4
03486  *                2= Mention as HFS+ partition.
03487  *                   This cannot be combined with HFS+ production by
03488  *                   iso_write_opts_set_hfsplus().
03489  *                   @since 1.2.4
03490  *                Primary GPT and backup GPT get written if at least one 
03491  *                ElToritoBootImage shall be mentioned.
03492  *                The first three mentioned GPT partitions get mirrored in the
03493  *                the partition table of the isohybrid MBR. They get type 0xfe.
03494  *                The MBR partition entry for PC-BIOS gets type 0x00 rather
03495  *                than 0x17.
03496  *                Often it is one of the further MBR partitions which actually
03497  *                gets used by EFI.
03498  *                @since 1.2.4
03499  *        bit8= Mention in isohybrid Apple partition map
03500  *              APM get written if at least one ElToritoBootImage shall be
03501  *              mentioned. The ISOLINUX MBR must look suitable or else an error
03502  *              event will happen at image generation time.
03503  *              @since 1.2.4
03504  * @param flag
03505  *        Reserved for future usage, set to 0.
03506  * @return
03507  *      1 success, < 0 on error
03508  * @since 0.6.12
03509  */
03510 int el_torito_set_isolinux_options(ElToritoBootImage *bootimg,
03511                                    int options, int flag);
03512 
03513 /** 
03514  * Get the options as of el_torito_set_isolinux_options().
03515  *
03516  * @param bootimg
03517  *      The image to inquire
03518  * @param flag
03519  *        Reserved for future usage, set to 0.
03520  * @return
03521  *      >= 0 returned option bits , <0 = error
03522  *
03523  * @since 0.6.32
03524  */
03525 int el_torito_get_isolinux_options(ElToritoBootImage *bootimg, int flag);
03526 
03527 /** Deprecated:
03528  * Specifies that this image needs to be patched. This involves the writing
03529  * of a 16 bytes boot information table at offset 8 of the boot image file.
03530  * The original boot image file won't be modified.
03531  * This is needed for isolinux boot images.
03532  *
03533  * @since 0.6.2
03534  * @deprecated Use el_torito_set_isolinux_options() instead
03535  */
03536 void el_torito_patch_isolinux_image(ElToritoBootImage *bootimg);
03537 
03538 /**
03539  * Obtain a copy of the eventually loaded first 32768 bytes of the imported
03540  * session, the System Area.
03541  * It will be written to the start of the next session unless it gets
03542  * overwritten by iso_write_opts_set_system_area().
03543  *
03544  * @param img
03545  *        The image to be inquired.
03546  * @param data
03547  *        A byte array of at least 32768 bytesi to take the loaded bytes.
03548  * @param options
03549  *        The option bits which will be applied if not overridden by
03550  *        iso_write_opts_set_system_area(). See there.
03551  * @param flag
03552  *        Bitfield for control purposes, unused yet, submit 0
03553  * @return
03554  *        1 on success, 0 if no System Area was loaded, < 0 error.
03555  * @since 0.6.30
03556  */
03557 int iso_image_get_system_area(IsoImage *img, char data[32768],
03558                               int *options, int flag);
03559 
03560 /**
03561  * Add a MIPS boot file path to the image.
03562  * Up to 15 such files can be written into a MIPS Big Endian Volume Header
03563  * if this is enabled by value 1 in iso_write_opts_set_system_area() option
03564  * bits 2 to 7. 
03565  * A single file can be written into a DEC Boot Block if this is enabled by
03566  * value 2 in iso_write_opts_set_system_area() option bits 2 to 7. So only
03567  * the first added file gets into effect with this system area type.
03568  * The data files which shall serve as MIPS boot files have to be brought into
03569  * the image by the normal means.
03570  * @param img
03571  *        The image to be manipulated.
03572  * @param path
03573  *        Absolute path of the boot file in the ISO 9660 Rock Ridge tree.
03574  * @param flag
03575  *        Bitfield for control purposes, unused yet, submit 0
03576  * @return
03577  *        1 on success, < 0 error
03578  * @since 0.6.38
03579  */
03580 int iso_image_add_mips_boot_file(IsoImage *image, char *path, int flag);
03581 
03582 /**
03583  * Obtain the number of added MIPS Big Endian boot files and pointers to
03584  * their paths in the ISO 9660 Rock Ridge tree.
03585  * @param img
03586  *        The image to be inquired.
03587  * @param paths
03588  *        An array of pointers to be set to the registered boot file paths.
03589  *        This are just pointers to data inside IsoImage. Do not free() them.
03590  *        Eventually make own copies of the data before manipulating the image.
03591  * @param flag
03592  *        Bitfield for control purposes, unused yet, submit 0
03593  * @return
03594  *        >= 0 is the number of valid path pointers , <0 means error
03595  * @since 0.6.38
03596  */
03597 int iso_image_get_mips_boot_files(IsoImage *image, char *paths[15], int flag);
03598 
03599 /**
03600  * Clear the list of MIPS Big Endian boot file paths.
03601  * @param img
03602  *        The image to be manipulated.
03603  * @param flag
03604  *        Bitfield for control purposes, unused yet, submit 0
03605  * @return
03606  *        1 is success , <0 means error
03607  * @since 0.6.38
03608  */
03609 int iso_image_give_up_mips_boot(IsoImage *image, int flag);
03610 
03611 
03612 /**
03613  * Increments the reference counting of the given node.
03614  *
03615  * @since 0.6.2
03616  */
03617 void iso_node_ref(IsoNode *node);
03618 
03619 /**
03620  * Decrements the reference couting of the given node.
03621  * If it reach 0, the node is free, and, if the node is a directory,
03622  * its children will be unref() too.
03623  *
03624  * @since 0.6.2
03625  */
03626 void iso_node_unref(IsoNode *node);
03627 
03628 /**
03629  * Get the type of an IsoNode.
03630  *
03631  * @since 0.6.2
03632  */
03633 enum IsoNodeType iso_node_get_type(IsoNode *node);
03634 
03635 /**
03636  * Class of functions to handle particular extended information. A function
03637  * instance acts as an identifier for the type of the information. Structs
03638  * with same information type must use a pointer to the same function.
03639  *
03640  * @param data
03641  *     Attached data
03642  * @param flag
03643  *     What to do with the data. At this time the following values are
03644  *     defined:
03645  *      -> 1 the data must be freed
03646  * @return
03647  *     1 in any case.
03648  *
03649  * @since 0.6.4
03650  */
03651 typedef int (*iso_node_xinfo_func)(void *data, int flag);
03652 
03653 /**
03654  * Add extended information to the given node. Extended info allows
03655  * applications (and libisofs itself) to add more information to an IsoNode.
03656  * You can use this facilities to associate temporary information with a given
03657  * node. This information is not written into the ISO 9660 image on media
03658  * and thus does not persist longer than the node memory object.
03659  *
03660  * Each node keeps a list of added extended info, meaning you can add several
03661  * extended info data to each node. Each extended info you add is identified
03662  * by the proc parameter, a pointer to a function that knows how to manage
03663  * the external info data. Thus, in order to add several types of extended
03664  * info, you need to define a "proc" function for each type.
03665  *
03666  * @param node
03667  *      The node where to add the extended info
03668  * @param proc
03669  *      A function pointer used to identify the type of the data, and that
03670  *      knows how to manage it
03671  * @param data
03672  *      Extended info to add.
03673  * @return
03674  *      1 if success, 0 if the given node already has extended info of the
03675  *      type defined by the "proc" function, < 0 on error
03676  *
03677  * @since 0.6.4
03678  */
03679 int iso_node_add_xinfo(IsoNode *node, iso_node_xinfo_func proc, void *data);
03680 
03681 /**
03682  * Remove the given extended info (defined by the proc function) from the
03683  * given node.
03684  *
03685  * @return
03686  *      1 on success, 0 if node does not have extended info of the requested
03687  *      type, < 0 on error
03688  *
03689  * @since 0.6.4
03690  */
03691 int iso_node_remove_xinfo(IsoNode *node, iso_node_xinfo_func proc);
03692 
03693 /**
03694  * Remove all extended information  from the given node.
03695  *
03696  * @param node
03697  *      The node where to remove all extended info
03698  * @param flag
03699  *      Bitfield for control purposes, unused yet, submit 0
03700  * @return
03701  *      1 on success, < 0 on error
03702  *      
03703  * @since 1.0.2
03704  */
03705 int iso_node_remove_all_xinfo(IsoNode *node, int flag);
03706 
03707 /**
03708  * Get the given extended info (defined by the proc function) from the
03709  * given node.
03710  *
03711  * @param node
03712  *      The node to inquire
03713  * @param proc
03714  *      The function pointer which serves as key
03715  * @param data
03716  *      Will after successful call point to the xinfo data corresponding
03717  *      to the given proc. This is a pointer, not a feeable data copy.
03718  * @return
03719  *      1 on success, 0 if node does not have extended info of the requested
03720  *      type, < 0 on error
03721  *
03722  * @since 0.6.4
03723  */
03724 int iso_node_get_xinfo(IsoNode *node, iso_node_xinfo_func proc, void **data);
03725 
03726 
03727 /**
03728  * Get the next pair of function pointer and data of an iteration of the
03729  * list of extended informations. Like:
03730  *     iso_node_xinfo_func proc;
03731  *     void *handle = NULL, *data; 
03732  *     while (iso_node_get_next_xinfo(node, &handle, &proc, &data) == 1) {
03733  *         ... make use of proc and data ...
03734  *     }
03735  * The iteration allocates no memory. So you may end it without any disposal
03736  * action.
03737  * IMPORTANT: Do not continue iterations after manipulating the extended
03738  *            information of a node. Memory corruption hazard !
03739  * @param node
03740  *      The node to inquire
03741  * @param  handle
03742  *      The opaque iteration handle. Initialize iteration by submitting
03743  *      a pointer to a void pointer with value NULL.
03744  *      Do not alter its content until iteration has ended.
03745  * @param proc
03746  *      The function pointer which serves as key
03747  * @param data
03748  *      Will be filled with the extended info corresponding to the given proc
03749  *      function
03750  * @return
03751  *      1 on success
03752  *      0 if iteration has ended (proc and data are invalid then)
03753  *      < 0 on error
03754  *
03755  * @since 1.0.2
03756  */
03757 int iso_node_get_next_xinfo(IsoNode *node, void **handle,
03758                             iso_node_xinfo_func *proc, void **data);
03759 
03760 
03761 /**
03762  * Class of functions to clone extended information. A function instance gets
03763  * associated to a particular iso_node_xinfo_func instance by function
03764  * iso_node_xinfo_make_clonable(). This is a precondition to have IsoNode
03765  * objects clonable which carry data for a particular iso_node_xinfo_func.
03766  *
03767  * @param old_data
03768  *     Data item to be cloned
03769  * @param new_data
03770  *     Shall return the cloned data item
03771  * @param flag
03772  *     Unused yet, submit 0
03773  *     The function shall return ISO_XINFO_NO_CLONE on unknown flag bits.
03774  * @return
03775  *     > 0 number of allocated bytes
03776  *       0 no size info is available
03777  *     < 0 error
03778  * 
03779  * @since 1.0.2
03780  */
03781 typedef int (*iso_node_xinfo_cloner)(void *old_data, void **new_data,int flag);
03782 
03783 /**
03784  * Associate a iso_node_xinfo_cloner to a particular class of extended
03785  * information in order to make it clonable.
03786  *
03787  * @param proc
03788  *     The key and disposal function which identifies the particular
03789  *     extended information class.
03790  * @param cloner
03791  *     The cloner function which shall be associated with proc.
03792  * @param flag
03793  *     Unused yet, submit 0
03794  * @return
03795  *     1 success, < 0 error
03796  * 
03797  * @since 1.0.2
03798  */
03799 int iso_node_xinfo_make_clonable(iso_node_xinfo_func proc,
03800                                  iso_node_xinfo_cloner cloner, int flag);
03801 
03802 /**
03803  * Inquire the registered cloner function for a particular class of
03804  * extended information.
03805  *
03806  * @param proc
03807  *     The key and disposal function which identifies the particular
03808  *     extended information class.
03809  * @param cloner
03810  *     Will return the cloner function which is associated with proc, or NULL.
03811  * @param flag
03812  *     Unused yet, submit 0
03813  * @return
03814  *     1 success, 0 no cloner registered for proc, < 0 error
03815  * 
03816  * @since 1.0.2
03817  */
03818 int iso_node_xinfo_get_cloner(iso_node_xinfo_func proc,
03819                               iso_node_xinfo_cloner *cloner, int flag);
03820 
03821 
03822 /**
03823  * Set the name of a node. Note that if the node is already added to a dir
03824  * this can fail if dir already contains a node with the new name.
03825  *
03826  * @param node
03827  *      The node whose name you want to change. Note that you can't change
03828  *      the name of the root.
03829  * @param name
03830  *      The name for the node. If you supply an empty string or a
03831  *      name greater than 255 characters this returns with failure, and
03832  *      node name is not modified.
03833  * @return
03834  *      1 on success, < 0 on error
03835  *
03836  * @since 0.6.2
03837  */
03838 int iso_node_set_name(IsoNode *node, const char *name);
03839 
03840 /**
03841  * Get the name of a node.
03842  * The returned string belongs to the node and should not be modified nor
03843  * freed. Use strdup if you really need your own copy.
03844  *
03845  * @since 0.6.2
03846  */
03847 const char *iso_node_get_name(const IsoNode *node);
03848 
03849 /**
03850  * Set the permissions for the node. This attribute is only useful when
03851  * Rock Ridge extensions are enabled.
03852  *
03853  * @param node
03854  *      The node to change
03855  * @param mode
03856  *     bitmask with the permissions of the node, as specified in 'man 2 stat'.
03857  *     The file type bitfields will be ignored, only file permissions will be
03858  *     modified.
03859  *
03860  * @since 0.6.2
03861  */
03862 void iso_node_set_permissions(IsoNode *node, mode_t mode);
03863 
03864 /**
03865  * Get the permissions for the node
03866  *
03867  * @since 0.6.2
03868  */
03869 mode_t iso_node_get_permissions(const IsoNode *node);
03870 
03871 /**
03872  * Get the mode of the node, both permissions and file type, as specified in
03873  * 'man 2 stat'.
03874  *
03875  * @since 0.6.2
03876  */
03877 mode_t iso_node_get_mode(const IsoNode *node);
03878 
03879 /**
03880  * Set the user id for the node. This attribute is only useful when
03881  * Rock Ridge extensions are enabled.
03882  *
03883  * @since 0.6.2
03884  */
03885 void iso_node_set_uid(IsoNode *node, uid_t uid);
03886 
03887 /**
03888  * Get the user id of the node.
03889  *
03890  * @since 0.6.2
03891  */
03892 uid_t iso_node_get_uid(const IsoNode *node);
03893 
03894 /**
03895  * Set the group id for the node. This attribute is only useful when
03896  * Rock Ridge extensions are enabled.
03897  *
03898  * @since 0.6.2
03899  */
03900 void iso_node_set_gid(IsoNode *node, gid_t gid);
03901 
03902 /**
03903  * Get the group id of the node.
03904  *
03905  * @since 0.6.2
03906  */
03907 gid_t iso_node_get_gid(const IsoNode *node);
03908 
03909 /**
03910  * Set the time of last modification of the file
03911  *
03912  * @since 0.6.2
03913  */
03914 void iso_node_set_mtime(IsoNode *node, time_t time);
03915 
03916 /**
03917  * Get the time of last modification of the file
03918  *
03919  * @since 0.6.2
03920  */
03921 time_t iso_node_get_mtime(const IsoNode *node);
03922 
03923 /**
03924  * Set the time of last access to the file
03925  *
03926  * @since 0.6.2
03927  */
03928 void iso_node_set_atime(IsoNode *node, time_t time);
03929 
03930 /**
03931  * Get the time of last access to the file
03932  *
03933  * @since 0.6.2
03934  */
03935 time_t iso_node_get_atime(const IsoNode *node);
03936 
03937 /**
03938  * Set the time of last status change of the file
03939  *
03940  * @since 0.6.2
03941  */
03942 void iso_node_set_ctime(IsoNode *node, time_t time);
03943 
03944 /**
03945  * Get the time of last status change of the file
03946  *
03947  * @since 0.6.2
03948  */
03949 time_t iso_node_get_ctime(const IsoNode *node);
03950 
03951 /**
03952  * Set whether the node will be hidden in the directory trees of RR/ISO 9660,
03953  * or of Joliet (if enabled at all), or of ISO-9660:1999 (if enabled at all).
03954  *
03955  * A hidden file does not show up by name in the affected directory tree.
03956  * For example, if a file is hidden only in Joliet, it will normally
03957  * not be visible on Windows systems, while being shown on GNU/Linux.
03958  *
03959  * If a file is not shown in any of the enabled trees, then its content will
03960  * not be written to the image, unless LIBISO_HIDE_BUT_WRITE is given (which
03961  * is available only since release 0.6.34).
03962  *
03963  * @param node
03964  *      The node that is to be hidden.
03965  * @param hide_attrs
03966  *      Or-combination of values from enum IsoHideNodeFlag to set the trees
03967  *      in which the node's name shall be hidden.
03968  *
03969  * @since 0.6.2
03970  */
03971 void iso_node_set_hidden(IsoNode *node, int hide_attrs);
03972 
03973 /**
03974  * Get the hide_attrs as eventually set by iso_node_set_hidden().
03975  *
03976  * @param node
03977  *      The node to inquire.
03978  * @return
03979  *      Or-combination of values from enum IsoHideNodeFlag which are
03980  *      currently set for the node.
03981  *
03982  * @since 0.6.34
03983  */
03984 int iso_node_get_hidden(IsoNode *node);
03985 
03986 /**
03987  * Compare two nodes whether they are based on the same input and
03988  * can be considered as hardlinks to the same file objects.
03989  *
03990  * @param n1
03991  *     The first node to compare.
03992  * @param n2
03993  *     The second node to compare.
03994  * @return
03995  *     -1 if s1 is smaller s2 , 0 if s1 matches s2 , 1 if s1 is larger s2
03996  * @param flag
03997  *     Bitfield for control purposes, unused yet, submit 0
03998  * @since 0.6.20
03999  */
04000 int iso_node_cmp_ino(IsoNode *n1, IsoNode *n2, int flag);
04001 
04002 /**
04003  * Add a new node to a dir. Note that this function don't add a new ref to
04004  * the node, so you don't need to free it, it will be automatically freed
04005  * when the dir is deleted. Of course, if you want to keep using the node
04006  * after the dir life, you need to iso_node_ref() it.
04007  *
04008  * @param dir
04009  *     the dir where to add the node
04010  * @param child
04011  *     the node to add. You must ensure that the node hasn't previously added
04012  *     to other dir, and that the node name is unique inside the child.
04013  *     Otherwise this function will return a failure, and the child won't be
04014  *     inserted.
04015  * @param replace
04016  *     if the dir already contains a node with the same name, whether to
04017  *     replace or not the old node with this.
04018  * @return
04019  *     number of nodes in dir if succes, < 0 otherwise
04020  *     Possible errors:
04021  *         ISO_NULL_POINTER, if dir or child are NULL
04022  *         ISO_NODE_ALREADY_ADDED, if child is already added to other dir
04023  *         ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists
04024  *         ISO_WRONG_ARG_VALUE, if child == dir, or replace != (0,1)
04025  *
04026  * @since 0.6.2
04027  */
04028 int iso_dir_add_node(IsoDir *dir, IsoNode *child,
04029                      enum iso_replace_mode replace);
04030 
04031 /**
04032  * Locate a node inside a given dir.
04033  *
04034  * @param dir
04035  *     The dir where to look for the node.
04036  * @param name
04037  *     The name of the node
04038  * @param node
04039  *     Location for a pointer to the node, it will filled with NULL if the dir
04040  *     doesn't have a child with the given name.
04041  *     The node will be owned by the dir and shouldn't be unref(). Just call
04042  *     iso_node_ref() to get your own reference to the node.
04043  *     Note that you can pass NULL is the only thing you want to do is check
04044  *     if a node with such name already exists on dir.
04045  * @return
04046  *     1 node found, 0 child has no such node, < 0 error
04047  *     Possible errors:
04048  *         ISO_NULL_POINTER, if dir or name are NULL
04049  *
04050  * @since 0.6.2
04051  */
04052 int iso_dir_get_node(IsoDir *dir, const char *name, IsoNode **node);
04053 
04054 /**
04055  * Get the number of children of a directory.
04056  *
04057  * @return
04058  *     >= 0 number of items, < 0 error
04059  *     Possible errors:
04060  *         ISO_NULL_POINTER, if dir is NULL
04061  *
04062  * @since 0.6.2
04063  */
04064 int iso_dir_get_children_count(IsoDir *dir);
04065 
04066 /**
04067  * Removes a child from a directory.
04068  * The child is not freed, so you will become the owner of the node. Later
04069  * you can add the node to another dir (calling iso_dir_add_node), or free
04070  * it if you don't need it (with iso_node_unref).
04071  *
04072  * @return
04073  *     1 on success, < 0 error
04074  *     Possible errors:
04075  *         ISO_NULL_POINTER, if node is NULL
04076  *         ISO_NODE_NOT_ADDED_TO_DIR, if node doesn't belong to a dir
04077  *
04078  * @since 0.6.2
04079  */
04080 int iso_node_take(IsoNode *node);
04081 
04082 /**
04083  * Removes a child from a directory and free (unref) it.
04084  * If you want to keep the child alive, you need to iso_node_ref() it
04085  * before this call, but in that case iso_node_take() is a better
04086  * alternative.
04087  *
04088  * @return
04089  *     1 on success, < 0 error
04090  *
04091  * @since 0.6.2
04092  */
04093 int iso_node_remove(IsoNode *node);
04094 
04095 /*
04096  * Get the parent of the given iso tree node. No extra ref is added to the
04097  * returned directory, you must take your ref. with iso_node_ref() if you
04098  * need it.
04099  *
04100  * If node is the root node, the same node will be returned as its parent.
04101  *
04102  * This returns NULL if the node doesn't pertain to any tree
04103  * (it was removed/taken).
04104  *
04105  * @since 0.6.2
04106  */
04107 IsoDir *iso_node_get_parent(IsoNode *node);
04108 
04109 /**
04110  * Get an iterator for the children of the given dir.
04111  *
04112  * You can iterate over the children with iso_dir_iter_next. When finished,
04113  * you should free the iterator with iso_dir_iter_free.
04114  * You musn't delete a child of the same dir, using iso_node_take() or
04115  * iso_node_remove(), while you're using the iterator. You can use
04116  * iso_dir_iter_take() or iso_dir_iter_remove() instead.
04117  *
04118  * You can use the iterator in the way like this
04119  *
04120  * IsoDirIter *iter;
04121  * IsoNode *node;
04122  * if ( iso_dir_get_children(dir, &iter) != 1 ) {
04123  *     // handle error
04124  * }
04125  * while ( iso_dir_iter_next(iter, &node) == 1 ) {
04126  *     // do something with the child
04127  * }
04128  * iso_dir_iter_free(iter);
04129  *
04130  * An iterator is intended to be used in a single iteration over the
04131  * children of a dir. Thus, it should be treated as a temporary object,
04132  * and free as soon as possible.
04133  *
04134  * @return
04135  *     1 success, < 0 error
04136  *     Possible errors:
04137  *         ISO_NULL_POINTER, if dir or iter are NULL
04138  *         ISO_OUT_OF_MEM
04139  *
04140  * @since 0.6.2
04141  */
04142 int iso_dir_get_children(const IsoDir *dir, IsoDirIter **iter);
04143 
04144 /**
04145  * Get the next child.
04146  * Take care that the node is owned by its parent, and will be unref() when
04147  * the parent is freed. If you want your own ref to it, call iso_node_ref()
04148  * on it.
04149  *
04150  * @return
04151  *     1 success, 0 if dir has no more elements, < 0 error
04152  *     Possible errors:
04153  *         ISO_NULL_POINTER, if node or iter are NULL
04154  *         ISO_ERROR, on wrong iter usage, usual caused by modiying the
04155  *         dir during iteration
04156  *
04157  * @since 0.6.2
04158  */
04159 int iso_dir_iter_next(IsoDirIter *iter, IsoNode **node);
04160 
04161 /**
04162  * Check if there're more children.
04163  *
04164  * @return
04165  *     1 dir has more elements, 0 no, < 0 error
04166  *     Possible errors:
04167  *         ISO_NULL_POINTER, if iter is NULL
04168  *
04169  * @since 0.6.2
04170  */
04171 int iso_dir_iter_has_next(IsoDirIter *iter);
04172 
04173 /**
04174  * Free a dir iterator.
04175  *
04176  * @since 0.6.2
04177  */
04178 void iso_dir_iter_free(IsoDirIter *iter);
04179 
04180 /**
04181  * Removes a child from a directory during an iteration, without freeing it.
04182  * It's like iso_node_take(), but to be used during a directory iteration.
04183  * The node removed will be the last returned by the iteration.
04184  *
04185  * If you call this function twice without calling iso_dir_iter_next between
04186  * them is not allowed and you will get an ISO_ERROR in second call.
04187  *
04188  * @return
04189  *     1 on succes, < 0 error
04190  *     Possible errors:
04191  *         ISO_NULL_POINTER, if iter is NULL
04192  *         ISO_ERROR, on wrong iter usage, for example by call this before
04193  *         iso_dir_iter_next.
04194  *
04195  * @since 0.6.2
04196  */
04197 int iso_dir_iter_take(IsoDirIter *iter);
04198 
04199 /**
04200  * Removes a child from a directory during an iteration and unref() it.
04201  * Like iso_node_remove(), but to be used during a directory iteration.
04202  * The node removed will be the one returned by the previous iteration.
04203  *
04204  * It is not allowed to call this function twice without calling
04205  * iso_dir_iter_next inbetween.
04206  *
04207  * @return
04208  *     1 on succes, < 0 error
04209  *     Possible errors:
04210  *         ISO_NULL_POINTER, if iter is NULL
04211  *         ISO_ERROR, on wrong iter usage, for example by calling this before
04212  *         iso_dir_iter_next.
04213  *
04214  * @since 0.6.2
04215  */
04216 int iso_dir_iter_remove(IsoDirIter *iter);
04217 
04218 /**
04219  * Removes a node by iso_node_remove() or iso_dir_iter_remove(). If the node
04220  * is a directory then the whole tree of nodes underneath is removed too.
04221  *
04222  * @param node
04223  *      The node to be removed.
04224  * @param iter
04225  *      If not NULL, then the node will be removed by iso_dir_iter_remove(iter)
04226  *      else it will be removed by iso_node_remove(node).
04227  * @return
04228  *      1 is success, <0 indicates error
04229  *
04230  * @since 1.0.2
04231  */
04232 int iso_node_remove_tree(IsoNode *node, IsoDirIter *boss_iter);
04233 
04234 
04235 /**
04236  * @since 0.6.4
04237  */
04238 typedef struct iso_find_condition IsoFindCondition;
04239 
04240 /**
04241  * Create a new condition that checks if the node name matches the given
04242  * wildcard.
04243  *
04244  * @param wildcard
04245  * @result
04246  *      The created IsoFindCondition, NULL on error.
04247  *
04248  * @since 0.6.4
04249  */
04250 IsoFindCondition *iso_new_find_conditions_name(const char *wildcard);
04251 
04252 /**
04253  * Create a new condition that checks the node mode against a mode mask. It
04254  * can be used to check both file type and permissions.
04255  *
04256  * For example:
04257  *
04258  * iso_new_find_conditions_mode(S_IFREG) : search for regular files
04259  * iso_new_find_conditions_mode(S_IFCHR | S_IWUSR) : search for character
04260  *     devices where owner has write permissions.
04261  *
04262  * @param mask
04263  *      Mode mask to AND against node mode.
04264  * @result
04265  *      The created IsoFindCondition, NULL on error.
04266  *
04267  * @since 0.6.4
04268  */
04269 IsoFindCondition *iso_new_find_conditions_mode(mode_t mask);
04270 
04271 /**
04272  * Create a new condition that checks the node gid.
04273  *
04274  * @param gid
04275  *      Desired Group Id.
04276  * @result
04277  *      The created IsoFindCondition, NULL on error.
04278  *
04279  * @since 0.6.4
04280  */
04281 IsoFindCondition *iso_new_find_conditions_gid(gid_t gid);
04282 
04283 /**
04284  * Create a new condition that checks the node uid.
04285  *
04286  * @param uid
04287  *      Desired User Id.
04288  * @result
04289  *      The created IsoFindCondition, NULL on error.
04290  *
04291  * @since 0.6.4
04292  */
04293 IsoFindCondition *iso_new_find_conditions_uid(uid_t uid);
04294 
04295 /**
04296  * Possible comparison between IsoNode and given conditions.
04297  *
04298  * @since 0.6.4
04299  */
04300 enum iso_find_comparisons {
04301     ISO_FIND_COND_GREATER,
04302     ISO_FIND_COND_GREATER_OR_EQUAL,
04303     ISO_FIND_COND_EQUAL,
04304     ISO_FIND_COND_LESS,
04305     ISO_FIND_COND_LESS_OR_EQUAL
04306 };
04307 
04308 /**
04309  * Create a new condition that checks the time of last access.
04310  *
04311  * @param time
04312  *      Time to compare against IsoNode atime.
04313  * @param comparison
04314  *      Comparison to be done between IsoNode atime and submitted time.
04315  *      Note that ISO_FIND_COND_GREATER, for example, is true if the node
04316  *      time is greater than the submitted time.
04317  * @result
04318  *      The created IsoFindCondition, NULL on error.
04319  *
04320  * @since 0.6.4
04321  */
04322 IsoFindCondition *iso_new_find_conditions_atime(time_t time,
04323                       enum iso_find_comparisons comparison);
04324 
04325 /**
04326  * Create a new condition that checks the time of last modification.
04327  *
04328  * @param time
04329  *      Time to compare against IsoNode mtime.
04330  * @param comparison
04331  *      Comparison to be done between IsoNode mtime and submitted time.
04332  *      Note that ISO_FIND_COND_GREATER, for example, is true if the node
04333  *      time is greater than the submitted time.
04334  * @result
04335  *      The created IsoFindCondition, NULL on error.
04336  *
04337  * @since 0.6.4
04338  */
04339 IsoFindCondition *iso_new_find_conditions_mtime(time_t time,
04340                       enum iso_find_comparisons comparison);
04341 
04342 /**
04343  * Create a new condition that checks the time of last status change.
04344  *
04345  * @param time
04346  *      Time to compare against IsoNode ctime.
04347  * @param comparison
04348  *      Comparison to be done between IsoNode ctime and submitted time.
04349  *      Note that ISO_FIND_COND_GREATER, for example, is true if the node
04350  *      time is greater than the submitted time.
04351  * @result
04352  *      The created IsoFindCondition, NULL on error.
04353  *
04354  * @since 0.6.4
04355  */
04356 IsoFindCondition *iso_new_find_conditions_ctime(time_t time,
04357                       enum iso_find_comparisons comparison);
04358 
04359 /**
04360  * Create a new condition that check if the two given conditions are
04361  * valid.
04362  *
04363  * @param a
04364  * @param b
04365  *      IsoFindCondition to compare
04366  * @result
04367  *      The created IsoFindCondition, NULL on error.
04368  *
04369  * @since 0.6.4
04370  */
04371 IsoFindCondition *iso_new_find_conditions_and(IsoFindCondition *a,
04372                                               IsoFindCondition *b);
04373 
04374 /**
04375  * Create a new condition that check if at least one the two given conditions
04376  * is valid.
04377  *
04378  * @param a
04379  * @param b
04380  *      IsoFindCondition to compare
04381  * @result
04382  *      The created IsoFindCondition, NULL on error.
04383  *
04384  * @since 0.6.4
04385  */
04386 IsoFindCondition *iso_new_find_conditions_or(IsoFindCondition *a,
04387                                               IsoFindCondition *b);
04388 
04389 /**
04390  * Create a new condition that check if the given conditions is false.
04391  *
04392  * @param negate
04393  * @result
04394  *      The created IsoFindCondition, NULL on error.
04395  *
04396  * @since 0.6.4
04397  */
04398 IsoFindCondition *iso_new_find_conditions_not(IsoFindCondition *negate);
04399 
04400 /**
04401  * Find all directory children that match the given condition.
04402  *
04403  * @param dir
04404  *      Directory where we will search children.
04405  * @param cond
04406  *      Condition that the children must match in order to be returned.
04407  *      It will be free together with the iterator. Remember to delete it
04408  *      if this function return error.
04409  * @param iter
04410  *      Iterator that returns only the children that match condition.
04411  * @return
04412  *      1 on success, < 0 on error
04413  *
04414  * @since 0.6.4
04415  */
04416 int iso_dir_find_children(IsoDir* dir, IsoFindCondition *cond,
04417                           IsoDirIter **iter);
04418 
04419 /**
04420  * Get the destination of a node.
04421  * The returned string belongs to the node and should not be modified nor
04422  * freed. Use strdup if you really need your own copy.
04423  *
04424  * @since 0.6.2
04425  */
04426 const char *iso_symlink_get_dest(const IsoSymlink *link);
04427 
04428 /**
04429  * Set the destination of a link.
04430  *
04431  * @param opts
04432  *     The option set to be manipulated
04433  * @param dest
04434  *     New destination for the link. It must be a non-empty string, otherwise
04435  *     this function doesn't modify previous destination.
04436  * @return
04437  *     1 on success, < 0 on error
04438  *
04439  * @since 0.6.2
04440  */
04441 int iso_symlink_set_dest(IsoSymlink *link, const char *dest);
04442 
04443 /**
04444  * Sets the order in which a node will be written on image. The data content
04445  * of files with high weight will be written to low block addresses.
04446  *
04447  * @param node
04448  *      The node which weight will be changed. If it's a dir, this function
04449  *      will change the weight of all its children. For nodes other that dirs
04450  *      or regular files, this function has no effect.
04451  * @param w
04452  *      The weight as a integer number, the greater this value is, the
04453  *      closer from the begining of image the file will be written.
04454  *      Default value at IsoNode creation is 0.
04455  *
04456  * @since 0.6.2
04457  */
04458 void iso_node_set_sort_weight(IsoNode *node, int w);
04459 
04460 /**
04461  * Get the sort weight of a file.
04462  *
04463  * @since 0.6.2
04464  */
04465 int iso_file_get_sort_weight(IsoFile *file);
04466 
04467 /**
04468  * Get the size of the file, in bytes
04469  *
04470  * @since 0.6.2
04471  */
04472 off_t iso_file_get_size(IsoFile *file);
04473 
04474 /**
04475  * Get the device id (major/minor numbers) of the given block or
04476  * character device file. The result is undefined for other kind
04477  * of special files, of first be sure iso_node_get_mode() returns either
04478  * S_IFBLK or S_IFCHR.
04479  *
04480  * @since 0.6.6
04481  */
04482 dev_t iso_special_get_dev(IsoSpecial *special);
04483 
04484 /**
04485  * Get the IsoStream that represents the contents of the given IsoFile.
04486  * The stream may be a filter stream which itself get its input from a
04487  * further stream. This may be inquired by iso_stream_get_input_stream().
04488  *
04489  * If you iso_stream_open() the stream, iso_stream_close() it before
04490  * image generation begins.
04491  *
04492  * @return
04493  *      The IsoStream. No extra ref is added, so the IsoStream belongs to the
04494  *      IsoFile, and it may be freed together with it. Add your own ref with
04495  *      iso_stream_ref() if you need it.
04496  *
04497  * @since 0.6.4
04498  */
04499 IsoStream *iso_file_get_stream(IsoFile *file);
04500 
04501 /**
04502  * Get the block lba of a file node, if it was imported from an old image.
04503  *
04504  * @param file
04505  *      The file
04506  * @param lba
04507  *      Will be filled with the kba
04508  * @param flag
04509  *      Reserved for future usage, submit 0
04510  * @return
04511  *      1 if lba is valid (file comes from old image), 0 if file was newly
04512  *      added, i.e. it does not come from an old image, < 0 error
04513  *
04514  * @since 0.6.4
04515  *
04516  * @deprecated Use iso_file_get_old_image_sections(), as this function does
04517  *             not work with multi-extend files.
04518  */
04519 int iso_file_get_old_image_lba(IsoFile *file, uint32_t *lba, int flag);
04520 
04521 /**
04522  * Get the start addresses and the sizes of the data extents of a file node
04523  * if it was imported from an old image.
04524  *
04525  * @param file
04526  *      The file
04527  * @param section_count
04528  *      Returns the number of extent entries in sections array.
04529  * @param sections
04530  *      Returns the array of file sections. Apply free() to dispose it.
04531  * @param flag
04532  *      Reserved for future usage, submit 0
04533  * @return
04534  *      1 if there are valid extents (file comes from old image),
04535  *      0 if file was newly added, i.e. it does not come from an old image,
04536  *      < 0 error
04537  *
04538  * @since 0.6.8
04539  */
04540 int iso_file_get_old_image_sections(IsoFile *file, int *section_count,
04541                                    struct iso_file_section **sections,
04542                                    int flag);
04543 
04544 /*
04545  * Like iso_file_get_old_image_lba(), but take an IsoNode.
04546  *
04547  * @return
04548  *      1 if lba is valid (file comes from old image), 0 if file was newly
04549  *      added, i.e. it does not come from an old image, 2 node type has no
04550  *      LBA (no regular file), < 0 error
04551  *
04552  * @since 0.6.4
04553  */
04554 int iso_node_get_old_image_lba(IsoNode *node, uint32_t *lba, int flag);
04555 
04556 /**
04557  * Add a new directory to the iso tree. Permissions, owner and hidden atts
04558  * are taken from parent, you can modify them later.
04559  *
04560  * @param parent
04561  *      the dir where the new directory will be created
04562  * @param name
04563  *      name for the new dir. If a node with same name already exists on
04564  *      parent, this functions fails with ISO_NODE_NAME_NOT_UNIQUE.
04565  * @param dir
04566  *      place where to store a pointer to the newly created dir. No extra
04567  *      ref is addded, so you will need to call iso_node_ref() if you really
04568  *      need it. You can pass NULL in this parameter if you don't need the
04569  *      pointer.
04570  * @return
04571  *     number of nodes in parent if success, < 0 otherwise
04572  *     Possible errors:
04573  *         ISO_NULL_POINTER, if parent or name are NULL
04574  *         ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists
04575  *         ISO_OUT_OF_MEM
04576  *
04577  * @since 0.6.2
04578  */
04579 int iso_tree_add_new_dir(IsoDir *parent, const char *name, IsoDir **dir);
04580 
04581 /**
04582  * Add a new regular file to the iso tree. Permissions are set to 0444,
04583  * owner and hidden atts are taken from parent. You can modify any of them
04584  * later.
04585  *
04586  * @param parent
04587  *      the dir where the new file will be created
04588  * @param name
04589  *      name for the new file. If a node with same name already exists on
04590  *      parent, this functions fails with ISO_NODE_NAME_NOT_UNIQUE.
04591  * @param stream
04592  *      IsoStream for the contents of the file. The reference will be taken
04593  *      by the newly created file, you will need to take an extra ref to it
04594  *      if you need it.
04595  * @param file
04596  *      place where to store a pointer to the newly created file. No extra
04597  *      ref is addded, so you will need to call iso_node_ref() if you really
04598  *      need it. You can pass NULL in this parameter if you don't need the
04599  *      pointer
04600  * @return
04601  *     number of nodes in parent if success, < 0 otherwise
04602  *     Possible errors:
04603  *         ISO_NULL_POINTER, if parent, name or dest are NULL
04604  *         ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists
04605  *         ISO_OUT_OF_MEM
04606  *
04607  * @since 0.6.4
04608  */
04609 int iso_tree_add_new_file(IsoDir *parent, const char *name, IsoStream *stream,
04610                           IsoFile **file);
04611 
04612 /**
04613  * Create an IsoStream object from content which is stored in a dynamically
04614  * allocated memory buffer. The new stream will become owner of the buffer
04615  * and apply free() to it when the stream finally gets destroyed itself.
04616  *
04617  * @param buf
04618  *     The dynamically allocated memory buffer with the stream content.
04619  * @parm size
04620  *     The number of bytes which may be read from buf.
04621  * @param stream
04622  *     Will return a reference to the newly created stream.
04623  * @return
04624  *     ISO_SUCCESS or <0 for error. E.g. ISO_NULL_POINTER, ISO_OUT_OF_MEM.
04625  *
04626  * @since 1.0.0
04627  */
04628 int iso_memory_stream_new(unsigned char *buf, size_t size, IsoStream **stream);
04629 
04630 /**
04631  * Add a new symlink to the directory tree. Permissions are set to 0777,
04632  * owner and hidden atts are taken from parent. You can modify any of them
04633  * later.
04634  *
04635  * @param parent
04636  *      the dir where the new symlink will be created
04637  * @param name
04638  *      name for the new symlink. If a node with same name already exists on
04639  *      parent, this functions fails with ISO_NODE_NAME_NOT_UNIQUE.
04640  * @param dest
04641  *      destination of the link
04642  * @param link
04643  *      place where to store a pointer to the newly created link. No extra
04644  *      ref is addded, so you will need to call iso_node_ref() if you really
04645  *      need it. You can pass NULL in this parameter if you don't need the
04646  *      pointer
04647  * @return
04648  *     number of nodes in parent if success, < 0 otherwise
04649  *     Possible errors:
04650  *         ISO_NULL_POINTER, if parent, name or dest are NULL
04651  *         ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists
04652  *         ISO_OUT_OF_MEM
04653  *
04654  * @since 0.6.2
04655  */
04656 int iso_tree_add_new_symlink(IsoDir *parent, const char *name,
04657                              const char *dest, IsoSymlink **link);
04658 
04659 /**
04660  * Add a new special file to the directory tree. As far as libisofs concerns,
04661  * an special file is a block device, a character device, a FIFO (named pipe)
04662  * or a socket. You can choose the specific kind of file you want to add
04663  * by setting mode propertly (see man 2 stat).
04664  *
04665  * Note that special files are only written to image when Rock Ridge
04666  * extensions are enabled. Moreover, a special file is just a directory entry
04667  * in the image tree, no data is written beyond that.
04668  *
04669  * Owner and hidden atts are taken from parent. You can modify any of them
04670  * later.
04671  *
04672  * @param parent
04673  *      the dir where the new special file will be created
04674  * @param name
04675  *      name for the new special file. If a node with same name already exists
04676  *      on parent, this functions fails with ISO_NODE_NAME_NOT_UNIQUE.
04677  * @param mode
04678  *      file type and permissions for the new node. Note that you can't
04679  *      specify any kind of file here, only special types are allowed. i.e,
04680  *      S_IFSOCK, S_IFBLK, S_IFCHR and S_IFIFO are valid types; S_IFLNK,
04681  *      S_IFREG and S_IFDIR aren't.
04682  * @param dev
04683  *      device ID, equivalent to the st_rdev field in man 2 stat.
04684  * @param special
04685  *      place where to store a pointer to the newly created special file. No
04686  *      extra ref is addded, so you will need to call iso_node_ref() if you
04687  *      really need it. You can pass NULL in this parameter if you don't need
04688  *      the pointer.
04689  * @return
04690  *     number of nodes in parent if success, < 0 otherwise
04691  *     Possible errors:
04692  *         ISO_NULL_POINTER, if parent, name or dest are NULL
04693  *         ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists
04694  *         ISO_WRONG_ARG_VALUE if you select a incorrect mode
04695  *         ISO_OUT_OF_MEM
04696  *
04697  * @since 0.6.2
04698  */
04699 int iso_tree_add_new_special(IsoDir *parent, const char *name, mode_t mode,
04700                              dev_t dev, IsoSpecial **special);
04701 
04702 /**
04703  * Set whether to follow or not symbolic links when added a file from a source
04704  * to IsoImage. Default behavior is to not follow symlinks.
04705  *
04706  * @since 0.6.2
04707  */
04708 void iso_tree_set_follow_symlinks(IsoImage *image, int follow);
04709 
04710 /**
04711  * Get current setting for follow_symlinks.
04712  *
04713  * @see iso_tree_set_follow_symlinks
04714  * @since 0.6.2
04715  */
04716 int iso_tree_get_follow_symlinks(IsoImage *image);
04717 
04718 /**
04719  * Set whether to skip or not disk files with names beginning by '.'
04720  * when adding a directory recursively.
04721  * Default behavior is to not ignore them.
04722  *
04723  * Clarification: This is not related to the IsoNode property to be hidden
04724  *                in one or more of the resulting image trees as of
04725  *                IsoHideNodeFlag and iso_node_set_hidden().
04726  *
04727  * @since 0.6.2
04728  */
04729 void iso_tree_set_ignore_hidden(IsoImage *image, int skip);
04730 
04731 /**
04732  * Get current setting for ignore_hidden.
04733  *
04734  * @see iso_tree_set_ignore_hidden
04735  * @since 0.6.2
04736  */
04737 int iso_tree_get_ignore_hidden(IsoImage *image);
04738 
04739 /**
04740  * Set the replace mode, that defines the behavior of libisofs when adding
04741  * a node whit the same name that an existent one, during a recursive
04742  * directory addition.
04743  *
04744  * @since 0.6.2
04745  */
04746 void iso_tree_set_replace_mode(IsoImage *image, enum iso_replace_mode mode);
04747 
04748 /**
04749  * Get current setting for replace_mode.
04750  *
04751  * @see iso_tree_set_replace_mode
04752  * @since 0.6.2
04753  */
04754 enum iso_replace_mode iso_tree_get_replace_mode(IsoImage *image);
04755 
04756 /**
04757  * Set whether to skip or not special files. Default behavior is to not skip
04758  * them. Note that, despite of this setting, special files will never be added
04759  * to an image unless RR extensions were enabled.
04760  *
04761  * @param image
04762  *      The image to manipulate.
04763  * @param skip
04764  *      Bitmask to determine what kind of special files will be skipped:
04765  *          bit0: ignore FIFOs
04766  *          bit1: ignore Sockets
04767  *          bit2: ignore char devices
04768  *          bit3: ignore block devices
04769  *
04770  * @since 0.6.2
04771  */
04772 void iso_tree_set_ignore_special(IsoImage *image, int skip);
04773 
04774 /**
04775  * Get current setting for ignore_special.
04776  *
04777  * @see iso_tree_set_ignore_special
04778  * @since 0.6.2
04779  */
04780 int iso_tree_get_ignore_special(IsoImage *image);
04781 
04782 /**
04783  * Add a excluded path. These are paths that won't never added to image, and
04784  * will be excluded even when adding recursively its parent directory.
04785  *
04786  * For example, in
04787  *
04788  *   iso_tree_add_exclude(image, "/home/user/data/private");
04789  *   iso_tree_add_dir_rec(image, root, "/home/user/data");
04790  *
04791  * the directory /home/user/data/private won't be added to image.
04792  *
04793  * However, if you explicity add a deeper dir, it won't be excluded. i.e.,
04794  * in the following example.
04795  *
04796  *   iso_tree_add_exclude(image, "/home/user/data");
04797  *   iso_tree_add_dir_rec(image, root, "/home/user/data/private");
04798  *
04799  * the directory /home/user/data/private is added. On the other, side, and
04800  * foollowing the the example above,
04801  *
04802  *   iso_tree_add_dir_rec(image, root, "/home/user");
04803  *
04804  * will exclude the directory "/home/user/data".
04805  *
04806  * Absolute paths are not mandatory, you can, for example, add a relative
04807  * path such as:
04808  *
04809  *   iso_tree_add_exclude(image, "private");
04810  *   iso_tree_add_exclude(image, "user/data");
04811  *
04812  * to excluve, respectively, all files or dirs named private, and also all
04813  * files or dirs named data that belong to a folder named "user". Not that the
04814  * above rule about deeper dirs is still valid. i.e., if you call
04815  *
04816  *   iso_tree_add_dir_rec(image, root, "/home/user/data/music");
04817  *
04818  * it is included even containing "user/data" string. However, a possible
04819  * "/home/user/data/music/user/data" is not added.
04820  *
04821  * Usual wildcards, such as * or ? are also supported, with the usual meaning
04822  * as stated in "man 7 glob". For example
04823  *
04824  * // to exclude backup text files
04825  * iso_tree_add_exclude(image, "*.~");
04826  *
04827  * @return
04828  *      1 on success, < 0 on error
04829  *
04830  * @since 0.6.2
04831  */
04832 int iso_tree_add_exclude(IsoImage *image, const char *path);
04833 
04834 /**
04835  * Remove a previously added exclude.
04836  *
04837  * @see iso_tree_add_exclude
04838  * @return
04839  *      1 on success, 0 exclude do not exists, < 0 on error
04840  *
04841  * @since 0.6.2
04842  */
04843 int iso_tree_remove_exclude(IsoImage *image, const char *path);
04844 
04845 /**
04846  * Set a callback function that libisofs will call for each file that is
04847  * added to the given image by a recursive addition function. This includes
04848  * image import.
04849  *
04850  * @param image
04851  *      The image to manipulate.
04852  * @param report
04853  *      pointer to a function that will be called just before a file will be
04854  *      added to the image. You can control whether the file will be in fact
04855  *      added or ignored.
04856  *      This function should return 1 to add the file, 0 to ignore it and
04857  *      continue, < 0 to abort the process
04858  *      NULL is allowed if you don't want any callback.
04859  *
04860  * @since 0.6.2
04861  */
04862 void iso_tree_set_report_callback(IsoImage *image,
04863                                   int (*report)(IsoImage*, IsoFileSource*));
04864 
04865 /**
04866  * Add a new node to the image tree, from an existing file.
04867  *
04868  * TODO comment Builder and Filesystem related issues when exposing both
04869  *
04870  * All attributes will be taken from the source file. The appropriate file
04871  * type will be created.
04872  *
04873  * @param image
04874  *      The image
04875  * @param parent
04876  *      The directory in the image tree where the node will be added.
04877  * @param path
04878  *      The absolute path of the file in the local filesystem.
04879  *      The node will have the same leaf name as the file on disk.
04880  *      Its directory path depends on the parent node.
04881  * @param node
04882  *      place where to store a pointer to the newly added file. No
04883  *      extra ref is addded, so you will need to call iso_node_ref() if you
04884  *      really need it. You can pass NULL in this parameter if you don't need
04885  *      the pointer.
04886  * @return
04887  *     number of nodes in parent if success, < 0 otherwise
04888  *     Possible errors:
04889  *         ISO_NULL_POINTER, if image, parent or path are NULL
04890  *         ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists
04891  *         ISO_OUT_OF_MEM
04892  *
04893  * @since 0.6.2
04894  */
04895 int iso_tree_add_node(IsoImage *image, IsoDir *parent, const char *path,
04896                       IsoNode **node);
04897 
04898 /**
04899  * This is a more versatile form of iso_tree_add_node which allows to set
04900  * the node name in ISO image already when it gets added. 
04901  *
04902  * Add a new node to the image tree, from an existing file, and with the
04903  * given name, that must not exist on dir.
04904  *
04905  * @param image
04906  *      The image
04907  * @param parent
04908  *      The directory in the image tree where the node will be added.
04909  * @param name
04910  *      The leaf name that the node will have on image.
04911  *      Its directory path depends on the parent node.
04912  * @param path
04913  *      The absolute path of the file in the local filesystem.
04914  * @param node
04915  *      place where to store a pointer to the newly added file. No
04916  *      extra ref is addded, so you will need to call iso_node_ref() if you
04917  *      really need it. You can pass NULL in this parameter if you don't need
04918  *      the pointer.
04919  * @return
04920  *     number of nodes in parent if success, < 0 otherwise
04921  *     Possible errors:
04922  *         ISO_NULL_POINTER, if image, parent or path are NULL
04923  *         ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists
04924  *         ISO_OUT_OF_MEM
04925  *
04926  * @since 0.6.4
04927  */
04928 int iso_tree_add_new_node(IsoImage *image, IsoDir *parent, const char *name,
04929                           const char *path, IsoNode **node);
04930 
04931 /**
04932  * Add a new node to the image tree with the given name that must not exist
04933  * on dir. The node data content will be a byte interval out of the data
04934  * content of a file in the local filesystem.
04935  *
04936  * @param image
04937  *      The image
04938  * @param parent
04939  *      The directory in the image tree where the node will be added.
04940  * @param name
04941  *      The leaf name that the node will have on image.
04942  *      Its directory path depends on the parent node.
04943  * @param path
04944  *      The absolute path of the file in the local filesystem. For now
04945  *      only regular files and symlinks to regular files are supported.
04946  * @param offset
04947  *      Byte number in the given file from where to start reading data.
04948  * @param size
04949  *      Max size of the file. This may be more than actually available from
04950  *      byte offset to the end of the file in the local filesystem.
04951  * @param node
04952  *      place where to store a pointer to the newly added file. No
04953  *      extra ref is addded, so you will need to call iso_node_ref() if you
04954  *      really need it. You can pass NULL in this parameter if you don't need
04955  *      the pointer.
04956  * @return
04957  *     number of nodes in parent if success, < 0 otherwise
04958  *     Possible errors:
04959  *         ISO_NULL_POINTER, if image, parent or path are NULL
04960  *         ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists
04961  *         ISO_OUT_OF_MEM
04962  *
04963  * @since 0.6.4
04964  */
04965 int iso_tree_add_new_cut_out_node(IsoImage *image, IsoDir *parent,
04966                                   const char *name, const char *path,
04967                                   off_t offset, off_t size,
04968                                   IsoNode **node);
04969 
04970 /**
04971  * Create a copy of the given node under a different path. If the node is
04972  * actually a directory then clone its whole subtree.
04973  * This call may fail because an IsoFile is encountered which gets fed by an
04974  * IsoStream which cannot be cloned. See also IsoStream_Iface method
04975  * clone_stream().
04976  * Surely clonable node types are:
04977  *   IsoDir,
04978  *   IsoSymlink,
04979  *   IsoSpecial,
04980  *   IsoFile from a loaded ISO image,
04981  *   IsoFile referring to local filesystem files,
04982  *   IsoFile created by iso_tree_add_new_file
04983  *           from a stream created by iso_memory_stream_new(),
04984  *   IsoFile created by iso_tree_add_new_cut_out_node()
04985  * Silently ignored are nodes of type IsoBoot.
04986  * An IsoFile node with IsoStream filters can be cloned if all those filters
04987  * are clonable and the node would be clonable without filter.
04988  * Clonable IsoStream filters are created by:
04989  *   iso_file_add_zisofs_filter()
04990  *   iso_file_add_gzip_filter()
04991  *   iso_file_add_external_filter()
04992  * An IsoNode with extended information as of iso_node_add_xinfo() can only be
04993  * cloned if each of the iso_node_xinfo_func instances is associated to a
04994  * clone function. See iso_node_xinfo_make_clonable().
04995  * All internally used classes of extended information are clonable.
04996  * 
04997  * @param node
04998  *      The node to be cloned.
04999  * @param new_parent
05000  *      The existing directory node where to insert the cloned node.
05001  * @param new_name
05002  *      The name for the cloned node. It must not yet exist in new_parent,
05003  *      unless it is a directory and node is a directory and flag bit0 is set.
05004  * @param new_node
05005  *      Will return a pointer (without reference) to the newly created clone.
05006  * @param flag
05007  *      Bitfield for control purposes. Submit any undefined bits as 0.
05008  *      bit0= Merge directories rather than returning ISO_NODE_NAME_NOT_UNIQUE.
05009  *            This will not allow to overwrite any existing node.
05010  *            Attributes of existing directories will not be overwritten.
05011  * @return
05012  *      <0 means error, 1 = new node created,
05013  *      2 = if flag bit0 is set: new_node is a directory which already existed.
05014  *
05015  * @since 1.0.2
05016  */
05017 int iso_tree_clone(IsoNode *node,
05018                    IsoDir *new_parent, char *new_name, IsoNode **new_node,
05019                    int flag);
05020 
05021 /**
05022  * Add the contents of a dir to a given directory of the iso tree.
05023  *
05024  * There are several options to control what files are added or how they are
05025  * managed. Take a look at iso_tree_set_* functions to see diferent options
05026  * for recursive directory addition.
05027  *
05028  * TODO comment Builder and Filesystem related issues when exposing both
05029  *
05030  * @param image
05031  *      The image to which the directory belongs.
05032  * @param parent
05033  *      Directory on the image tree where to add the contents of the dir
05034  * @param dir
05035  *      Path to a dir in the filesystem
05036  * @return
05037  *     number of nodes in parent if success, < 0 otherwise
05038  *
05039  * @since 0.6.2
05040  */
05041 int iso_tree_add_dir_rec(IsoImage *image, IsoDir *parent, const char *dir);
05042 
05043 /**
05044  * Locate a node by its absolute path on image.
05045  *
05046  * @param image
05047  *     The image to which the node belongs.
05048  * @param node
05049  *     Location for a pointer to the node, it will filled with NULL if the
05050  *     given path does not exists on image.
05051  *     The node will be owned by the image and shouldn't be unref(). Just call
05052  *     iso_node_ref() to get your own reference to the node.
05053  *     Note that you can pass NULL is the only thing you want to do is check
05054  *     if a node with such path really exists.
05055  * @return
05056  *      1 found, 0 not found, < 0 error
05057  *
05058  * @since 0.6.2
05059  */
05060 int iso_tree_path_to_node(IsoImage *image, const char *path, IsoNode **node);
05061 
05062 /**
05063  * Get the absolute path on image of the given node.
05064  *
05065  * @return
05066  *      The path on the image, that must be freed when no more needed. If the
05067  *      given node is not added to any image, this returns NULL.
05068  * @since 0.6.4
05069  */
05070 char *iso_tree_get_node_path(IsoNode *node);
05071 
05072 /**
05073  * Get the destination node of a symbolic link within the IsoImage.
05074  *
05075  * @param img
05076  *      The image wherein to try resolving the link.
05077  * @param sym
05078  *      The symbolic link node which to resolve.
05079  * @param res
05080  *      Will return the found destination node, in case of success.
05081  *      Call iso_node_ref() / iso_node_unref() if you intend to use the node
05082  *      over API calls which might in any event delete it.
05083  * @param depth
05084  *      Prevents endless loops. Submit as 0.
05085  * @param flag
05086  *      Bitfield for control purposes. Submit 0 for now.
05087  * @return
05088  *      1 on success,
05089  *      < 0 on failure, especially ISO_DEEP_SYMLINK and ISO_DEAD_SYMLINK
05090  *
05091  * @since 1.2.4
05092  */
05093 int iso_tree_resolve_symlink(IsoImage *img, IsoSymlink *sym, IsoNode **res,
05094                              int *depth, int flag);
05095 
05096 /* Maximum number link resolution steps before ISO_DEEP_SYMLINK gets
05097  * returned by iso_tree_resolve_symlink().
05098  *
05099  * @since 1.2.4
05100 */
05101 #define LIBISO_MAX_LINK_DEPTH 100
05102 
05103 /**
05104  * Increments the reference counting of the given IsoDataSource.
05105  *
05106  * @since 0.6.2
05107  */
05108 void iso_data_source_ref(IsoDataSource *src);
05109 
05110 /**
05111  * Decrements the reference counting of the given IsoDataSource, freeing it
05112  * if refcount reach 0.
05113  *
05114  * @since 0.6.2
05115  */
05116 void iso_data_source_unref(IsoDataSource *src);
05117 
05118 /**
05119  * Create a new IsoDataSource from a local file. This is suitable for
05120  * accessing regular files or block devices with ISO images.
05121  *
05122  * @param path
05123  *     The absolute path of the file
05124  * @param src
05125  *     Will be filled with the pointer to the newly created data source.
05126  * @return
05127  *    1 on success, < 0 on error.
05128  *
05129  * @since 0.6.2
05130  */
05131 int iso_data_source_new_from_file(const char *path, IsoDataSource **src);
05132 
05133 /**
05134  * Get the status of the buffer used by a burn_source.
05135  *
05136  * @param b
05137  *      A burn_source previously obtained with
05138  *      iso_image_create_burn_source().
05139  * @param size
05140  *      Will be filled with the total size of the buffer, in bytes
05141  * @param free_bytes
05142  *      Will be filled with the bytes currently available in buffer
05143  * @return
05144  *      < 0 error, > 0 state:
05145  *           1="active"    : input and consumption are active
05146  *           2="ending"    : input has ended without error
05147  *           3="failing"   : input had error and ended,
05148  *           5="abandoned" : consumption has ended prematurely
05149  *           6="ended"     : consumption has ended without input error
05150  *           7="aborted"   : consumption has ended after input error
05151  *
05152  * @since 0.6.2
05153  */
05154 int iso_ring_buffer_get_status(struct burn_source *b, size_t *size,
05155                                size_t *free_bytes);
05156 
05157 #define ISO_MSGS_MESSAGE_LEN 4096
05158 
05159 /**
05160  * Control queueing and stderr printing of messages from libisofs.
05161  * Severity may be one of "NEVER", "FATAL", "SORRY", "WARNING", "HINT",
05162  * "NOTE", "UPDATE", "DEBUG", "ALL".
05163  *
05164  * @param queue_severity Gives the minimum limit for messages to be queued.
05165  *                       Default: "NEVER". If you queue messages then you
05166  *                       must consume them by iso_msgs_obtain().
05167  * @param print_severity Does the same for messages to be printed directly
05168  *                       to stderr.
05169  * @param print_id       A text prefix to be printed before the message.
05170  * @return               >0 for success, <=0 for error
05171  *
05172  * @since 0.6.2
05173  */
05174 int iso_set_msgs_severities(char *queue_severity, char *print_severity,
05175                             char *print_id);
05176 
05177 /**
05178  * Obtain the oldest pending libisofs message from the queue which has at
05179  * least the given minimum_severity. This message and any older message of
05180  * lower severity will get discarded from the queue and is then lost forever.
05181  *
05182  * Severity may be one of "NEVER", "FATAL", "SORRY", "WARNING", "HINT",
05183  * "NOTE", "UPDATE", "DEBUG", "ALL". To call with minimum_severity "NEVER"
05184  * will discard the whole queue.
05185  *
05186  * @param minimum_severity
05187  *     Threshhold
05188  * @param error_code
05189  *     Will become a unique error code as listed at the end of this header
05190  * @param imgid
05191  *     Id of the image that was issued the message.
05192  * @param msg_text
05193  *     Must provide at least ISO_MSGS_MESSAGE_LEN bytes.
05194  * @param severity
05195  *     Will become the severity related to the message and should provide at
05196  *     least 80 bytes.
05197  * @return
05198  *     1 if a matching item was found, 0 if not, <0 for severe errors
05199  *
05200  * @since 0.6.2
05201  */
05202 int iso_obtain_msgs(char *minimum_severity, int *error_code, int *imgid,
05203                     char msg_text[], char severity[]);
05204 
05205 
05206 /**
05207  * Submit a message to the libisofs queueing system. It will be queued or
05208  * printed as if it was generated by libisofs itself.
05209  *
05210  * @param error_code
05211  *      The unique error code of your message.
05212  *      Submit 0 if you do not have reserved error codes within the libburnia
05213  *      project.
05214  * @param msg_text
05215  *      Not more than ISO_MSGS_MESSAGE_LEN characters of message text.
05216  * @param os_errno
05217  *      Eventual errno related to the message. Submit 0 if the message is not
05218  *      related to a operating system error.
05219  * @param severity
05220  *      One of "ABORT", "FATAL", "FAILURE", "SORRY", "WARNING", "HINT", "NOTE",
05221  *      "UPDATE", "DEBUG". Defaults to "FATAL".
05222  * @param origin
05223  *      Submit 0 for now.
05224  * @return
05225  *      1 if message was delivered, <=0 if failure
05226  *
05227  * @since 0.6.4
05228  */
05229 int iso_msgs_submit(int error_code, char msg_text[], int os_errno,
05230                     char severity[], int origin);
05231 
05232 
05233 /**
05234  * Convert a severity name into a severity number, which gives the severity
05235  * rank of the name.
05236  *
05237  * @param severity_name
05238  *      A name as with iso_msgs_submit(), e.g. "SORRY".
05239  * @param severity_number
05240  *      The rank number: the higher, the more severe.
05241  * @return
05242  *      >0 success, <=0 failure
05243  *
05244  * @since 0.6.4
05245  */
05246 int iso_text_to_sev(char *severity_name, int *severity_number);
05247 
05248 
05249 /**
05250  * Convert a severity number into a severity name
05251  *
05252  * @param severity_number
05253  *      The rank number: the higher, the more severe.
05254  * @param severity_name
05255  *      A name as with iso_msgs_submit(), e.g. "SORRY".
05256  *
05257  * @since 0.6.4
05258  */
05259 int iso_sev_to_text(int severity_number, char **severity_name);
05260 
05261 
05262 /**
05263  * Get the id of an IsoImage, used for message reporting. This message id,
05264  * retrieved with iso_obtain_msgs(), can be used to distinguish what
05265  * IsoImage has isssued a given message.
05266  *
05267  * @since 0.6.2
05268  */
05269 int iso_image_get_msg_id(IsoImage *image);
05270 
05271 /**
05272  * Get a textual description of a libisofs error.
05273  *
05274  * @since 0.6.2
05275  */
05276 const char *iso_error_to_msg(int errcode);
05277 
05278 /**
05279  * Get the severity of a given error code
05280  * @return
05281  *       0x10000000 -> DEBUG
05282  *       0x20000000 -> UPDATE
05283  *       0x30000000 -> NOTE
05284  *       0x40000000 -> HINT
05285  *       0x50000000 -> WARNING
05286  *       0x60000000 -> SORRY
05287  *       0x64000000 -> MISHAP
05288  *       0x68000000 -> FAILURE
05289  *       0x70000000 -> FATAL
05290  *       0x71000000 -> ABORT
05291  *
05292  * @since 0.6.2
05293  */
05294 int iso_error_get_severity(int e);
05295 
05296 /**
05297  * Get the priority of a given error.
05298  * @return
05299  *      0x00000000 -> ZERO
05300  *      0x10000000 -> LOW
05301  *      0x20000000 -> MEDIUM
05302  *      0x30000000 -> HIGH
05303  *
05304  * @since 0.6.2
05305  */
05306 int iso_error_get_priority(int e);
05307 
05308 /**
05309  * Get the message queue code of a libisofs error.
05310  */
05311 int iso_error_get_code(int e);
05312 
05313 /**
05314  * Set the minimum error severity that causes a libisofs operation to
05315  * be aborted as soon as possible.
05316  *
05317  * @param severity
05318  *      one of "FAILURE", "MISHAP", "SORRY", "WARNING", "HINT", "NOTE".
05319  *      Severities greater or equal than FAILURE always cause program to abort.
05320  *      Severities under NOTE won't never cause function abort.
05321  * @return
05322  *      Previous abort priority on success, < 0 on error.
05323  *
05324  * @since 0.6.2
05325  */
05326 int iso_set_abort_severity(char *severity);
05327 
05328 /**
05329  * Return the messenger object handle used by libisofs. This handle
05330  * may be used by related libraries to  their own compatible
05331  * messenger objects and thus to direct their messages to the libisofs
05332  * message queue. See also: libburn, API function burn_set_messenger().
05333  *
05334  * @return the handle. Do only use with compatible
05335  *
05336  * @since 0.6.2
05337  */
05338 void *iso_get_messenger();
05339 
05340 /**
05341  * Take a ref to the given IsoFileSource.
05342  *
05343  * @since 0.6.2
05344  */
05345 void iso_file_source_ref(IsoFileSource *src);
05346 
05347 /**
05348  * Drop your ref to the given IsoFileSource, eventually freeing the associated
05349  * system resources.
05350  *
05351  * @since 0.6.2
05352  */
05353 void iso_file_source_unref(IsoFileSource *src);
05354 
05355 /*
05356  * this are just helpers to invoque methods in class
05357  */
05358 
05359 /**
05360  * Get the absolute path in the filesystem this file source belongs to.
05361  *
05362  * @return
05363  *     the path of the FileSource inside the filesystem, it should be
05364  *     freed when no more needed.
05365  *
05366  * @since 0.6.2
05367  */
05368 char* iso_file_source_get_path(IsoFileSource *src);
05369 
05370 /**
05371  * Get the name of the file, with the dir component of the path.
05372  *
05373  * @return
05374  *     the name of the file, it should be freed when no more needed.
05375  *
05376  * @since 0.6.2
05377  */
05378 char* iso_file_source_get_name(IsoFileSource *src);
05379 
05380 /**
05381  * Get information about the file.
05382  * @return
05383  *    1 success, < 0 error
05384  *      Error codes:
05385  *         ISO_FILE_ACCESS_DENIED
05386  *         ISO_FILE_BAD_PATH
05387  *         ISO_FILE_DOESNT_EXIST
05388  *         ISO_OUT_OF_MEM
05389  *         ISO_FILE_ERROR
05390  *         ISO_NULL_POINTER
05391  *
05392  * @since 0.6.2
05393  */
05394 int iso_file_source_lstat(IsoFileSource *src, struct stat *info);
05395 
05396 /**
05397  * Check if the process has access to read file contents. Note that this
05398  * is not necessarily related with (l)stat functions. For example, in a
05399  * filesystem implementation to deal with an ISO image, if the user has
05400  * read access to the image it will be able to read all files inside it,
05401  * despite of the particular permission of each file in the RR tree, that
05402  * are what the above functions return.
05403  *
05404  * @return
05405  *     1 if process has read access, < 0 on error
05406  *      Error codes:
05407  *         ISO_FILE_ACCESS_DENIED
05408  *         ISO_FILE_BAD_PATH
05409  *         ISO_FILE_DOESNT_EXIST
05410  *         ISO_OUT_OF_MEM
05411  *         ISO_FILE_ERROR
05412  *         ISO_NULL_POINTER
05413  *
05414  * @since 0.6.2
05415  */
05416 int iso_file_source_access(IsoFileSource *src);
05417 
05418 /**
05419  * Get information about the file. If the file is a symlink, the info
05420  * returned refers to the destination.
05421  *
05422  * @return
05423  *    1 success, < 0 error
05424  *      Error codes:
05425  *         ISO_FILE_ACCESS_DENIED
05426  *         ISO_FILE_BAD_PATH
05427  *         ISO_FILE_DOESNT_EXIST
05428  *         ISO_OUT_OF_MEM
05429  *         ISO_FILE_ERROR
05430  *         ISO_NULL_POINTER
05431  *
05432  * @since 0.6.2
05433  */
05434 int iso_file_source_stat(IsoFileSource *src, struct stat *info);
05435 
05436 /**
05437  * Opens the source.
05438  * @return 1 on success, < 0 on error
05439  *      Error codes:
05440  *         ISO_FILE_ALREADY_OPENED
05441  *         ISO_FILE_ACCESS_DENIED
05442  *         ISO_FILE_BAD_PATH
05443  *         ISO_FILE_DOESNT_EXIST
05444  *         ISO_OUT_OF_MEM
05445  *         ISO_FILE_ERROR
05446  *         ISO_NULL_POINTER
05447  *
05448  * @since 0.6.2
05449  */
05450 int iso_file_source_open(IsoFileSource *src);
05451 
05452 /**
05453  * Close a previuously openned file
05454  * @return 1 on success, < 0 on error
05455  *      Error codes:
05456  *         ISO_FILE_ERROR
05457  *         ISO_NULL_POINTER
05458  *         ISO_FILE_NOT_OPENED
05459  *
05460  * @since 0.6.2
05461  */
05462 int iso_file_source_close(IsoFileSource *src);
05463 
05464 /**
05465  * Attempts to read up to count bytes from the given source into
05466  * the buffer starting at buf.
05467  *
05468  * The file src must be open() before calling this, and close() when no
05469  * more needed. Not valid for dirs. On symlinks it reads the destination
05470  * file.
05471  *
05472  * @param src
05473  *     The given source
05474  * @param buf
05475  *     Pointer to a buffer of at least count bytes where the read data will be
05476  *     stored
05477  * @param count
05478  *     Bytes to read
05479  * @return
05480  *     number of bytes read, 0 if EOF, < 0 on error
05481  *      Error codes:
05482  *         ISO_FILE_ERROR
05483  *         ISO_NULL_POINTER
05484  *         ISO_FILE_NOT_OPENED
05485  *         ISO_WRONG_ARG_VALUE -> if count == 0
05486  *         ISO_FILE_IS_DIR
05487  *         ISO_OUT_OF_MEM
05488  *         ISO_INTERRUPTED
05489  *
05490  * @since 0.6.2
05491  */
05492 int iso_file_source_read(IsoFileSource *src, void *buf, size_t count);
05493 
05494 /**
05495  * Repositions the offset of the given IsoFileSource (must be opened) to the
05496  * given offset according to the value of flag.
05497  *
05498  * @param src
05499  *     The given source
05500  * @param offset
05501  *      in bytes
05502  * @param flag
05503  *      0 The offset is set to offset bytes (SEEK_SET)
05504  *      1 The offset is set to its current location plus offset bytes
05505  *        (SEEK_CUR)
05506  *      2 The offset is set to the size of the file plus offset bytes
05507  *        (SEEK_END).
05508  * @return
05509  *      Absolute offset posistion on the file, or < 0 on error. Cast the
05510  *      returning value to int to get a valid libisofs error.
05511  * @since 0.6.4
05512  */
05513 off_t iso_file_source_lseek(IsoFileSource *src, off_t offset, int flag);
05514 
05515 /**
05516  * Read a directory.
05517  *
05518  * Each call to this function will return a new child, until we reach
05519  * the end of file (i.e, no more children), in that case it returns 0.
05520  *
05521  * The dir must be open() before calling this, and close() when no more
05522  * needed. Only valid for dirs.
05523  *
05524  * Note that "." and ".." children MUST NOT BE returned.
05525  *
05526  * @param src
05527  *     The given source
05528  * @param child
05529  *     pointer to be filled with the given child. Undefined on error or OEF
05530  * @return
05531  *     1 on success, 0 if EOF (no more children), < 0 on error
05532  *      Error codes:
05533  *         ISO_FILE_ERROR
05534  *         ISO_NULL_POINTER
05535  *         ISO_FILE_NOT_OPENED
05536  *         ISO_FILE_IS_NOT_DIR
05537  *         ISO_OUT_OF_MEM
05538  *
05539  * @since 0.6.2
05540  */
05541 int iso_file_source_readdir(IsoFileSource *src, IsoFileSource **child);
05542 
05543 /**
05544  * Read the destination of a symlink. You don't need to open the file
05545  * to call this.
05546  *
05547  * @param src
05548  *     An IsoFileSource corresponding to a symbolic link.
05549  * @param buf
05550  *     Allocated buffer of at least bufsiz bytes.
05551  *     The destination string will be copied there, and it will be 0-terminated
05552  *     if the return value indicates success or ISO_RR_PATH_TOO_LONG.
05553  * @param bufsiz
05554  *     Maximum number of buf characters + 1. The string will be truncated if
05555  *     it is larger than bufsiz - 1 and ISO_RR_PATH_TOO_LONG. will be returned.
05556  * @return
05557  *     1 on success, < 0 on error
05558  *      Error codes:
05559  *         ISO_FILE_ERROR
05560  *         ISO_NULL_POINTER
05561  *         ISO_WRONG_ARG_VALUE -> if bufsiz <= 0
05562  *         ISO_FILE_IS_NOT_SYMLINK
05563  *         ISO_OUT_OF_MEM
05564  *         ISO_FILE_BAD_PATH
05565  *         ISO_FILE_DOESNT_EXIST
05566  *         ISO_RR_PATH_TOO_LONG (@since 1.0.6)
05567  *
05568  * @since 0.6.2
05569  */
05570 int iso_file_source_readlink(IsoFileSource *src, char *buf, size_t bufsiz);
05571 
05572 
05573 /**
05574  * Get the AAIP string with encoded ACL and xattr.
05575  * (Not to be confused with ECMA-119 Extended Attributes).
05576  * @param src        The file source object to be inquired.
05577  * @param aa_string  Returns a pointer to the AAIP string data. If no AAIP
05578  *                   string is available, *aa_string becomes NULL.
05579  *                   (See doc/susp_aaip_2_0.txt for the meaning of AAIP.) 
05580  *                   The caller is responsible for finally calling free()
05581  *                   on non-NULL results.
05582  * @param flag       Bitfield for control purposes
05583  *                   bit0= Transfer ownership of AAIP string data.
05584  *                         src will free the eventual cached data and might
05585  *                         not be able to produce it again.
05586  *                   bit1= No need to get ACL (but no guarantee of exclusion)
05587  *                   bit2= No need to get xattr (but no guarantee of exclusion)
05588  * @return           1 means success (*aa_string == NULL is possible)
05589  *                  <0 means failure and must b a valid libisofs error code
05590  *                     (e.g. ISO_FILE_ERROR if no better one can be found).
05591  * @since 0.6.14
05592  */
05593 int iso_file_source_get_aa_string(IsoFileSource *src,
05594                                   unsigned char **aa_string, int flag);
05595 
05596 /**
05597  * Get the filesystem for this source. No extra ref is added, so you
05598  * musn't unref the IsoFilesystem.
05599  *
05600  * @return
05601  *     The filesystem, NULL on error
05602  *
05603  * @since 0.6.2
05604  */
05605 IsoFilesystem* iso_file_source_get_filesystem(IsoFileSource *src);
05606 
05607 /**
05608  * Take a ref to the given IsoFilesystem
05609  *
05610  * @since 0.6.2
05611  */
05612 void iso_filesystem_ref(IsoFilesystem *fs);
05613 
05614 /**
05615  * Drop your ref to the given IsoFilesystem, evetually freeing associated
05616  * resources.
05617  *
05618  * @since 0.6.2
05619  */
05620 void iso_filesystem_unref(IsoFilesystem *fs);
05621 
05622 /**
05623  * Create a new IsoFilesystem to access a existent ISO image.
05624  *
05625  * @param src
05626  *      Data source to access data.
05627  * @param opts
05628  *      Image read options
05629  * @param msgid
05630  *      An image identifer, obtained with iso_image_get_msg_id(), used to
05631  *      associated messages issued by the filesystem implementation with an
05632  *      existent image. If you are not using this filesystem in relation with
05633  *      any image context, just use 0x1fffff as the value for this parameter.
05634  * @param fs
05635  *      Will be filled with a pointer to the filesystem that can be used
05636  *      to access image contents.
05637  * @param
05638  *      1 on success, < 0 on error
05639  *
05640  * @since 0.6.2
05641  */
05642 int iso_image_filesystem_new(IsoDataSource *src, IsoReadOpts *opts, int msgid,
05643                              IsoImageFilesystem **fs);
05644 
05645 /**
05646  * Get the volset identifier for an existent image. The returned string belong
05647  * to the IsoImageFilesystem and shouldn't be free() nor modified.
05648  *
05649  * @since 0.6.2
05650  */
05651 const char *iso_image_fs_get_volset_id(IsoImageFilesystem *fs);
05652 
05653 /**
05654  * Get the volume identifier for an existent image. The returned string belong
05655  * to the IsoImageFilesystem and shouldn't be free() nor modified.
05656  *
05657  * @since 0.6.2
05658  */
05659 const char *iso_image_fs_get_volume_id(IsoImageFilesystem *fs);
05660 
05661 /**
05662  * Get the publisher identifier for an existent image. The returned string
05663  * belong to the IsoImageFilesystem and shouldn't be free() nor modified.
05664  *
05665  * @since 0.6.2
05666  */
05667 const char *iso_image_fs_get_publisher_id(IsoImageFilesystem *fs);
05668 
05669 /**
05670  * Get the data preparer identifier for an existent image. The returned string
05671  * belong to the IsoImageFilesystem and shouldn't be free() nor modified.
05672  *
05673  * @since 0.6.2
05674  */
05675 const char *iso_image_fs_get_data_preparer_id(IsoImageFilesystem *fs);
05676 
05677 /**
05678  * Get the system identifier for an existent image. The returned string belong
05679  * to the IsoImageFilesystem and shouldn't be free() nor modified.
05680  *
05681  * @since 0.6.2
05682  */
05683 const char *iso_image_fs_get_system_id(IsoImageFilesystem *fs);
05684 
05685 /**
05686  * Get the application identifier for an existent image. The returned string
05687  * belong to the IsoImageFilesystem and shouldn't be free() nor modified.
05688  *
05689  * @since 0.6.2
05690  */
05691 const char *iso_image_fs_get_application_id(IsoImageFilesystem *fs);
05692 
05693 /**
05694  * Get the copyright file identifier for an existent image. The returned string
05695  * belong to the IsoImageFilesystem and shouldn't be free() nor modified.
05696  *
05697  * @since 0.6.2
05698  */
05699 const char *iso_image_fs_get_copyright_file_id(IsoImageFilesystem *fs);
05700 
05701 /**
05702  * Get the abstract file identifier for an existent image. The returned string
05703  * belong to the IsoImageFilesystem and shouldn't be free() nor modified.
05704  *
05705  * @since 0.6.2
05706  */
05707 const char *iso_image_fs_get_abstract_file_id(IsoImageFilesystem *fs);
05708 
05709 /**
05710  * Get the biblio file identifier for an existent image. The returned string
05711  * belong to the IsoImageFilesystem and shouldn't be free() nor modified.
05712  *
05713  * @since 0.6.2
05714  */
05715 const char *iso_image_fs_get_biblio_file_id(IsoImageFilesystem *fs);
05716 
05717 /**
05718  * Increment reference count of an IsoStream.
05719  *
05720  * @since 0.6.4
05721  */
05722 void iso_stream_ref(IsoStream *stream);
05723 
05724 /**
05725  * Decrement reference count of an IsoStream, and eventually free it if
05726  * refcount reach 0.
05727  *
05728  * @since 0.6.4
05729  */
05730 void iso_stream_unref(IsoStream *stream);
05731 
05732 /**
05733  * Opens the given stream. Remember to close the Stream before writing the
05734  * image.
05735  *
05736  * @return
05737  *     1 on success, 2 file greater than expected, 3 file smaller than
05738  *     expected, < 0 on error
05739  *
05740  * @since 0.6.4
05741  */
05742 int iso_stream_open(IsoStream *stream);
05743 
05744 /**
05745  * Close a previously openned IsoStream.
05746  *
05747  * @return
05748  *      1 on success, < 0 on error
05749  *
05750  * @since 0.6.4
05751  */
05752 int iso_stream_close(IsoStream *stream);
05753 
05754 /**
05755  * Get the size of a given stream. This function should always return the same
05756  * size, even if the underlying source size changes, unless you call
05757  * iso_stream_update_size().
05758  *
05759  * @return
05760  *      IsoStream size in bytes
05761  *
05762  * @since 0.6.4
05763  */
05764 off_t iso_stream_get_size(IsoStream *stream);
05765 
05766 /**
05767  * Attempts to read up to count bytes from the given stream into
05768  * the buffer starting at buf.
05769  *
05770  * The stream must be open() before calling this, and close() when no
05771  * more needed.
05772  *
05773  * @return
05774  *     number of bytes read, 0 if EOF, < 0 on error
05775  *
05776  * @since 0.6.4
05777  */
05778 int iso_stream_read(IsoStream *stream, void *buf, size_t count);
05779 
05780 /**
05781  * Whether the given IsoStream can be read several times, with the same
05782  * results.
05783  * For example, a regular file is repeatable, you can read it as many
05784  * times as you want. However, a pipe isn't.
05785  *
05786  * This function doesn't take into account if the file has been modified
05787  * between the two reads.
05788  *
05789  * @return
05790  *     1 if stream is repeatable, 0 if not, < 0 on error
05791  *
05792  * @since 0.6.4
05793  */
05794 int iso_stream_is_repeatable(IsoStream *stream);
05795 
05796 /**
05797  * Updates the size of the IsoStream with the current size of the
05798  * underlying source.
05799  *
05800  * @return
05801  *     1 if ok, < 0 on error (has to be a valid libisofs error code),
05802  *     0 if the IsoStream does not support this function.
05803  * @since 0.6.8
05804  */
05805 int iso_stream_update_size(IsoStream *stream);
05806 
05807 /**
05808  * Get an unique identifier for a given IsoStream.
05809  *
05810  * @since 0.6.4
05811  */
05812 void iso_stream_get_id(IsoStream *stream, unsigned int *fs_id, dev_t *dev_id,
05813                       ino_t *ino_id);
05814 
05815 /**
05816  * Try to get eventual source path string of a stream. Meaning and availability
05817  * of this string depends on the stream.class . Expect valid results with
05818  * types "fsrc" and "cout". Result formats are
05819  * fsrc: result of file_source_get_path()
05820  * cout: result of file_source_get_path() " " offset " " size 
05821  * @param stream
05822  *     The stream to be inquired.
05823  * @param flag
05824  *     Bitfield for control purposes, unused yet, submit 0
05825  * @return
05826  *     A copy of the path string. Apply free() when no longer needed.
05827  *     NULL if no path string is available.
05828  *
05829  * @since 0.6.18
05830  */
05831 char *iso_stream_get_source_path(IsoStream *stream, int flag);
05832 
05833 /**
05834  * Compare two streams whether they are based on the same input and will
05835  * produce the same output. If in any doubt, then this comparison will
05836  * indicate no match.
05837  *
05838  * @param s1
05839  *     The first stream to compare.
05840  * @param s2
05841  *     The second stream to compare.
05842  * @return
05843  *     -1 if s1 is smaller s2 , 0 if s1 matches s2 , 1 if s1 is larger s2
05844  * @param flag
05845  *     bit0= do not use s1->class->compare() even if available
05846  *           (e.g. because iso_stream_cmp_ino(0 is called as fallback
05847  *            from said stream->class->compare())
05848  *
05849  * @since 0.6.20
05850  */
05851 int iso_stream_cmp_ino(IsoStream *s1, IsoStream *s2, int flag);
05852 
05853 
05854 /**
05855  * Produce a copy of a stream. It must be possible to operate both stream
05856  * objects concurrently. The success of this function depends on the
05857  * existence of a IsoStream_Iface.clone_stream() method with the stream
05858  * and with its eventual subordinate streams. 
05859  * See iso_tree_clone() for a list of surely clonable built-in streams.
05860  * 
05861  * @param old_stream
05862  *     The existing stream object to be copied
05863  * @param new_stream
05864  *     Will return a pointer to the copy
05865  * @param flag
05866  *     Bitfield for control purposes. Submit 0 for now.
05867  * @return
05868  *     >0 means success
05869  *     ISO_STREAM_NO_CLONE is issued if no .clone_stream() exists
05870  *     other error return values < 0 may occur depending on kind of stream
05871  *
05872  * @since 1.0.2
05873  */
05874 int iso_stream_clone(IsoStream *old_stream, IsoStream **new_stream, int flag);
05875 
05876 
05877 /* --------------------------------- AAIP --------------------------------- */
05878 
05879 /**
05880  * Function to identify and manage AAIP strings as xinfo of IsoNode.
05881  *
05882  * An AAIP string contains the Attribute List with the xattr and ACL of a node
05883  * in the image tree. It is formatted according to libisofs specification
05884  * AAIP-2.0 and ready to be written into the System Use Area resp. Continuation
05885  * Area of a directory entry in an ISO image.
05886  *
05887  * Applications are not supposed to manipulate AAIP strings directly.
05888  * They should rather make use of the appropriate iso_node_get_* and
05889  * iso_node_set_* calls.
05890  *
05891  * AAIP represents ACLs as xattr with empty name and AAIP-specific binary
05892  * content. Local filesystems may represent ACLs as xattr with names like
05893  * "system.posix_acl_access". libisofs does not interpret those local
05894  * xattr representations of ACL directly but rather uses the ACL interface of
05895  * the local system. By default the local xattr representations of ACL will
05896  * not become part of the AAIP Attribute List via iso_local_get_attrs() and
05897  * not be attached to local files via iso_local_set_attrs().
05898  *
05899  * @since 0.6.14
05900  */
05901 int aaip_xinfo_func(void *data, int flag);
05902 
05903 /**
05904  * The iso_node_xinfo_cloner function which gets associated to aaip_xinfo_func
05905  * by iso_init() resp. iso_init_with_flag() via iso_node_xinfo_make_clonable().
05906  * @since 1.0.2
05907  */
05908 int aaip_xinfo_cloner(void *old_data, void **new_data, int flag);
05909 
05910 /**
05911  * Get the eventual ACLs which are associated with the node.
05912  * The result will be in "long" text form as of man acl resp. acl_to_text().
05913  * Call this function with flag bit15 to finally release the memory
05914  * occupied by an ACL inquiry.
05915  *
05916  * @param node
05917  *      The node that is to be inquired.
05918  * @param access_text
05919  *      Will return a pointer to the eventual "access" ACL text or NULL if it
05920  *      is not available and flag bit 4 is set.
05921  * @param default_text
05922  *      Will return a pointer to the eventual "default" ACL  or NULL if it
05923  *      is not available.
05924  *      (GNU/Linux directories can have a "default" ACL which influences
05925  *       the permissions of newly created files.)
05926  * @param flag
05927  *      Bitfield for control purposes
05928  *      bit4=  if no "access" ACL is available: return *access_text == NULL
05929  *             else:                       produce ACL from stat(2) permissions
05930  *      bit15= free memory and return 1 (node may be NULL)
05931  * @return
05932  *      2 *access_text was produced from stat(2) permissions
05933  *      1 *access_text was produced from ACL of node
05934  *      0 if flag bit4 is set and no ACL is available
05935  *      < 0 on error
05936  *
05937  * @since 0.6.14
05938  */
05939 int iso_node_get_acl_text(IsoNode *node,
05940                           char **access_text, char **default_text, int flag);
05941 
05942 
05943 /**
05944  * Set the ACLs of the given node to the lists in parameters access_text and
05945  * default_text or delete them.
05946  *
05947  * The stat(2) permission bits get updated according to the new "access" ACL if
05948  * neither bit1 of parameter flag is set nor parameter access_text is NULL.
05949  * Note that S_IRWXG permission bits correspond to ACL mask permissions
05950  * if a "mask::" entry exists in the ACL. Only if there is no "mask::" then
05951  * the "group::" entry corresponds to to S_IRWXG.
05952  * 
05953  * @param node
05954  *      The node that is to be manipulated.
05955  * @param access_text
05956  *      The text to be set into effect as "access" ACL. NULL will delete an
05957  *      eventually existing "access" ACL of the node.
05958  * @param default_text
05959  *      The text to be set into effect as "default" ACL. NULL will delete an
05960  *      eventually existing "default" ACL of the node.
05961  *      (GNU/Linux directories can have a "default" ACL which influences
05962  *       the permissions of newly created files.)
05963  * @param flag
05964  *      Bitfield for control purposes
05965  *      bit1=  ignore text parameters but rather update eventual "access" ACL
05966  *             to the stat(2) permissions of node. If no "access" ACL exists,
05967  *             then do nothing and return success.
05968  * @return
05969  *      > 0 success
05970  *      < 0 failure
05971  *
05972  * @since 0.6.14
05973  */
05974 int iso_node_set_acl_text(IsoNode *node,
05975                           char *access_text, char *default_text, int flag);
05976 
05977 /**
05978  * Like iso_node_get_permissions but reflecting ACL entry "group::" in S_IRWXG
05979  * rather than ACL entry "mask::". This is necessary if the permissions of a
05980  * node with ACL shall be restored to a filesystem without restoring the ACL.
05981  * The same mapping happens internally when the ACL of a node is deleted.
05982  * If the node has no ACL then the result is iso_node_get_permissions(node).
05983  * @param node
05984  *      The node that is to be inquired.
05985  * @return
05986  *      Permission bits as of stat(2)
05987  *
05988  * @since 0.6.14
05989  */
05990 mode_t iso_node_get_perms_wo_acl(const IsoNode *node);
05991 
05992 
05993 /**
05994  * Get the list of xattr which is associated with the node.
05995  * The resulting data may finally be disposed by a call to this function
05996  * with flag bit15 set, or its components may be freed one-by-one.
05997  * The following values are either NULL or malloc() memory:
05998  *   *names, *value_lengths, *values, (*names)[i], (*values)[i] 
05999  * with 0 <= i < *num_attrs.
06000  * It is allowed to replace or reallocate those memory items in order to
06001  * to manipulate the attribute list before submitting it to other calls.
06002  *
06003  * If enabled by flag bit0, this list possibly includes the ACLs of the node.
06004  * They are eventually encoded in a pair with empty name. It is not advisable
06005  * to alter the value or name of that pair. One may decide to erase both ACLs
06006  * by deleting this pair or to copy both ACLs by copying the content of this
06007  * pair to an empty named pair of another node.
06008  * For all other ACL purposes use iso_node_get_acl_text().
06009  *
06010  * @param node
06011  *      The node that is to be inquired.
06012  * @param num_attrs
06013  *      Will return the number of name-value pairs
06014  * @param names
06015  *      Will return an array of pointers to 0-terminated names
06016  * @param value_lengths
06017  *      Will return an arry with the lenghts of values
06018  * @param values
06019  *      Will return an array of pointers to strings of 8-bit bytes
06020  * @param flag
06021  *      Bitfield for control purposes
06022  *      bit0=  obtain eventual ACLs as attribute with empty name
06023  *      bit2=  with bit0: do not obtain attributes other than ACLs
06024  *      bit15= free memory (node may be NULL)
06025  * @return
06026  *      1 = ok (but *num_attrs may be 0)
06027  *    < 0 = error
06028  *
06029  * @since 0.6.14
06030  */
06031 int iso_node_get_attrs(IsoNode *node, size_t *num_attrs,
06032               char ***names, size_t **value_lengths, char ***values, int flag);
06033 
06034 
06035 /**
06036  * Obtain the value of a particular xattr name. Eventually make a copy of
06037  * that value and add a trailing 0 byte for caller convenience.
06038  * @param node
06039  *      The node that is to be inquired.
06040  * @param name
06041  *      The xattr name that shall be looked up.
06042  * @param value_length
06043  *      Will return the lenght of value
06044  * @param value
06045  *      Will return a string of 8-bit bytes. free() it when no longer needed.
06046  * @param flag
06047  *      Bitfield for control purposes, unused yet, submit 0
06048  * @return
06049  *      1= name found , 0= name not found , <0 indicates error
06050  *
06051  * @since 0.6.18
06052  */
06053 int iso_node_lookup_attr(IsoNode *node, char *name,
06054                          size_t *value_length, char **value, int flag);
06055 
06056 /**
06057  * Set the list of xattr which is associated with the node.
06058  * The data get copied so that you may dispose your input data afterwards.
06059  *
06060  * If enabled by flag bit0 then the submitted list of attributes will not only
06061  * overwrite xattr but also both eventual ACLs of the node. Eventual ACL in
06062  * the submitted list have to reside in an attribute with empty name.
06063  *
06064  * @param node
06065  *      The node that is to be manipulated.
06066  * @param num_attrs
06067  *      Number of attributes
06068  * @param names
06069  *      Array of pointers to 0 terminated name strings
06070  * @param value_lengths
06071  *      Array of byte lengths for each value
06072  * @param values
06073  *      Array of pointers to the value bytes
06074  * @param flag
06075  *      Bitfield for control purposes
06076  *      bit0= Do not maintain eventual existing ACL of the node.
06077  *            Set eventual new ACL from value of empty name.
06078  *      bit1= Do not clear the existing attribute list but merge it with
06079  *            the list given by this call.
06080  *            The given values override the values of their eventually existing
06081  *            names. If no xattr with a given name exists, then it will be
06082  *            added as new xattr. So this bit can be used to set a single
06083  *            xattr without inquiring any other xattr of the node.
06084  *      bit2= Delete the attributes with the given names
06085  *      bit3= Allow to affect non-user attributes.
06086  *            I.e. those with a non-empty name which does not begin by "user."
06087  *            (The empty name is always allowed and governed by bit0.) This
06088  *            deletes all previously existing attributes if not bit1 is set.
06089  *      bit4= Do not affect attributes from namespace "isofs".
06090  *            To be combined with bit3 for copying attributes from local
06091  *            filesystem to ISO image.
06092  *            @since 1.2.4
06093  * @return
06094  *      1 = ok
06095  *    < 0 = error
06096  *
06097  * @since 0.6.14
06098  */
06099 int iso_node_set_attrs(IsoNode *node, size_t num_attrs, char **names,
06100                        size_t *value_lengths, char **values, int flag);
06101 
06102 
06103 /* ----- This is an interface to ACL and xattr of the local filesystem ----- */
06104 
06105 /**
06106  * libisofs has an internal system dependent adapter to ACL and xattr
06107  * operations. For the sake of completeness and simplicity it exposes this
06108  * functionality to its applications which might want to get and set ACLs
06109  * from local files.
06110  */
06111 
06112 /**
06113  * Inquire whether local filesystem operations with ACL or xattr are enabled
06114  * inside libisofs. They may be disabled because of compile time decisions.
06115  * E.g. because the operating system does not support these features or
06116  * because libisofs has not yet an adapter to use them.
06117  * 
06118  * @param flag
06119  *      Bitfield for control purposes
06120  *           bit0= inquire availability of ACL
06121  *           bit1= inquire availability of xattr
06122  *           bit2 - bit7= Reserved for future types.
06123  *                        It is permissibile to set them to 1 already now.
06124  *           bit8 and higher: reserved, submit 0
06125  * @return
06126  *      Bitfield corresponding to flag. If bits are set, th
06127  *           bit0= ACL adapter is enabled
06128  *           bit1= xattr adapter is enabled
06129  *           bit2 - bit7= Reserved for future types.
06130  *           bit8 and higher: reserved, do not interpret these
06131  *
06132  * @since 1.1.6
06133  */
06134 int iso_local_attr_support(int flag);
06135 
06136 /**
06137  * Get an ACL of the given file in the local filesystem in long text form.
06138  *
06139  * @param disk_path
06140  *      Absolute path to the file
06141  * @param text
06142  *      Will return a pointer to the ACL text. If not NULL the text will be
06143  *      0 terminated and finally has to be disposed by a call to this function
06144  *      with bit15 set.
06145  * @param flag
06146  *      Bitfield for control purposes
06147  *           bit0=  get "default" ACL rather than "access" ACL
06148  *           bit4=  set *text = NULL and return 2
06149  *                  if the ACL matches st_mode permissions.
06150  *           bit5=  in case of symbolic link: inquire link target
06151  *           bit15= free text and return 1
06152  * @return
06153  *        1 ok 
06154  *        2 ok, trivial ACL found while bit4 is set, *text is NULL 
06155  *        0 no ACL manipulation adapter available / ACL not supported on fs
06156  *       -1 failure of system ACL service (see errno)
06157  *       -2 attempt to inquire ACL of a symbolic link without bit4 or bit5
06158  *          resp. with no suitable link target
06159  *
06160  * @since 0.6.14
06161  */
06162 int iso_local_get_acl_text(char *disk_path, char **text, int flag);
06163 
06164 
06165 /**
06166  * Set the ACL of the given file in the local filesystem to a given list
06167  * in long text form.
06168  *
06169  * @param disk_path
06170  *      Absolute path to the file
06171  * @param text
06172  *      The input text (0 terminated, ACL long text form)
06173  * @param flag
06174  *      Bitfield for control purposes
06175  *           bit0=  set "default" ACL rather than "access" ACL
06176  *           bit5=  in case of symbolic link: manipulate link target
06177  * @return
06178  *      > 0 ok
06179  *        0 no ACL manipulation adapter available for desired ACL type
06180  *       -1 failure of system ACL service (see errno)
06181  *       -2 attempt to manipulate ACL of a symbolic link without bit5
06182  *          resp. with no suitable link target
06183  *
06184  * @since 0.6.14
06185  */
06186 int iso_local_set_acl_text(char *disk_path, char *text, int flag);
06187 
06188 
06189 /**
06190  * Obtain permissions of a file in the local filesystem which shall reflect
06191  * ACL entry "group::" in S_IRWXG rather than ACL entry "mask::". This is
06192  * necessary if the permissions of a disk file with ACL shall be copied to
06193  * an object which has no ACL.
06194  * @param disk_path
06195  *      Absolute path to the local file which may have an "access" ACL or not.
06196  * @param flag
06197  *      Bitfield for control purposes
06198  *           bit5=  in case of symbolic link: inquire link target
06199  * @param st_mode
06200  *      Returns permission bits as of stat(2)
06201  * @return
06202  *      1 success
06203  *     -1 failure of lstat() resp. stat() (see errno)
06204  *
06205  * @since 0.6.14
06206  */
06207 int iso_local_get_perms_wo_acl(char *disk_path, mode_t *st_mode, int flag);
06208 
06209 
06210 /**
06211  * Get xattr and non-trivial ACLs of the given file in the local filesystem.
06212  * The resulting data has finally to be disposed by a call to this function
06213  * with flag bit15 set.
06214  *
06215  * Eventual ACLs will get encoded as attribute pair with empty name if this is
06216  * enabled by flag bit0. An ACL which simply replects stat(2) permissions
06217  * will not be put into the result.
06218  *
06219  * @param disk_path
06220  *      Absolute path to the file
06221  * @param num_attrs
06222  *      Will return the number of name-value pairs
06223  * @param names
06224  *      Will return an array of pointers to 0-terminated names
06225  * @param value_lengths
06226  *      Will return an arry with the lenghts of values
06227  * @param values
06228  *      Will return an array of pointers to 8-bit values
06229  * @param flag
06230  *      Bitfield for control purposes
06231  *      bit0=  obtain eventual ACLs as attribute with empty name
06232  *      bit2=  do not obtain attributes other than ACLs
06233  *      bit3=  do not ignore eventual non-user attributes.
06234  *             I.e. those with a name which does not begin by "user."
06235  *      bit5=  in case of symbolic link: inquire link target
06236  *      bit15= free memory
06237  * @return
06238  *        1 ok
06239  *      < 0 failure
06240  *
06241  * @since 0.6.14
06242  */
06243 int iso_local_get_attrs(char *disk_path, size_t *num_attrs, char ***names,
06244                         size_t **value_lengths, char ***values, int flag);
06245 
06246 
06247 /**
06248  * Attach a list of xattr and ACLs to the given file in the local filesystem.
06249  *
06250  * Eventual ACLs have to be encoded as attribute pair with empty name.
06251  *
06252  * @param disk_path
06253  *      Absolute path to the file
06254  * @param num_attrs
06255  *      Number of attributes
06256  * @param names
06257  *      Array of pointers to 0 terminated name strings
06258  * @param value_lengths
06259  *      Array of byte lengths for each attribute payload
06260  * @param values
06261  *      Array of pointers to the attribute payload bytes
06262  * @param flag
06263  *      Bitfield for control purposes
06264  *      bit0=  do not attach ACLs from an eventual attribute with empty name
06265  *      bit3=  do not ignore eventual non-user attributes.
06266  *             I.e. those with a name which does not begin by "user."
06267  *      bit5=  in case of symbolic link: manipulate link target
06268  *      bit6=  @since 1.1.6
06269                tolerate inappropriate presence or absence of
06270  *             directory "default" ACL
06271  * @return
06272  *      1 = ok 
06273  *    < 0 = error
06274  *
06275  * @since 0.6.14
06276  */
06277 int iso_local_set_attrs(char *disk_path, size_t num_attrs, char **names,
06278                         size_t *value_lengths, char **values, int flag);
06279 
06280 
06281 /* Default in case that the compile environment has no macro PATH_MAX.
06282 */
06283 #define Libisofs_default_path_maX 4096
06284 
06285 
06286 /* --------------------------- Filters in General -------------------------- */
06287 
06288 /*
06289  * A filter is an IsoStream which uses another IsoStream as input. It gets
06290  * attached to an IsoFile by specialized calls iso_file_add_*_filter() which
06291  * replace its current IsoStream by the filter stream which takes over the
06292  * current IsoStream as input.
06293  * The consequences are:
06294  *   iso_file_get_stream() will return the filter stream.
06295  *   iso_stream_get_size() will return the (cached) size of the filtered data,
06296  *   iso_stream_open()     will start eventual child processes,
06297  *   iso_stream_close()    will kill eventual child processes,
06298  *   iso_stream_read()     will return filtered data. E.g. as data file content
06299  *                         during ISO image generation.
06300  *
06301  * There are external filters which run child processes
06302  *   iso_file_add_external_filter()
06303  * and internal filters
06304  *   iso_file_add_zisofs_filter()
06305  *   iso_file_add_gzip_filter()
06306  * which may or may not be available depending on compile time settings and
06307  * installed software packages like libz.
06308  *
06309  * During image generation filters get not in effect if the original IsoStream
06310  * is an "fsrc" stream based on a file in the loaded ISO image and if the
06311  * image generation type is set to 1 by iso_write_opts_set_appendable().
06312  */
06313 
06314 /**
06315  * Delete the top filter stream from a data file. This is the most recent one
06316  * which was added by iso_file_add_*_filter().
06317  * Caution: One should not do this while the IsoStream of the file is opened.
06318  *          For now there is no general way to determine this state.
06319  *          Filter stream implementations are urged to eventually call .close()
06320  *          inside method .free() . This will close the input stream too.
06321  * @param file
06322  *      The data file node which shall get rid of one layer of content
06323  *      filtering.
06324  * @param flag
06325  *      Bitfield for control purposes, unused yet, submit 0.
06326  * @return
06327  *      1 on success, 0 if no filter was present
06328  *      <0 on error
06329  *
06330  * @since 0.6.18
06331  */
06332 int iso_file_remove_filter(IsoFile *file, int flag);
06333 
06334 /**
06335  * Obtain the eventual input stream of a filter stream.
06336  * @param stream
06337  *      The eventual filter stream to be inquired.
06338  * @param flag
06339  *      Bitfield for control purposes. Submit 0 for now.
06340  * @return
06341  *      The input stream, if one exists. Elsewise NULL.
06342  *      No extra reference to the stream is taken by this call.
06343  * 
06344  * @since 0.6.18
06345  */    
06346 IsoStream *iso_stream_get_input_stream(IsoStream *stream, int flag);
06347 
06348 
06349 /* ---------------------------- External Filters --------------------------- */
06350 
06351 /**
06352  * Representation of an external program that shall serve as filter for
06353  * an IsoStream. This object may be shared among many IsoStream objects.
06354  * It is to be created and disposed by the application.
06355  *
06356  * The filter will act as proxy between the original IsoStream of an IsoFile.
06357  * Up to completed image generation it will be run at least twice: 
06358  * for IsoStream.class.get_size() and for .open() with subsequent .read().
06359  * So the original IsoStream has to return 1 by its .class.is_repeatable().
06360  * The filter program has to be repeateable too. I.e. it must produce the same
06361  * output on the same input.
06362  *
06363  * @since 0.6.18
06364  */
06365 struct iso_external_filter_command
06366 {
06367     /* Will indicate future extensions. It has to be 0 for now. */
06368     int version;
06369 
06370     /* Tells how many IsoStream objects depend on this command object.
06371      * One may only dispose an IsoExternalFilterCommand when this count is 0.
06372      * Initially this value has to be 0.
06373      */
06374     int refcount;
06375 
06376     /* An optional instance id.
06377      * Set to empty text if no individual name for this object is intended.
06378      */
06379     char *name;
06380 
06381     /* Absolute local filesystem path to the executable program. */
06382     char *path;
06383 
06384     /* Tells the number of arguments. */
06385     int argc;
06386 
06387     /* NULL terminated list suitable for system call execv(3).
06388      * I.e. argv[0] points to the alleged program name,
06389      *      argv[1] to argv[argc] point to program arguments (if argc > 0)
06390      *      argv[argc+1] is NULL
06391      */
06392     char **argv;
06393 
06394     /* A bit field which controls behavior variations:
06395      * bit0= Do not install filter if the input has size 0.
06396      * bit1= Do not install filter if the output is not smaller than the input.
06397      * bit2= Do not install filter if the number of output blocks is
06398      *       not smaller than the number of input blocks. Block size is 2048.
06399      *       Assume that non-empty input yields non-empty output and thus do
06400      *       not attempt to attach a filter to files smaller than 2049 bytes.
06401      * bit3= suffix removed rather than added.
06402      *       (Removal and adding suffixes is the task of the application.
06403      *        This behavior bit serves only as reminder for the application.)
06404      */
06405     int behavior;
06406 
06407     /* The eventual suffix which is supposed to be added to the IsoFile name
06408      * resp. to be removed from the name.
06409      * (This is to be done by the application, not by calls
06410      *  iso_file_add_external_filter() or iso_file_remove_filter().
06411      *  The value recorded here serves only as reminder for the application.)
06412      */
06413     char *suffix;
06414 };
06415 
06416 typedef struct iso_external_filter_command IsoExternalFilterCommand;
06417 
06418 /**
06419  * Install an external filter command on top of the content stream of a data
06420  * file. The filter process must be repeatable. It will be run once by this
06421  * call in order to cache the output size.
06422  * @param file
06423  *      The data file node which shall show filtered content.
06424  * @param cmd
06425  *      The external program and its arguments which shall do the filtering.
06426  * @param flag
06427  *      Bitfield for control purposes, unused yet, submit 0.
06428  * @return
06429  *      1 on success, 2 if filter installation revoked (e.g. cmd.behavior bit1)
06430  *      <0 on error
06431  *
06432  * @since 0.6.18
06433  */
06434 int iso_file_add_external_filter(IsoFile *file, IsoExternalFilterCommand *cmd,
06435                                  int flag);
06436 
06437 /**
06438  * Obtain the IsoExternalFilterCommand which is eventually associated with the
06439  * given stream. (Typically obtained from an IsoFile by iso_file_get_stream()
06440  * or from an IsoStream by iso_stream_get_input_stream()).
06441  * @param stream
06442  *      The stream to be inquired.
06443  * @param cmd
06444  *      Will return the external IsoExternalFilterCommand. Valid only if
06445  *      the call returns 1. This does not increment cmd->refcount.
06446  * @param flag
06447  *      Bitfield for control purposes, unused yet, submit 0.
06448  * @return
06449  *      1 on success, 0 if the stream is not an external filter
06450  *      <0 on error
06451  *
06452  * @since 0.6.18
06453  */
06454 int iso_stream_get_external_filter(IsoStream *stream,
06455                                    IsoExternalFilterCommand **cmd, int flag);
06456 
06457 
06458 /* ---------------------------- Internal Filters --------------------------- */
06459 
06460 
06461 /**
06462  * Install a zisofs filter on top of the content stream of a data file.
06463  * zisofs is a compression format which is decompressed by some Linux kernels.
06464  * See also doc/zisofs_format.txt .
06465  * The filter will not be installed if its output size is not smaller than
06466  * the size of the input stream.
06467  * This is only enabled if the use of libz was enabled at compile time.
06468  * @param file
06469  *      The data file node which shall show filtered content.
06470  * @param flag
06471  *      Bitfield for control purposes
06472  *      bit0= Do not install filter if the number of output blocks is
06473  *            not smaller than the number of input blocks. Block size is 2048.
06474  *      bit1= Install a decompression filter rather than one for compression.
06475  *      bit2= Only inquire availability of zisofs filtering. file may be NULL.
06476  *            If available return 2, else return error.
06477  *      bit3= is reserved for internal use and will be forced to 0
06478  * @return
06479  *      1 on success, 2 if filter available but installation revoked
06480  *      <0 on error, e.g. ISO_ZLIB_NOT_ENABLED
06481  *
06482  * @since 0.6.18
06483  */
06484 int iso_file_add_zisofs_filter(IsoFile *file, int flag);
06485 
06486 /**
06487  * Inquire the number of zisofs compression and uncompression filters which
06488  * are in use.
06489  * @param ziso_count
06490  *      Will return the number of currently installed compression filters.
06491  * @param osiz_count
06492  *      Will return the number of currently installed uncompression filters.
06493  * @param flag
06494  *      Bitfield for control purposes, unused yet, submit 0
06495  * @return
06496  *      1 on success, <0 on error
06497  *
06498  * @since 0.6.18
06499  */
06500 int iso_zisofs_get_refcounts(off_t *ziso_count, off_t *osiz_count, int flag);
06501 
06502 
06503 /**
06504  * Parameter set for iso_zisofs_set_params().
06505  *
06506  * @since 0.6.18
06507  */
06508 struct iso_zisofs_ctrl {
06509 
06510     /* Set to 0 for this version of the structure */
06511     int version;
06512 
06513     /* Compression level for zlib function compress2(). From <zlib.h>:
06514      *  "between 0 and 9:
06515      *   1 gives best speed, 9 gives best compression, 0 gives no compression"
06516      * Default is 6.
06517      */
06518     int compression_level;
06519 
06520     /* Log2 of the block size for compression filters. Allowed values are:
06521      *   15 = 32 kiB ,  16 = 64 kiB ,  17 = 128 kiB
06522      */
06523     uint8_t block_size_log2;
06524 
06525 };
06526 
06527 /**
06528  * Set the global parameters for zisofs filtering.
06529  * This is only allowed while no zisofs compression filters are installed.
06530  * i.e. ziso_count returned by iso_zisofs_get_refcounts() has to be 0.
06531  * @param params
06532  *      Pointer to a structure with the intended settings.
06533  * @param flag
06534  *      Bitfield for control purposes, unused yet, submit 0
06535  * @return
06536  *      1 on success, <0 on error
06537  *
06538  * @since 0.6.18
06539  */
06540 int iso_zisofs_set_params(struct iso_zisofs_ctrl *params, int flag);
06541 
06542 /**
06543  * Get the current global parameters for zisofs filtering.
06544  * @param params
06545  *      Pointer to a caller provided structure which shall take the settings.
06546  * @param flag
06547  *      Bitfield for control purposes, unused yet, submit 0
06548  * @return
06549  *      1 on success, <0 on error
06550  *
06551  * @since 0.6.18
06552  */
06553 int iso_zisofs_get_params(struct iso_zisofs_ctrl *params, int flag);
06554 
06555 
06556 /**
06557  * Check for the given node or for its subtree whether the data file content
06558  * effectively bears zisofs file headers and eventually mark the outcome
06559  * by an xinfo data record if not already marked by a zisofs compressor filter.
06560  * This does not install any filter but only a hint for image generation
06561  * that the already compressed files shall get written with zisofs ZF entries.
06562  * Use this if you insert the compressed reults of program mkzftree from disk
06563  * into the image.
06564  * @param node
06565  *      The node which shall be checked and eventually marked.
06566  * @param flag
06567  *      Bitfield for control purposes, unused yet, submit 0
06568  *      bit0= prepare for a run with iso_write_opts_set_appendable(,1).
06569  *            Take into account that files from the imported image
06570  *            do not get their content filtered.
06571  *      bit1= permission to overwrite existing zisofs_zf_info
06572  *      bit2= if no zisofs header is found:
06573  *            create xinfo with parameters which indicate no zisofs
06574  *      bit3= no tree recursion if node is a directory
06575  *      bit4= skip files which stem from the imported image
06576  * @return
06577  *      0= no zisofs data found
06578  *      1= zf xinfo added
06579  *      2= found existing zf xinfo and flag bit1 was not set
06580  *      3= both encountered: 1 and 2
06581  *      <0 means error
06582  *
06583  * @since 0.6.18
06584  */
06585 int iso_node_zf_by_magic(IsoNode *node, int flag);
06586 
06587 
06588 /**
06589  * Install a gzip or gunzip filter on top of the content stream of a data file.
06590  * gzip is a compression format which is used by programs gzip and gunzip.
06591  * The filter will not be installed if its output size is not smaller than
06592  * the size of the input stream.
06593  * This is only enabled if the use of libz was enabled at compile time.
06594  * @param file
06595  *      The data file node which shall show filtered content.
06596  * @param flag
06597  *      Bitfield for control purposes
06598  *      bit0= Do not install filter if the number of output blocks is
06599  *            not smaller than the number of input blocks. Block size is 2048.
06600  *      bit1= Install a decompression filter rather than one for compression.
06601  *      bit2= Only inquire availability of gzip filtering. file may be NULL.
06602  *            If available return 2, else return error.
06603  *      bit3= is reserved for internal use and will be forced to 0
06604  * @return
06605  *      1 on success, 2 if filter available but installation revoked
06606  *      <0 on error, e.g. ISO_ZLIB_NOT_ENABLED
06607  *
06608  * @since 0.6.18
06609  */
06610 int iso_file_add_gzip_filter(IsoFile *file, int flag);
06611 
06612 
06613 /**
06614  * Inquire the number of gzip compression and uncompression filters which
06615  * are in use.
06616  * @param gzip_count
06617  *      Will return the number of currently installed compression filters.
06618  * @param gunzip_count
06619  *      Will return the number of currently installed uncompression filters.
06620  * @param flag
06621  *      Bitfield for control purposes, unused yet, submit 0
06622  * @return
06623  *      1 on success, <0 on error
06624  *
06625  * @since 0.6.18
06626  */
06627 int iso_gzip_get_refcounts(off_t *gzip_count, off_t *gunzip_count, int flag);
06628 
06629 
06630 /* ---------------------------- MD5 Checksums --------------------------- */
06631 
06632 /* Production and loading of MD5 checksums is controlled by calls
06633    iso_write_opts_set_record_md5() and iso_read_opts_set_no_md5().
06634    For data representation details see doc/checksums.txt .
06635 */
06636 
06637 /**
06638  * Eventually obtain the recorded MD5 checksum of the session which was
06639  * loaded as ISO image. Such a checksum may be stored together with others
06640  * in a contiguous array at the end of the session. The session checksum
06641  * covers the data blocks from address start_lba to address end_lba - 1.
06642  * It does not cover the recorded array of md5 checksums.
06643  * Layout, size, and position of the checksum array is recorded in the xattr
06644  * "isofs.ca" of the session root node.
06645  * @param image
06646  *      The image to inquire
06647  * @param start_lba
06648  *      Eventually returns the first block address covered by md5
06649  * @param end_lba
06650  *      Eventually returns the first block address not covered by md5 any more
06651  * @param md5
06652  *      Eventually returns 16 byte of MD5 checksum 
06653  * @param flag
06654  *      Bitfield for control purposes, unused yet, submit 0
06655  * @return
06656  *      1= md5 found , 0= no md5 available , <0 indicates error
06657  *
06658  * @since 0.6.22
06659  */
06660 int iso_image_get_session_md5(IsoImage *image, uint32_t *start_lba,
06661                               uint32_t *end_lba, char md5[16], int flag);
06662 
06663 /**
06664  * Eventually obtain the recorded MD5 checksum of a data file from the loaded
06665  * ISO image. Such a checksum may be stored with others in a contiguous
06666  * array at the end of the loaded session. The data file eventually has an
06667  * xattr "isofs.cx" which gives the index in that array.
06668  * @param image
06669  *      The image from which file stems.
06670  * @param file
06671  *      The file object to inquire
06672  * @param md5
06673  *      Eventually returns 16 byte of MD5 checksum 
06674  * @param flag
06675  *      Bitfield for control purposes
06676  *      bit0= only determine return value, do not touch parameter md5
06677  * @return
06678  *      1= md5 found , 0= no md5 available , <0 indicates error
06679  *
06680  * @since 0.6.22
06681  */
06682 int iso_file_get_md5(IsoImage *image, IsoFile *file, char md5[16], int flag);
06683 
06684 /**
06685  * Read the content of an IsoFile object, compute its MD5 and attach it to
06686  * the IsoFile. It can then be inquired by iso_file_get_md5() and will get
06687  * written into the next session if this is enabled at write time and if the
06688  * image write process does not compute an MD5 from content which it copies.
06689  * So this call can be used to equip nodes from the old image with checksums
06690  * or to make available checksums of newly added files before the session gets
06691  * written.
06692  * @param file
06693  *      The file object to read data from and to which to attach the checksum.
06694  *      If the file is from the imported image, then its most original stream
06695  *      will be checksummed. Else the eventual filter streams will get into
06696  *      effect.
06697  * @param flag
06698  *      Bitfield for control purposes. Unused yet. Submit 0.
06699  * @return
06700  *      1= ok, MD5 is computed and attached , <0 indicates error
06701  *
06702  * @since 0.6.22
06703  */
06704 int iso_file_make_md5(IsoFile *file, int flag);
06705 
06706 /**
06707  * Check a data block whether it is a libisofs session checksum tag and
06708  * eventually obtain its recorded parameters. These tags get written after
06709  * volume descriptors, directory tree and checksum array and can be detected
06710  * without loading the image tree.
06711  * One may start reading and computing MD5 at the suspected image session
06712  * start and look out for a session tag on the fly. See doc/checksum.txt .
06713  * @param data
06714  *      A complete and aligned data block read from an ISO image session.
06715  * @param tag_type
06716  *      0= no tag
06717  *      1= session tag
06718  *      2= superblock tag
06719  *      3= tree tag
06720  *      4= relocated 64 kB superblock tag (at LBA 0 of overwriteable media)
06721  * @param pos
06722  *      Returns the LBA where the tag supposes itself to be stored.
06723  *      If this does not match the data block LBA then the tag might be
06724  *      image data payload and should be ignored for image checksumming.
06725  * @param range_start
06726  *      Returns the block address where the session is supposed to start.
06727  *      If this does not match the session start on media then the image
06728  *      volume descriptors have been been relocated.
06729  *      A proper checksum will only emerge if computing started at range_start.
06730  * @param range_size
06731  *      Returns the number of blocks beginning at range_start which are
06732  *      covered by parameter md5.
06733  * @param next_tag
06734  *      Returns the predicted block address of the next tag.
06735  *      next_tag is valid only if not 0 and only with return values 2, 3, 4.
06736  *      With tag types 2 and 3, reading shall go on sequentially and the MD5
06737  *      computation shall continue up to that address.
06738  *      With tag type 4, reading shall resume either at LBA 32 for the first
06739  *      session or at the given address for the session which is to be loaded
06740  *      by default. In both cases the MD5 computation shall be re-started from
06741  *      scratch.
06742  * @param md5
06743  *      Returns 16 byte of MD5 checksum.
06744  * @param flag
06745  *      Bitfield for control purposes:
06746  *      bit0-bit7= tag type being looked for
06747  *                 0= any checksum tag
06748  *                 1= session tag
06749  *                 2= superblock tag
06750  *                 3= tree tag
06751  *                 4= relocated superblock tag
06752  * @return
06753  *      0= not a checksum tag, return parameters are invalid
06754  *      1= checksum tag found, return parameters are valid
06755  *     <0= error 
06756  *         (return parameters are valid with error ISO_MD5_AREA_CORRUPTED
06757  *          but not trustworthy because the tag seems corrupted)
06758  *
06759  * @since 0.6.22
06760  */
06761 int iso_util_decode_md5_tag(char data[2048], int *tag_type, uint32_t *pos,
06762                             uint32_t *range_start, uint32_t *range_size,
06763                             uint32_t *next_tag, char md5[16], int flag);
06764 
06765 
06766 /* The following functions allow to do own MD5 computations. E.g for
06767    comparing the result with a recorded checksum.
06768 */
06769 /**
06770  * Create a MD5 computation context and hand out an opaque handle.
06771  *
06772  * @param md5_context
06773  *      Returns the opaque handle. Submitted *md5_context must be NULL or
06774  *      point to freeable memory.
06775  * @return
06776  *      1= success , <0 indicates error
06777  *
06778  * @since 0.6.22
06779  */
06780 int iso_md5_start(void **md5_context);
06781 
06782 /**
06783  * Advance the computation of a MD5 checksum by a chunk of data bytes.
06784  *
06785  * @param md5_context
06786  *      An opaque handle once returned by iso_md5_start() or iso_md5_clone().
06787  * @param data
06788  *      The bytes which shall be processed into to the checksum.
06789  * @param datalen
06790  *      The number of bytes to be processed.
06791  * @return
06792  *      1= success , <0 indicates error
06793  *
06794  * @since 0.6.22
06795  */
06796 int iso_md5_compute(void *md5_context, char *data, int datalen);
06797 
06798 /**     
06799  * Create a MD5 computation context as clone of an existing one. One may call
06800  * iso_md5_clone(old, &new, 0) and then iso_md5_end(&new, result, 0) in order
06801  * to obtain an intermediate MD5 sum before the computation goes on.
06802  * 
06803  * @param old_md5_context
06804  *      An opaque handle once returned by iso_md5_start() or iso_md5_clone().
06805  * @param new_md5_context
06806  *      Returns the opaque handle to the new MD5 context. Submitted
06807  *      *md5_context must be NULL or point to freeable memory.
06808  * @return
06809  *      1= success , <0 indicates error
06810  *
06811  * @since 0.6.22
06812  */
06813 int iso_md5_clone(void *old_md5_context, void **new_md5_context);
06814 
06815 /**
06816  * Obtain the MD5 checksum from a MD5 computation context and dispose this
06817  * context. (If you want to keep the context then call iso_md5_clone() and
06818  * apply iso_md5_end() to the clone.)
06819  *
06820  * @param md5_context
06821  *      A pointer to an opaque handle once returned by iso_md5_start() or
06822  *      iso_md5_clone(). *md5_context will be set to NULL in this call.
06823  * @param result
06824  *      Gets filled with the 16 bytes of MD5 checksum.
06825  * @return
06826  *      1= success , <0 indicates error
06827  *
06828  * @since 0.6.22
06829  */
06830 int iso_md5_end(void **md5_context, char result[16]);
06831 
06832 /**
06833  * Inquire whether two MD5 checksums match. (This is trivial but such a call
06834  * is convenient and completes the interface.)
06835  * @param first_md5
06836  *      A MD5 byte string as returned by iso_md5_end()
06837  * @param second_md5
06838  *      A MD5 byte string as returned by iso_md5_end()
06839  * @return
06840  *      1= match , 0= mismatch
06841  *
06842  * @since 0.6.22
06843  */
06844 int iso_md5_match(char first_md5[16], char second_md5[16]);
06845 
06846 
06847 /* -------------------------------- For HFS+ ------------------------------- */
06848 
06849 
06850 /** 
06851  * HFS+ attributes which may be attached to IsoNode objects as data parameter
06852  * of iso_node_add_xinfo(). As parameter proc use iso_hfsplus_xinfo_func().
06853  * Create instances of this struct by iso_hfsplus_xinfo_new().
06854  *
06855  * @since 1.2.4
06856  */
06857 struct iso_hfsplus_xinfo_data {
06858 
06859   /* Currently set to 0 by iso_hfsplus_xinfo_new() */
06860   int version;
06861 
06862   /* Attributes available with version 0.
06863    * See: http://en.wikipedia.org/wiki/Creator_code , .../Type_code
06864    * @since 1.2.4
06865   */
06866   uint8_t creator_code[4];
06867   uint8_t type_code[4];
06868 };
06869 
06870 /** 
06871  * The function that is used to mark struct iso_hfsplus_xinfo_data at IsoNodes
06872  * and finally disposes such structs when their IsoNodes get disposed.
06873  * Usually an application does not call this function, but only uses it as
06874  * parameter of xinfo calls like iso_node_add_xinfo() or iso_node_get_xinfo().
06875  *
06876  * @since 1.2.4
06877  */
06878 int iso_hfsplus_xinfo_func(void *data, int flag);
06879 
06880 /** 
06881  * Create an instance of struct iso_hfsplus_xinfo_new().
06882  *
06883  * @param flag
06884  *      Bitfield for control purposes. Unused yet. Submit 0.
06885  * @return
06886  *      A pointer to the new object
06887  *      NULL indicates failure to allocate memory
06888  *
06889  * @since 1.2.4
06890  */
06891 struct iso_hfsplus_xinfo_data *iso_hfsplus_xinfo_new(int flag);
06892 
06893 
06894 /**
06895  * HFS+ blessings are relationships between HFS+ enhanced ISO images and
06896  * particular files in such images. Except for ISO_HFSPLUS_BLESS_INTEL_BOOTFILE
06897  * and ISO_HFSPLUS_BLESS_MAX, these files have to be directories.
06898  * No file may have more than one blessing. Each blessing can only be issued
06899  * to one file.
06900  *
06901  * @since 1.2.4
06902  */
06903 enum IsoHfsplusBlessings {
06904     /* The blessing that is issued by mkisofs option -hfs-bless. */
06905     ISO_HFSPLUS_BLESS_PPC_BOOTDIR,
06906 
06907     /* To be applied to a data file */
06908     ISO_HFSPLUS_BLESS_INTEL_BOOTFILE,
06909 
06910     /* Further blessings for directories */
06911     ISO_HFSPLUS_BLESS_SHOWFOLDER,
06912     ISO_HFSPLUS_BLESS_OS9_FOLDER,
06913     ISO_HFSPLUS_BLESS_OSX_FOLDER,
06914 
06915     /* Not a blessing, but telling the number of blessings in this list */
06916     ISO_HFSPLUS_BLESS_MAX
06917 };
06918 
06919 /**
06920  * Issue a blessing to a particular IsoNode. If the blessing is already issued
06921  * to some file, then it gets revoked from that one.
06922  * 
06923  * @param image
06924  *     The image to manipulate.
06925  * @param blessing
06926  *      The kind of blessing to be issued.
06927  * @param node
06928  *      The file that shall be blessed. It must actually be an IsoDir or
06929  *      IsoFile as is appropriate for the kind of blessing. (See above enum.)
06930  *      The node may not yet bear a blessing other than the desired one.
06931  *      If node is NULL, then the blessing will be revoked from any node
06932  *      which bears it.
06933  * @param flag
06934  *      Bitfield for control purposes.
06935  *        bit0= Revoke blessing if node != NULL bears it.
06936  *        bit1= Revoke any blessing of the node, regardless of parameter
06937  *              blessing. If node is NULL, then revoke all blessings in
06938  *              the image.
06939  * @return
06940  *      1 means successful blessing or revokation of an existing blessing.
06941  *      0 means the node already bears another blessing, or is of wrong type,
06942  *        or that the node was not blessed and revokation was desired.
06943  *      <0 is one of the listed error codes.
06944  *
06945  * @since 1.2.4
06946  */
06947 int iso_image_hfsplus_bless(IsoImage *img, enum IsoHfsplusBlessings blessing,
06948                             IsoNode *node, int flag);
06949 
06950 /**
06951  * Get the array of nodes which are currently blessed.
06952  * Array indice correspond to enum IsoHfsplusBlessings.
06953  * Array element value NULL means that no node bears that blessing.
06954  *
06955  * Several usage restrictions apply. See parameter blessed_nodes.
06956  *
06957  * @param image
06958  *     The image to inquire.
06959  * @param blessed_nodes
06960  *     Will return a pointer to an internal node array of image.
06961  *     This pointer is valid only as long as image exists and only until
06962  *     iso_image_hfsplus_bless() gets used to manipulate the blessings.
06963  *     Do not free() this array. Do not alter the content of the array
06964  *     directly, but rather use iso_image_hfsplus_bless() and re-inquire
06965  *     by iso_image_hfsplus_get_blessed().
06966  *     This call does not impose an extra reference on the nodes in the
06967  *     array. So do not iso_node_unref() them.
06968  *     Nodes listed here are not necessarily grafted into the tree of
06969  *     the IsoImage.
06970  * @param bless_max
06971  *     Will return the number of elements in the array.
06972  *     It is unlikely but not outruled that it will be larger than
06973  *     ISO_HFSPLUS_BLESS_MAX in this libisofs.h file.
06974  * @param flag
06975  *      Bitfield for control purposes. Submit 0.
06976  * @return
06977  *      1 means success, <0 means error
06978  *
06979  * @since 1.2.4
06980  */
06981 int iso_image_hfsplus_get_blessed(IsoImage *img, IsoNode ***blessed_nodes,
06982                                   int *bless_max, int flag);
06983 
06984 
06985 /************ Error codes and return values for libisofs ********************/
06986 
06987 /** successfully execution */
06988 #define ISO_SUCCESS                     1
06989 
06990 /**
06991  * special return value, it could be or not an error depending on the
06992  * context.
06993  */
06994 #define ISO_NONE                        0
06995 
06996 /** Operation canceled (FAILURE,HIGH, -1) */
06997 #define ISO_CANCELED                    0xE830FFFF
06998 
06999 /** Unknown or unexpected fatal error (FATAL,HIGH, -2) */
07000 #define ISO_FATAL_ERROR                 0xF030FFFE
07001 
07002 /** Unknown or unexpected error (FAILURE,HIGH, -3) */
07003 #define ISO_ERROR                       0xE830FFFD
07004 
07005 /** Internal programming error. Please report this bug (FATAL,HIGH, -4) */
07006 #define ISO_ASSERT_FAILURE              0xF030FFFC
07007 
07008 /**
07009  * NULL pointer as value for an arg. that doesn't allow NULL (FAILURE,HIGH, -5)
07010  */
07011 #define ISO_NULL_POINTER                0xE830FFFB
07012 
07013 /** Memory allocation error (FATAL,HIGH, -6) */
07014 #define ISO_OUT_OF_MEM                  0xF030FFFA
07015 
07016 /** Interrupted by a signal (FATAL,HIGH, -7) */
07017 #define ISO_INTERRUPTED                 0xF030FFF9
07018 
07019 /** Invalid parameter value (FAILURE,HIGH, -8) */
07020 #define ISO_WRONG_ARG_VALUE             0xE830FFF8
07021 
07022 /** Can't create a needed thread (FATAL,HIGH, -9) */
07023 #define ISO_THREAD_ERROR                0xF030FFF7
07024 
07025 /** Write error (FAILURE,HIGH, -10) */
07026 #define ISO_WRITE_ERROR                 0xE830FFF6
07027 
07028 /** Buffer read error (FAILURE,HIGH, -11) */
07029 #define ISO_BUF_READ_ERROR              0xE830FFF5
07030 
07031 /** Trying to add to a dir a node already added to a dir (FAILURE,HIGH, -64) */
07032 #define ISO_NODE_ALREADY_ADDED          0xE830FFC0
07033 
07034 /** Node with same name already exists (FAILURE,HIGH, -65) */
07035 #define ISO_NODE_NAME_NOT_UNIQUE        0xE830FFBF
07036 
07037 /** Trying to remove a node that was not added to dir (FAILURE,HIGH, -65) */
07038 #define ISO_NODE_NOT_ADDED_TO_DIR       0xE830FFBE
07039 
07040 /** A requested node does not exist  (FAILURE,HIGH, -66) */
07041 #define ISO_NODE_DOESNT_EXIST           0xE830FFBD
07042 
07043 /**
07044  * Try to set the boot image of an already bootable image (FAILURE,HIGH, -67)
07045  */
07046 #define ISO_IMAGE_ALREADY_BOOTABLE      0xE830FFBC
07047 
07048 /** Trying to use an invalid file as boot image (FAILURE,HIGH, -68) */
07049 #define ISO_BOOT_IMAGE_NOT_VALID        0xE830FFBB
07050 
07051 /** Too many boot images (FAILURE,HIGH, -69) */
07052 #define ISO_BOOT_IMAGE_OVERFLOW         0xE830FFBA
07053 
07054 /** No boot catalog created yet ((FAILURE,HIGH, -70) */ /* @since 0.6.34 */
07055 #define ISO_BOOT_NO_CATALOG             0xE830FFB9
07056 
07057 
07058 /**
07059  * Error on file operation (FAILURE,HIGH, -128)
07060  * (take a look at more specified error codes below)
07061  */
07062 #define ISO_FILE_ERROR                  0xE830FF80
07063 
07064 /** Trying to open an already opened file (FAILURE,HIGH, -129) */
07065 #define ISO_FILE_ALREADY_OPENED         0xE830FF7F
07066 
07067 /* @deprecated use ISO_FILE_ALREADY_OPENED instead */
07068 #define ISO_FILE_ALREADY_OPENNED        0xE830FF7F
07069 
07070 /** Access to file is not allowed (FAILURE,HIGH, -130) */
07071 #define ISO_FILE_ACCESS_DENIED          0xE830FF7E
07072 
07073 /** Incorrect path to file (FAILURE,HIGH, -131) */
07074 #define ISO_FILE_BAD_PATH               0xE830FF7D
07075 
07076 /** The file does not exist in the filesystem (FAILURE,HIGH, -132) */
07077 #define ISO_FILE_DOESNT_EXIST           0xE830FF7C
07078 
07079 /** Trying to read or close a file not openned (FAILURE,HIGH, -133) */
07080 #define ISO_FILE_NOT_OPENED             0xE830FF7B
07081 
07082 /* @deprecated use ISO_FILE_NOT_OPENED instead */
07083 #define ISO_FILE_NOT_OPENNED            ISO_FILE_NOT_OPENED
07084 
07085 /** Directory used where no dir is expected (FAILURE,HIGH, -134) */
07086 #define ISO_FILE_IS_DIR                 0xE830FF7A
07087 
07088 /** Read error (FAILURE,HIGH, -135) */
07089 #define ISO_FILE_READ_ERROR             0xE830FF79
07090 
07091 /** Not dir used where a dir is expected (FAILURE,HIGH, -136) */
07092 #define ISO_FILE_IS_NOT_DIR             0xE830FF78
07093 
07094 /** Not symlink used where a symlink is expected (FAILURE,HIGH, -137) */
07095 #define ISO_FILE_IS_NOT_SYMLINK         0xE830FF77
07096 
07097 /** Can't seek to specified location (FAILURE,HIGH, -138) */
07098 #define ISO_FILE_SEEK_ERROR             0xE830FF76
07099 
07100 /** File not supported in ECMA-119 tree and thus ignored (WARNING,MEDIUM, -139) */
07101 #define ISO_FILE_IGNORED                0xD020FF75
07102 
07103 /* A file is bigger than supported by used standard  (WARNING,MEDIUM, -140) */
07104 #define ISO_FILE_TOO_BIG                0xD020FF74
07105 
07106 /* File read error during image creation (MISHAP,HIGH, -141) */
07107 #define ISO_FILE_CANT_WRITE             0xE430FF73
07108 
07109 /* Can't convert filename to requested charset (WARNING,MEDIUM, -142) */
07110 #define ISO_FILENAME_WRONG_CHARSET      0xD020FF72
07111 /* This was once a HINT. Deprecated now. */
07112 #define ISO_FILENAME_WRONG_CHARSET_OLD  0xC020FF72
07113 
07114 /* File can't be added to the tree (SORRY,HIGH, -143) */
07115 #define ISO_FILE_CANT_ADD               0xE030FF71
07116 
07117 /**
07118  * File path break specification constraints and will be ignored
07119  * (WARNING,MEDIUM, -144)
07120  */
07121 #define ISO_FILE_IMGPATH_WRONG          0xD020FF70
07122 
07123 /**
07124  * Offset greater than file size (FAILURE,HIGH, -150)
07125  * @since 0.6.4
07126  */
07127 #define ISO_FILE_OFFSET_TOO_BIG         0xE830FF6A
07128 
07129 
07130 /** Charset conversion error (FAILURE,HIGH, -256) */
07131 #define ISO_CHARSET_CONV_ERROR          0xE830FF00
07132 
07133 /**
07134  * Too many files to mangle, i.e. we cannot guarantee unique file names
07135  * (FAILURE,HIGH, -257)
07136  */
07137 #define ISO_MANGLE_TOO_MUCH_FILES       0xE830FEFF
07138 
07139 /* image related errors */
07140 
07141 /**
07142  * Wrong or damaged Primary Volume Descriptor (FAILURE,HIGH, -320)
07143  * This could mean that the file is not a valid ISO image.
07144  */
07145 #define ISO_WRONG_PVD                   0xE830FEC0
07146 
07147 /** Wrong or damaged RR entry (SORRY,HIGH, -321) */
07148 #define ISO_WRONG_RR                    0xE030FEBF
07149 
07150 /** Unsupported RR feature (SORRY,HIGH, -322) */
07151 #define ISO_UNSUPPORTED_RR              0xE030FEBE
07152 
07153 /** Wrong or damaged ECMA-119 (FAILURE,HIGH, -323) */
07154 #define ISO_WRONG_ECMA119               0xE830FEBD
07155 
07156 /** Unsupported ECMA-119 feature (FAILURE,HIGH, -324) */
07157 #define ISO_UNSUPPORTED_ECMA119         0xE830FEBC
07158 
07159 /** Wrong or damaged El-Torito catalog (WARN,HIGH, -325) */
07160 #define ISO_WRONG_EL_TORITO             0xD030FEBB
07161 
07162 /** Unsupported El-Torito feature (WARN,HIGH, -326) */
07163 #define ISO_UNSUPPORTED_EL_TORITO       0xD030FEBA
07164 
07165 /** Can't patch an isolinux boot image (SORRY,HIGH, -327) */
07166 #define ISO_ISOLINUX_CANT_PATCH         0xE030FEB9
07167 
07168 /** Unsupported SUSP feature (SORRY,HIGH, -328) */
07169 #define ISO_UNSUPPORTED_SUSP            0xE030FEB8
07170 
07171 /** Error on a RR entry that can be ignored (WARNING,HIGH, -329) */
07172 #define ISO_WRONG_RR_WARN               0xD030FEB7
07173 
07174 /** Error on a RR entry that can be ignored (HINT,MEDIUM, -330) */
07175 #define ISO_SUSP_UNHANDLED              0xC020FEB6
07176 
07177 /** Multiple ER SUSP entries found (WARNING,HIGH, -331) */
07178 #define ISO_SUSP_MULTIPLE_ER            0xD030FEB5
07179 
07180 /** Unsupported volume descriptor found (HINT,MEDIUM, -332) */
07181 #define ISO_UNSUPPORTED_VD              0xC020FEB4
07182 
07183 /** El-Torito related warning (WARNING,HIGH, -333) */
07184 #define ISO_EL_TORITO_WARN              0xD030FEB3
07185 
07186 /** Image write cancelled (MISHAP,HIGH, -334) */
07187 #define ISO_IMAGE_WRITE_CANCELED        0xE430FEB2
07188 
07189 /** El-Torito image is hidden (WARNING,HIGH, -335) */
07190 #define ISO_EL_TORITO_HIDDEN            0xD030FEB1
07191 
07192 
07193 /** AAIP info with ACL or xattr in ISO image will be ignored
07194                                                           (NOTE, HIGH, -336) */
07195 #define ISO_AAIP_IGNORED          0xB030FEB0
07196 
07197 /** Error with decoding ACL from AAIP info (FAILURE, HIGH, -337) */
07198 #define ISO_AAIP_BAD_ACL          0xE830FEAF
07199 
07200 /** Error with encoding ACL for AAIP (FAILURE, HIGH, -338) */
07201 #define ISO_AAIP_BAD_ACL_TEXT     0xE830FEAE
07202 
07203 /** AAIP processing for ACL or xattr not enabled at compile time
07204                                                        (FAILURE, HIGH, -339) */
07205 #define ISO_AAIP_NOT_ENABLED      0xE830FEAD
07206 
07207 /** Error with decoding AAIP info for ACL or xattr (FAILURE, HIGH, -340) */
07208 #define ISO_AAIP_BAD_AASTRING     0xE830FEAC
07209 
07210 /** Error with reading ACL or xattr from local file (FAILURE, HIGH, -341) */
07211 #define ISO_AAIP_NO_GET_LOCAL     0xE830FEAB
07212 
07213 /** Error with attaching ACL or xattr to local file (FAILURE, HIGH, -342) */
07214 #define ISO_AAIP_NO_SET_LOCAL     0xE830FEAA
07215 
07216 /** Unallowed attempt to set an xattr with non-userspace name
07217                                                     (FAILURE, HIGH, -343) */
07218 #define ISO_AAIP_NON_USER_NAME    0xE830FEA9
07219 
07220 /** Too many references on a single IsoExternalFilterCommand
07221                                                     (FAILURE, HIGH, -344) */
07222 #define ISO_EXTF_TOO_OFTEN        0xE830FEA8
07223 
07224 /** Use of zlib was not enabled at compile time (FAILURE, HIGH, -345) */
07225 #define ISO_ZLIB_NOT_ENABLED      0xE830FEA7
07226 
07227 /** Cannot apply zisofs filter to file >= 4 GiB  (FAILURE, HIGH, -346) */
07228 #define ISO_ZISOFS_TOO_LARGE      0xE830FEA6
07229 
07230 /** Filter input differs from previous run  (FAILURE, HIGH, -347) */
07231 #define ISO_FILTER_WRONG_INPUT    0xE830FEA5
07232 
07233 /** zlib compression/decompression error  (FAILURE, HIGH, -348) */
07234 #define ISO_ZLIB_COMPR_ERR        0xE830FEA4
07235 
07236 /** Input stream is not in zisofs format  (FAILURE, HIGH, -349) */
07237 #define ISO_ZISOFS_WRONG_INPUT    0xE830FEA3
07238 
07239 /** Cannot set global zisofs parameters while filters exist
07240                                                        (FAILURE, HIGH, -350) */
07241 #define ISO_ZISOFS_PARAM_LOCK     0xE830FEA2
07242 
07243 /** Premature EOF of zlib input stream  (FAILURE, HIGH, -351) */
07244 #define ISO_ZLIB_EARLY_EOF        0xE830FEA1
07245 
07246 /**
07247  * Checksum area or checksum tag appear corrupted  (WARNING,HIGH, -352)
07248  * @since 0.6.22
07249 */
07250 #define ISO_MD5_AREA_CORRUPTED    0xD030FEA0
07251 
07252 /**
07253  * Checksum mismatch between checksum tag and data blocks
07254  * (FAILURE, HIGH, -353)
07255  * @since 0.6.22
07256 */
07257 #define ISO_MD5_TAG_MISMATCH      0xE830FE9F
07258 
07259 /**
07260  * Checksum mismatch in System Area, Volume Descriptors, or directory tree.
07261  * (FAILURE, HIGH, -354)
07262  * @since 0.6.22
07263 */
07264 #define ISO_SB_TREE_CORRUPTED     0xE830FE9E
07265 
07266 /**
07267  * Unexpected checksum tag type encountered.   (WARNING, HIGH, -355)
07268  * @since 0.6.22
07269 */
07270 #define ISO_MD5_TAG_UNEXPECTED    0xD030FE9D
07271 
07272 /**
07273  * Misplaced checksum tag encountered. (WARNING, HIGH, -356)
07274  * @since 0.6.22
07275 */
07276 #define ISO_MD5_TAG_MISPLACED     0xD030FE9C
07277 
07278 /**
07279  * Checksum tag with unexpected address range encountered.
07280  * (WARNING, HIGH, -357)
07281  * @since 0.6.22
07282 */
07283 #define ISO_MD5_TAG_OTHER_RANGE   0xD030FE9B
07284 
07285 /**
07286  * Detected file content changes while it was written into the image.
07287  * (MISHAP, HIGH, -358)
07288  * @since 0.6.22
07289 */
07290 #define ISO_MD5_STREAM_CHANGE     0xE430FE9A
07291 
07292 /**
07293  * Session does not start at LBA 0. scdbackup checksum tag not written.
07294  * (WARNING, HIGH, -359)
07295  * @since 0.6.24
07296 */
07297 #define ISO_SCDBACKUP_TAG_NOT_0   0xD030FE99
07298 
07299 /**
07300  * The setting of iso_write_opts_set_ms_block() leaves not enough room
07301  * for the prescibed size of iso_write_opts_set_overwrite_buf().
07302  * (FAILURE, HIGH, -360)
07303  * @since 0.6.36
07304  */
07305 #define ISO_OVWRT_MS_TOO_SMALL    0xE830FE98
07306 
07307 /**
07308  * The partition offset is not 0 and leaves not not enough room for
07309  * system area, volume descriptors, and checksum tags of the first tree.
07310  * (FAILURE, HIGH, -361)
07311  */
07312 #define ISO_PART_OFFST_TOO_SMALL   0xE830FE97
07313 
07314 /**
07315  * The ring buffer is smaller than 64 kB + partition offset.
07316  * (FAILURE, HIGH, -362)
07317  */
07318 #define ISO_OVWRT_FIFO_TOO_SMALL   0xE830FE96
07319 
07320 /** Use of libjte was not enabled at compile time (FAILURE, HIGH, -363) */
07321 #define ISO_LIBJTE_NOT_ENABLED     0xE830FE95
07322 
07323 /** Failed to start up Jigdo Template Extraction (FAILURE, HIGH, -364) */
07324 #define ISO_LIBJTE_START_FAILED    0xE830FE94
07325 
07326 /** Failed to finish Jigdo Template Extraction (FAILURE, HIGH, -365) */
07327 #define ISO_LIBJTE_END_FAILED      0xE830FE93
07328 
07329 /** Failed to process file for Jigdo Template Extraction
07330    (MISHAP, HIGH, -366) */
07331 #define ISO_LIBJTE_FILE_FAILED     0xE430FE92
07332 
07333 /** Too many MIPS Big Endian boot files given (max. 15) (FAILURE, HIGH, -367)*/
07334 #define ISO_BOOT_TOO_MANY_MIPS     0xE830FE91
07335 
07336 /** Boot file missing in image (MISHAP, HIGH, -368) */
07337 #define ISO_BOOT_FILE_MISSING      0xE430FE90
07338 
07339 /** Partition number out of range (FAILURE, HIGH, -369) */
07340 #define ISO_BAD_PARTITION_NO       0xE830FE8F
07341 
07342 /** Cannot open data file for appended partition (FAILURE, HIGH, -370) */
07343 #define ISO_BAD_PARTITION_FILE     0xE830FE8E
07344 
07345 /** May not combine MBR partition with non-MBR system area
07346                                                        (FAILURE, HIGH, -371) */
07347 #define ISO_NON_MBR_SYS_AREA       0xE830FE8D
07348 
07349 /** Displacement offset leads outside 32 bit range (FAILURE, HIGH, -372) */
07350 #define ISO_DISPLACE_ROLLOVER      0xE830FE8C
07351 
07352 /** File name cannot be written into ECMA-119 untranslated
07353                                                        (FAILURE, HIGH, -373) */
07354 #define ISO_NAME_NEEDS_TRANSL      0xE830FE8B
07355 
07356 /** Data file input stream object offers no cloning method
07357                                                        (FAILURE, HIGH, -374) */
07358 #define ISO_STREAM_NO_CLONE        0xE830FE8A
07359 
07360 /** Extended information class offers no cloning method
07361                                                        (FAILURE, HIGH, -375) */
07362 #define ISO_XINFO_NO_CLONE         0xE830FE89
07363 
07364 /** Found copied superblock checksum tag  (WARNING, HIGH, -376) */
07365 #define ISO_MD5_TAG_COPIED         0xD030FE88
07366 
07367 /** Rock Ridge leaf name too long (FAILURE, HIGH, -377) */
07368 #define ISO_RR_NAME_TOO_LONG       0xE830FE87
07369 
07370 /** Reserved Rock Ridge leaf name  (FAILURE, HIGH, -378) */
07371 #define ISO_RR_NAME_RESERVED       0xE830FE86
07372 
07373 /** Rock Ridge path too long  (FAILURE, HIGH, -379) */
07374 #define ISO_RR_PATH_TOO_LONG       0xE830FE85
07375 
07376 /** Attribute name cannot be represented  (FAILURE, HIGH, -380) */
07377 #define ISO_AAIP_BAD_ATTR_NAME      0xE830FE84
07378 
07379 /** ACL text contains multiple entries of user::, group::, other::
07380                                                      (FAILURE, HIGH, -381)  */
07381 #define ISO_AAIP_ACL_MULT_OBJ       0xE830FE83
07382 
07383 /** File sections do not form consecutive array of blocks
07384                                                      (FAILURE, HIGH, -382) */
07385 #define ISO_SECT_SCATTERED          0xE830FE82
07386 
07387 /** Too many Apple Partition Map entries requested (FAILURE, HIGH, -383) */
07388 #define ISO_BOOT_TOO_MANY_APM       0xE830FE81
07389 
07390 /** Overlapping Apple Partition Map entries requested (FAILURE, HIGH, -384) */
07391 #define ISO_BOOT_APM_OVERLAP        0xE830FE80
07392 
07393 /** Too many GPT entries requested (FAILURE, HIGH, -385) */
07394 #define ISO_BOOT_TOO_MANY_GPT       0xE830FE7F
07395 
07396 /** Overlapping GPT entries requested (FAILURE, HIGH, -386) */
07397 #define ISO_BOOT_GPT_OVERLAP        0xE830FE7E
07398 
07399 /** Too many MBR partition entries requested (FAILURE, HIGH, -387) */
07400 #define ISO_BOOT_TOO_MANY_MBR       0xE830FE7D
07401 
07402 /** Overlapping MBR partition entries requested (FAILURE, HIGH, -388) */
07403 #define ISO_BOOT_MBR_OVERLAP        0xE830FE7C
07404 
07405 /** Attempt to use an MBR partition entry twice (FAILURE, HIGH, -389) */
07406 #define ISO_BOOT_MBR_COLLISION      0xE830FE7B
07407 
07408 /** No suitable El Torito EFI boot image for exposure as GPT partition
07409                                                        (FAILURE, HIGH, -390) */
07410 #define ISO_BOOT_NO_EFI_ELTO        0xE830FE7A
07411 
07412 /** Not a supported HFS+ or APM block size  (FAILURE, HIGH, -391) */
07413 #define ISO_BOOT_HFSP_BAD_BSIZE     0xE830FE79
07414 
07415 /** APM block size prevents coexistence with GPT  (FAILURE, HIGH, -392) */
07416 #define ISO_BOOT_APM_GPT_BSIZE      0xE830FE78
07417 
07418 /** Name collision in HFS+, mangling not possible  (FAILURE, HIGH, -393) */
07419 #define ISO_HFSP_NO_MANGLE          0xE830FE77
07420 
07421 /** Symbolic link cannot be resolved               (FAILURE, HIGH, -394) */
07422 #define ISO_DEAD_SYMLINK            0xE830FE76
07423 
07424 /** Too many chained symbolic links                (FAILURE, HIGH, -395) */
07425 #define ISO_DEEP_SYMLINK            0xE830FE75
07426 
07427 
07428 /* Internal developer note: 
07429    Place new error codes directly above this comment. 
07430    Newly introduced errors must get a message entry in
07431    libisofs/message.c, function iso_error_to_msg()
07432 */
07433 
07434 /* ! PLACE NEW ERROR CODES ABOVE. NOT AFTER THIS LINE ! */
07435 
07436 
07437 /** Read error occured with IsoDataSource (SORRY,HIGH, -513) */
07438 #define ISO_DATA_SOURCE_SORRY     0xE030FCFF
07439 
07440 /** Read error occured with IsoDataSource (MISHAP,HIGH, -513) */
07441 #define ISO_DATA_SOURCE_MISHAP    0xE430FCFF
07442 
07443 /** Read error occured with IsoDataSource (FAILURE,HIGH, -513) */
07444 #define ISO_DATA_SOURCE_FAILURE   0xE830FCFF
07445 
07446 /** Read error occured with IsoDataSource (FATAL,HIGH, -513) */
07447 #define ISO_DATA_SOURCE_FATAL     0xF030FCFF
07448 
07449 
07450 /* ! PLACE NEW ERROR CODES SEVERAL LINES ABOVE. NOT HERE ! */
07451 
07452 
07453 /* ------------------------------------------------------------------------- */
07454 
07455 #ifdef LIBISOFS_WITHOUT_LIBBURN
07456 
07457 /**
07458     This is a copy from the API of libburn-0.6.0 (under GPL).
07459     It is supposed to be as stable as any overall include of libburn.h.
07460     I.e. if this definition is out of sync then you cannot rely on any
07461     contract that was made with libburn.h.
07462 
07463     Libisofs does not need to be linked with libburn at all. But if it is
07464     linked with libburn then it must be libburn-0.4.2 or later.
07465 
07466     An application that provides own struct burn_source objects and does not
07467     include libburn/libburn.h has to define LIBISOFS_WITHOUT_LIBBURN before
07468     including libisofs/libisofs.h in order to make this copy available.
07469 */ 
07470 
07471 
07472 /** Data source interface for tracks.
07473     This allows to use arbitrary program code as provider of track input data.
07474 
07475     Objects compliant to this interface are either provided by the application
07476     or by API calls of libburn: burn_fd_source_new(), burn_file_source_new(),
07477     and burn_fifo_source_new().
07478 
07479     libisofs acts as "application" and implements an own class of burn_source.
07480     Instances of that class are handed out by iso_image_create_burn_source().
07481 
07482 */
07483 struct burn_source {
07484 
07485     /** Reference count for the data source. MUST be 1 when a new source
07486             is created and thus the first reference is handed out. Increment
07487             it to take more references for yourself. Use burn_source_free()
07488             to destroy your references to it. */
07489     int refcount;
07490 
07491 
07492     /** Read data from the source. Semantics like with read(2), but MUST
07493         either deliver the full buffer as defined by size or MUST deliver
07494         EOF (return 0) or failure (return -1) at this call or at the
07495         next following call. I.e. the only incomplete buffer may be the
07496         last one from that source.
07497         libburn will read a single sector by each call to (*read).
07498         The size of a sector depends on BURN_MODE_*. The known range is
07499         2048 to 2352.
07500 
07501             If this call is reading from a pipe then it will learn
07502             about the end of data only when that pipe gets closed on the
07503             feeder side. So if the track size is not fixed or if the pipe
07504             delivers less than the predicted amount or if the size is not
07505             block aligned, then burning will halt until the input process
07506             closes the pipe.
07507 
07508         IMPORTANT:
07509         If this function pointer is NULL, then the struct burn_source is of
07510         version >= 1 and the job of .(*read)() is done by .(*read_xt)().
07511         See below, member .version.
07512     */
07513     int (*read)(struct burn_source *, unsigned char *buffer, int size);
07514 
07515 
07516     /** Read subchannel data from the source (NULL if lib generated) 
07517         WARNING: This is an obscure feature with CD raw write modes.
07518         Unless you checked the libburn code for correctness in that aspect
07519         you should not rely on raw writing with own subchannels.
07520         ADVICE: Set this pointer to NULL.
07521     */
07522     int (*read_sub)(struct burn_source *, unsigned char *buffer, int size);
07523 
07524 
07525     /** Get the size of the source's data. Return 0 means unpredictable
07526         size. If application provided (*get_size) allows return 0, then
07527         the application MUST provide a fully functional (*set_size).
07528     */
07529     off_t (*get_size)(struct burn_source *); 
07530 
07531 
07532         /* @since 0.3.2 */
07533     /** Program the reply of (*get_size) to a fixed value. It is advised
07534         to implement this by a attribute  off_t fixed_size;  in *data .
07535         The read() function does not have to take into respect this fake
07536         setting. It is rather a note of libburn to itself. Eventually
07537         necessary truncation or padding is done in libburn. Truncation
07538         is usually considered a misburn. Padding is considered ok.
07539 
07540         libburn is supposed to work even if (*get_size) ignores the
07541             setting by (*set_size). But your application will not be able to
07542         enforce fixed track sizes by  burn_track_set_size() and possibly
07543         even padding might be left out.
07544     */
07545     int (*set_size)(struct burn_source *source, off_t size);
07546 
07547 
07548     /** Clean up the source specific data. This function will be called
07549         once by burn_source_free() when the last referer disposes the
07550         source.
07551     */
07552     void (*free_data)(struct burn_source *);
07553 
07554 
07555     /** Next source, for when a source runs dry and padding is disabled
07556         WARNING: This is an obscure feature. Set to NULL at creation and
07557                  from then on leave untouched and uninterpreted.
07558     */
07559     struct burn_source *next;
07560 
07561 
07562     /** Source specific data. Here the various source classes express their
07563         specific properties and the instance objects store their individual
07564         management data.
07565             E.g. data could point to a struct like this:
07566         struct app_burn_source
07567         {
07568             struct my_app *app_handle;
07569             ... other individual source parameters ...
07570             off_t fixed_size;
07571         };
07572 
07573         Function (*free_data) has to be prepared to clean up and free
07574         the struct.
07575     */
07576     void *data;
07577 
07578 
07579         /* @since 0.4.2 */
07580     /** Valid only if above member .(*read)() is NULL. This indicates a
07581         version of struct burn_source younger than 0.
07582         From then on, member .version tells which further members exist
07583         in the memory layout of struct burn_source. libburn will only touch
07584         those announced extensions.
07585 
07586         Versions:
07587          0  has .(*read)() != NULL, not even .version is present.
07588              1  has .version, .(*read_xt)(), .(*cancel)()
07589     */
07590     int version;
07591 
07592     /** This substitutes for (*read)() in versions above 0. */
07593     int (*read_xt)(struct burn_source *, unsigned char *buffer, int size);
07594 
07595     /** Informs the burn_source that the consumer of data prematurely
07596         ended reading. This call may or may not be issued by libburn
07597         before (*free_data)() is called.
07598     */
07599     int (*cancel)(struct burn_source *source);
07600 };
07601 
07602 #endif /* LIBISOFS_WITHOUT_LIBBURN */
07603 
07604 /* ----------------------------- Bug Fixes ----------------------------- */
07605 
07606 /* currently none being tested */
07607 
07608 
07609 /* ---------------------------- Improvements --------------------------- */
07610 
07611 /* currently none being tested */
07612 
07613 
07614 /* ---------------------------- Experiments ---------------------------- */
07615 
07616 
07617 /* Experiment: Write obsolete RR entries with Rock Ridge.
07618                I suspect Solaris wants to see them.
07619                DID NOT HELP: Solaris knows only RRIP_1991A.
07620 
07621  #define Libisofs_with_rrip_rR yes
07622 */
07623 
07624 
07625 #endif /*LIBISO_LIBISOFS_H_*/

Generated for libisofs by  doxygen 1.7.5