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