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