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

Generated for libisofs by  doxygen 1.7.4