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