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