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-2016 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 6 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 /** 02754 * Inquire the start address of the file data blocks after having used 02755 * IsoWriteOpts with iso_image_create_burn_source(). 02756 * @param opts 02757 * The option set that was used when starting image creation 02758 * @param data_start 02759 * Returns the logical block address if it is already valid 02760 * @param flag 02761 * Reserved for future usage, set to 0. 02762 * @return 02763 * 1 indicates valid data_start, <0 indicates invalid data_start 02764 * 02765 * @since 0.6.16 02766 */ 02767 int iso_write_opts_get_data_start(IsoWriteOpts *opts, uint32_t *data_start, 02768 int flag); 02769 02770 /** 02771 * Update the sizes of all files added to image. 02772 * 02773 * This may be called just before iso_image_create_burn_source() to force 02774 * libisofs to check the file sizes again (they're already checked when added 02775 * to IsoImage). It is useful if you have changed some files after adding then 02776 * to the image. 02777 * 02778 * @return 02779 * 1 on success, < 0 on error 02780 * @since 0.6.8 02781 */ 02782 int iso_image_update_sizes(IsoImage *image); 02783 02784 /** 02785 * Create a burn_source and a thread which immediately begins to generate 02786 * the image. That burn_source can be used with libburn as a data source 02787 * for a track. A copy of its public declaration in libburn.h can be found 02788 * further below in this text. 02789 * 02790 * If image generation shall be aborted by the application program, then 02791 * the .cancel() method of the burn_source must be called to end the 02792 * generation thread: burn_src->cancel(burn_src); 02793 * 02794 * @param image 02795 * The image to write. 02796 * @param opts 02797 * The options for image generation. All needed data will be copied, so 02798 * you can free the given struct once this function returns. 02799 * @param burn_src 02800 * Location where the pointer to the burn_source will be stored 02801 * @return 02802 * 1 on success, < 0 on error 02803 * 02804 * @since 0.6.2 02805 */ 02806 int iso_image_create_burn_source(IsoImage *image, IsoWriteOpts *opts, 02807 struct burn_source **burn_src); 02808 02809 /** 02810 * Inquire whether the image generator thread is still at work. As soon as the 02811 * reply is 0, the caller of iso_image_create_burn_source() may assume that 02812 * the image generation has ended. 02813 * Nevertheless there may still be readily formatted output data pending in 02814 * the burn_source or its consumers. So the final delivery of the image has 02815 * also to be checked at the data consumer side,e.g. by burn_drive_get_status() 02816 * in case of libburn as consumer. 02817 * @param image 02818 * The image to inquire. 02819 * @return 02820 * 1 generating of image stream is still in progress 02821 * 0 generating of image stream has ended meanwhile 02822 * 02823 * @since 0.6.38 02824 */ 02825 int iso_image_generator_is_running(IsoImage *image); 02826 02827 /** 02828 * Creates an IsoReadOpts for reading an existent image. You should set the 02829 * options desired with the correspondent setters. Note that you may want to 02830 * set the start block value. 02831 * 02832 * Options by default are determined by the selected profile. 02833 * 02834 * @param opts 02835 * Pointer to the location where the newly created IsoReadOpts will be 02836 * stored. You should free it with iso_read_opts_free() when no more 02837 * needed. 02838 * @param profile 02839 * Default profile for image reading. For now the following values are 02840 * defined: 02841 * ---> 0 [STANDARD] 02842 * Suitable for most situations. Most extension are read. When both 02843 * Joliet and RR extension are present, RR is used. 02844 * AAIP for ACL and xattr is not enabled by default. 02845 * @return 02846 * 1 success, < 0 error 02847 * 02848 * @since 0.6.2 02849 */ 02850 int iso_read_opts_new(IsoReadOpts **opts, int profile); 02851 02852 /** 02853 * Free an IsoReadOpts previously allocated with iso_read_opts_new(). 02854 * 02855 * @since 0.6.2 02856 */ 02857 void iso_read_opts_free(IsoReadOpts *opts); 02858 02859 /** 02860 * Set the block where the image begins. It is usually 0, but may be different 02861 * on a multisession disc. 02862 * 02863 * @since 0.6.2 02864 */ 02865 int iso_read_opts_set_start_block(IsoReadOpts *opts, uint32_t block); 02866 02867 /** 02868 * Do not read Rock Ridge extensions. 02869 * In most cases you don't want to use this. It could be useful if RR info 02870 * is damaged, or if you want to use the Joliet tree. 02871 * 02872 * @since 0.6.2 02873 */ 02874 int iso_read_opts_set_no_rockridge(IsoReadOpts *opts, int norr); 02875 02876 /** 02877 * Do not read Joliet extensions. 02878 * 02879 * @since 0.6.2 02880 */ 02881 int iso_read_opts_set_no_joliet(IsoReadOpts *opts, int nojoliet); 02882 02883 /** 02884 * Do not read ISO 9660:1999 enhanced tree 02885 * 02886 * @since 0.6.2 02887 */ 02888 int iso_read_opts_set_no_iso1999(IsoReadOpts *opts, int noiso1999); 02889 02890 /** 02891 * Control reading of AAIP informations about ACL and xattr when loading 02892 * existing images. 02893 * For importing ACL and xattr when inserting nodes from external filesystems 02894 * (e.g. the local POSIX filesystem) see iso_image_set_ignore_aclea(). 02895 * For eventual writing of this information see iso_write_opts_set_aaip(). 02896 * 02897 * @param opts 02898 * The option set to be manipulated 02899 * @param noaaip 02900 * 1 = Do not read AAIP information 02901 * 0 = Read AAIP information if available 02902 * All other values are reserved. 02903 * @since 0.6.14 02904 */ 02905 int iso_read_opts_set_no_aaip(IsoReadOpts *opts, int noaaip); 02906 02907 /** 02908 * Control reading of an array of MD5 checksums which is eventually stored 02909 * at the end of a session. See also iso_write_opts_set_record_md5(). 02910 * Important: Loading of the MD5 array will only work if AAIP is enabled 02911 * because its position and layout is recorded in xattr "isofs.ca". 02912 * 02913 * @param opts 02914 * The option set to be manipulated 02915 * @param no_md5 02916 * 0 = Read MD5 array if available, refuse on non-matching MD5 tags 02917 * 1 = Do not read MD5 checksum array 02918 * 2 = Read MD5 array, but do not check MD5 tags 02919 * @since 1.0.4 02920 * All other values are reserved. 02921 * 02922 * @since 0.6.22 02923 */ 02924 int iso_read_opts_set_no_md5(IsoReadOpts *opts, int no_md5); 02925 02926 02927 /** 02928 * Control discarding of eventual inode numbers from existing images. 02929 * Such numbers may come from RRIP 1.12 entries PX. If not discarded they 02930 * get written unchanged when the file object gets written into an ISO image. 02931 * If this inode number is missing with a file in the imported image, 02932 * or if it has been discarded during image reading, then a unique inode number 02933 * will be generated at some time before the file gets written into an ISO 02934 * image. 02935 * Two image nodes which have the same inode number represent two hardlinks 02936 * of the same file object. So discarding the numbers splits hardlinks. 02937 * 02938 * @param opts 02939 * The option set to be manipulated 02940 * @param new_inos 02941 * 1 = Discard imported inode numbers and finally hand out a unique new 02942 * one to each single file before it gets written into an ISO image. 02943 * 0 = Keep eventual inode numbers from PX entries. 02944 * All other values are reserved. 02945 * @since 0.6.20 02946 */ 02947 int iso_read_opts_set_new_inos(IsoReadOpts *opts, int new_inos); 02948 02949 /** 02950 * Whether to prefer Joliet over RR. libisofs usually prefers RR over 02951 * Joliet, as it give us much more info about files. So, if both extensions 02952 * are present, RR is used. You can set this if you prefer Joliet, but 02953 * note that this is not very recommended. This doesn't mean than RR 02954 * extensions are not read: if no Joliet is present, libisofs will read 02955 * RR tree. 02956 * 02957 * @since 0.6.2 02958 */ 02959 int iso_read_opts_set_preferjoliet(IsoReadOpts *opts, int preferjoliet); 02960 02961 /** 02962 * How to convert file names if neither Rock Ridge nor Joliet names 02963 * are present and acceptable. 02964 * 02965 * @param opts 02966 * The option set to be manipulated 02967 * @param ecma119_map 02968 * The conversion mode to apply: 02969 * 0 = unmapped: Take name as recorded in ECMA-119 directory record 02970 * (not suitable for writing them to a new ISO filesystem) 02971 * 1 = stripped: Like unmapped, but strip off trailing ";1" or ".;1" 02972 * 2 = uppercase: Like stripped, but map {a-z} to {A-Z} 02973 * 3 = lowercase: Like stripped, but map {A-Z} to {a-z} 02974 * @return 02975 * ISO_SUCCESS if ecma119_map was accepted 02976 * 0 if the value was out of range 02977 * < 0 if other error 02978 * 02979 * @since 1.4.2 02980 */ 02981 int iso_read_opts_set_ecma119_map(IsoReadOpts *opts, int ecma119_map); 02982 02983 /** 02984 * Set default uid for files when RR extensions are not present. 02985 * 02986 * @since 0.6.2 02987 */ 02988 int iso_read_opts_set_default_uid(IsoReadOpts *opts, uid_t uid); 02989 02990 /** 02991 * Set default gid for files when RR extensions are not present. 02992 * 02993 * @since 0.6.2 02994 */ 02995 int iso_read_opts_set_default_gid(IsoReadOpts *opts, gid_t gid); 02996 02997 /** 02998 * Set default permissions for files when RR extensions are not present. 02999 * 03000 * @param opts 03001 * The option set to be manipulated 03002 * @param file_perm 03003 * Permissions for files. 03004 * @param dir_perm 03005 * Permissions for directories. 03006 * 03007 * @since 0.6.2 03008 */ 03009 int iso_read_opts_set_default_permissions(IsoReadOpts *opts, mode_t file_perm, 03010 mode_t dir_perm); 03011 03012 /** 03013 * Set the input charset of the file names on the image. NULL to use locale 03014 * charset. You have to specify a charset if the image filenames are encoded 03015 * in a charset different that the local one. This could happen, for example, 03016 * if the image was created on a system with different charset. 03017 * 03018 * @param opts 03019 * The option set to be manipulated 03020 * @param charset 03021 * The charset to use as input charset. You can obtain the list of 03022 * charsets supported on your system executing "iconv -l" in a shell. 03023 * 03024 * @since 0.6.2 03025 */ 03026 int iso_read_opts_set_input_charset(IsoReadOpts *opts, const char *charset); 03027 03028 /** 03029 * Enable or disable methods to automatically choose an input charset. 03030 * This eventually overrides the name set via iso_read_opts_set_input_charset() 03031 * 03032 * @param opts 03033 * The option set to be manipulated 03034 * @param mode 03035 * Bitfield for control purposes: 03036 * bit0= Allow to use the input character set name which is eventually 03037 * stored in attribute "isofs.cs" of the root directory. 03038 * Applications may attach this xattr by iso_node_set_attrs() to 03039 * the root node, call iso_write_opts_set_output_charset() with the 03040 * same name and enable iso_write_opts_set_aaip() when writing 03041 * an image. 03042 * Submit any other bits with value 0. 03043 * 03044 * @since 0.6.18 03045 * 03046 */ 03047 int iso_read_opts_auto_input_charset(IsoReadOpts *opts, int mode); 03048 03049 /** 03050 * Enable or disable loading of the first 32768 bytes of the session. 03051 * 03052 * @param opts 03053 * The option set to be manipulated 03054 * @param mode 03055 * Bitfield for control purposes: 03056 * bit0= Load System Area data and attach them to the image so that they 03057 * get written by the next session, if not overridden by 03058 * iso_write_opts_set_system_area(). 03059 * Submit any other bits with value 0. 03060 * 03061 * @since 0.6.30 03062 * 03063 */ 03064 int iso_read_opts_load_system_area(IsoReadOpts *opts, int mode); 03065 03066 /** 03067 * Control whether to keep a reference to the IsoDataSource object which 03068 * allows access to the blocks of the imported ISO 9660 filesystem. 03069 * This is needed if the interval reader shall read from "imported_iso". 03070 * 03071 * @param opts 03072 * The option set to be manipulated 03073 * @param mode 03074 * Bitfield for control purposes: 03075 * bit0= Keep a reference to the IsoDataSource until the IsoImage object 03076 * gets disposed by its final iso_image_unref(). 03077 * Submit any other bits with value 0. 03078 * 03079 * @since 1.4.0 03080 * 03081 */ 03082 int iso_read_opts_keep_import_src(IsoReadOpts *opts, int mode); 03083 03084 /** 03085 * Import a previous session or image, for growing or modify. 03086 * 03087 * @param image 03088 * The image context to which old image will be imported. Note that all 03089 * files added to image, and image attributes, will be replaced with the 03090 * contents of the old image. 03091 * TODO #00025 support for merging old image files 03092 * @param src 03093 * Data Source from which old image will be read. A extra reference is 03094 * added, so you still need to iso_data_source_unref() yours. 03095 * @param opts 03096 * Options for image import. All needed data will be copied, so you 03097 * can free the given struct once this function returns. 03098 * @param features 03099 * If not NULL, a new IsoReadImageFeatures will be allocated and filled 03100 * with the features of the old image. It should be freed with 03101 * iso_read_image_features_destroy() when no more needed. You can pass 03102 * NULL if you're not interested on them. 03103 * @return 03104 * 1 on success, < 0 on error 03105 * 03106 * @since 0.6.2 03107 */ 03108 int iso_image_import(IsoImage *image, IsoDataSource *src, IsoReadOpts *opts, 03109 IsoReadImageFeatures **features); 03110 03111 /** 03112 * Destroy an IsoReadImageFeatures object obtained with iso_image_import. 03113 * 03114 * @since 0.6.2 03115 */ 03116 void iso_read_image_features_destroy(IsoReadImageFeatures *f); 03117 03118 /** 03119 * Get the size (in 2048 byte block) of the image, as reported in the PVM. 03120 * 03121 * @since 0.6.2 03122 */ 03123 uint32_t iso_read_image_features_get_size(IsoReadImageFeatures *f); 03124 03125 /** 03126 * Whether RockRidge extensions are present in the image imported. 03127 * 03128 * @since 0.6.2 03129 */ 03130 int iso_read_image_features_has_rockridge(IsoReadImageFeatures *f); 03131 03132 /** 03133 * Whether Joliet extensions are present in the image imported. 03134 * 03135 * @since 0.6.2 03136 */ 03137 int iso_read_image_features_has_joliet(IsoReadImageFeatures *f); 03138 03139 /** 03140 * Whether the image is recorded according to ISO 9660:1999, i.e. it has 03141 * a version 2 Enhanced Volume Descriptor. 03142 * 03143 * @since 0.6.2 03144 */ 03145 int iso_read_image_features_has_iso1999(IsoReadImageFeatures *f); 03146 03147 /** 03148 * Whether El-Torito boot record is present present in the image imported. 03149 * 03150 * @since 0.6.2 03151 */ 03152 int iso_read_image_features_has_eltorito(IsoReadImageFeatures *f); 03153 03154 /** 03155 * Increments the reference counting of the given image. 03156 * 03157 * @since 0.6.2 03158 */ 03159 void iso_image_ref(IsoImage *image); 03160 03161 /** 03162 * Decrements the reference couting of the given image. 03163 * If it reaches 0, the image is free, together with its tree nodes (whether 03164 * their refcount reach 0 too, of course). 03165 * 03166 * @since 0.6.2 03167 */ 03168 void iso_image_unref(IsoImage *image); 03169 03170 /** 03171 * Attach user defined data to the image. Use this if your application needs 03172 * to store addition info together with the IsoImage. If the image already 03173 * has data attached, the old data will be freed. 03174 * 03175 * @param image 03176 * The image to which data shall be attached. 03177 * @param data 03178 * Pointer to application defined data that will be attached to the 03179 * image. You can pass NULL to remove any already attached data. 03180 * @param give_up 03181 * Function that will be called when the image does not need the data 03182 * any more. It receives the data pointer as an argumente, and eventually 03183 * causes data to be freed. It can be NULL if you don't need it. 03184 * @return 03185 * 1 on succes, < 0 on error 03186 * 03187 * @since 0.6.2 03188 */ 03189 int iso_image_attach_data(IsoImage *image, void *data, void (*give_up)(void*)); 03190 03191 /** 03192 * The the data previously attached with iso_image_attach_data() 03193 * 03194 * @since 0.6.2 03195 */ 03196 void *iso_image_get_attached_data(IsoImage *image); 03197 03198 /** 03199 * Set the name truncation mode and the maximum name length for nodes from 03200 * image importing, creation of new IsoNode objects, and name changing image 03201 * manipulations. 03202 * 03203 * Truncated names are supposed to be nearly unique because they end by the MD5 03204 * of the first 4095 characters of the untruncated name. One should treat them 03205 * as if they were the untruncated original names. 03206 * 03207 * For proper processing of truncated names it is necessary to use 03208 * iso_image_set_node_name() instead of iso_node_set_name() 03209 * iso_image_add_new_dir() iso_tree_add_new_dir() 03210 * iso_image_add_new_file() iso_tree_add_new_file() 03211 * iso_image_add_new_special() iso_tree_add_new_special() 03212 * iso_image_add_new_symlink() iso_tree_add_new_symlink() 03213 * iso_image_tree_clone() iso_tree_clone() 03214 * iso_image_dir_get_node() iso_dir_get_node() 03215 * iso_image_path_to_node() iso_tree_path_to_node() 03216 * 03217 * Beware of ambiguities if both, the full name and the truncated name, 03218 * exist in the same directory. Best is to only set truncation parameters 03219 * once with an ISO filesystem and to never change them later. 03220 * 03221 * If writing of AAIP is enabled, then the mode and length are recorded in 03222 * xattr "isofs.nt" of the root node. 03223 * If reading of AAIP is enabled and "isofs.nt" is found, then it gets into 03224 * effect if both, the truncate mode value from "isofs.nt" and the current 03225 * truncate mode of the IsoImage are 1, and the length is between 64 and 255. 03226 * 03227 * @param img 03228 * The image which shall be manipulated. 03229 * @param mode 03230 * 0= Do not truncate but throw error ISO_RR_NAME_TOO_LONG if a file name 03231 * is longer than parameter length. 03232 * 1= Truncate to length and overwrite the last 33 bytes of that length 03233 * by a colon ':' and the hex representation of the MD5 of the first 03234 * 4095 bytes of the whole oversized name. 03235 * Potential incomplete UTF-8 characters will get their leading bytes 03236 * replaced by '_'. 03237 * Mode 1 is the default. 03238 * @param length 03239 * Maximum byte count of a file name. Permissible values are 64 to 255. 03240 * Default is 255. 03241 * @return 03242 * ISO_SUCCESS or ISO_WRONG_ARG_VALUE 03243 * 03244 * @since 1.4.2 03245 */ 03246 int iso_image_set_truncate_mode(IsoImage *img, int mode, int length); 03247 03248 /** 03249 * Inquire the current setting of iso_image_set_truncate_mode(). 03250 * 03251 * @param img 03252 * The image which shall be inquired. 03253 * @param mode 03254 * Returns the mode value. 03255 * @param length 03256 * Returns the length value. 03257 * @return 03258 * ISO_SUCCESS or <0 = error 03259 * 03260 * @since 1.4.2 03261 */ 03262 int iso_image_get_truncate_mode(IsoImage *img, int *mode, int *length); 03263 03264 /** 03265 * Immediately apply the given truncate mode and length to the given string. 03266 * 03267 * @param mode 03268 * See iso_image_set_truncate_mode() 03269 * @param length 03270 * See iso_image_set_truncate_mode() 03271 * @param name 03272 * The string to be inspected and truncated if mode says so. 03273 * @param flag 03274 * Bitfield for control purposes. Unused yet. Submit 0. 03275 * @return 03276 * ISO_SUCCESS, ISO_WRONG_ARG_VALUE, ISO_RR_NAME_TOO_LONG 03277 * 03278 * @since 1.4.2 03279 */ 03280 int iso_truncate_leaf_name(int mode, int length, char *name, int flag); 03281 03282 /** 03283 * Get the root directory of the image. 03284 * No extra ref is added to it, so you must not unref it. Use iso_node_ref() 03285 * if you want to get your own reference. 03286 * 03287 * @since 0.6.2 03288 */ 03289 IsoDir *iso_image_get_root(const IsoImage *image); 03290 03291 /** 03292 * Fill in the volset identifier for a image. 03293 * 03294 * @since 0.6.2 03295 */ 03296 void iso_image_set_volset_id(IsoImage *image, const char *volset_id); 03297 03298 /** 03299 * Get the volset identifier. 03300 * The returned string is owned by the image and must not be freed nor 03301 * changed. 03302 * 03303 * @since 0.6.2 03304 */ 03305 const char *iso_image_get_volset_id(const IsoImage *image); 03306 03307 /** 03308 * Fill in the volume identifier for a image. 03309 * 03310 * @since 0.6.2 03311 */ 03312 void iso_image_set_volume_id(IsoImage *image, const char *volume_id); 03313 03314 /** 03315 * Get the volume identifier. 03316 * The returned string is owned by the image and must not be freed nor 03317 * changed. 03318 * 03319 * @since 0.6.2 03320 */ 03321 const char *iso_image_get_volume_id(const IsoImage *image); 03322 03323 /** 03324 * Fill in the publisher for a image. 03325 * 03326 * @since 0.6.2 03327 */ 03328 void iso_image_set_publisher_id(IsoImage *image, const char *publisher_id); 03329 03330 /** 03331 * Get the publisher of a image. 03332 * The returned string is owned by the image and must not be freed nor 03333 * changed. 03334 * 03335 * @since 0.6.2 03336 */ 03337 const char *iso_image_get_publisher_id(const IsoImage *image); 03338 03339 /** 03340 * Fill in the data preparer for a image. 03341 * 03342 * @since 0.6.2 03343 */ 03344 void iso_image_set_data_preparer_id(IsoImage *image, 03345 const char *data_preparer_id); 03346 03347 /** 03348 * Get the data preparer of a image. 03349 * The returned string is owned by the image and must not be freed nor 03350 * changed. 03351 * 03352 * @since 0.6.2 03353 */ 03354 const char *iso_image_get_data_preparer_id(const IsoImage *image); 03355 03356 /** 03357 * Fill in the system id for a image. Up to 32 characters. 03358 * 03359 * @since 0.6.2 03360 */ 03361 void iso_image_set_system_id(IsoImage *image, const char *system_id); 03362 03363 /** 03364 * Get the system id of a image. 03365 * The returned string is owned by the image and must not be freed nor 03366 * changed. 03367 * 03368 * @since 0.6.2 03369 */ 03370 const char *iso_image_get_system_id(const IsoImage *image); 03371 03372 /** 03373 * Fill in the application id for a image. Up to 128 chars. 03374 * 03375 * @since 0.6.2 03376 */ 03377 void iso_image_set_application_id(IsoImage *image, const char *application_id); 03378 03379 /** 03380 * Get the application id of a image. 03381 * The returned string is owned by the image and must not be freed nor 03382 * changed. 03383 * 03384 * @since 0.6.2 03385 */ 03386 const char *iso_image_get_application_id(const IsoImage *image); 03387 03388 /** 03389 * Fill copyright information for the image. Usually this refers 03390 * to a file on disc. Up to 37 characters. 03391 * 03392 * @since 0.6.2 03393 */ 03394 void iso_image_set_copyright_file_id(IsoImage *image, 03395 const char *copyright_file_id); 03396 03397 /** 03398 * Get the copyright information of a image. 03399 * The returned string is owned by the image and must not be freed nor 03400 * changed. 03401 * 03402 * @since 0.6.2 03403 */ 03404 const char *iso_image_get_copyright_file_id(const IsoImage *image); 03405 03406 /** 03407 * Fill abstract information for the image. Usually this refers 03408 * to a file on disc. Up to 37 characters. 03409 * 03410 * @since 0.6.2 03411 */ 03412 void iso_image_set_abstract_file_id(IsoImage *image, 03413 const char *abstract_file_id); 03414 03415 /** 03416 * Get the abstract information of a image. 03417 * The returned string is owned by the image and must not be freed nor 03418 * changed. 03419 * 03420 * @since 0.6.2 03421 */ 03422 const char *iso_image_get_abstract_file_id(const IsoImage *image); 03423 03424 /** 03425 * Fill biblio information for the image. Usually this refers 03426 * to a file on disc. Up to 37 characters. 03427 * 03428 * @since 0.6.2 03429 */ 03430 void iso_image_set_biblio_file_id(IsoImage *image, const char *biblio_file_id); 03431 03432 /** 03433 * Get the biblio information of a image. 03434 * The returned string is owned by the image and must not be freed or changed. 03435 * 03436 * @since 0.6.2 03437 */ 03438 const char *iso_image_get_biblio_file_id(const IsoImage *image); 03439 03440 /** 03441 * Fill Application Use field of the Primary Volume Descriptor. 03442 * ECMA-119 8.4.32 Application Use (BP 884 to 1395) 03443 * "This field shall be reserved for application use. Its content 03444 * is not specified by this Standard." 03445 * 03446 * @param image 03447 * The image to manipulate. 03448 * @param app_use_data 03449 * Up to 512 bytes of data. 03450 * @param count 03451 * The number of bytes in app_use_data. If the number is smaller than 512, 03452 * then the remaining bytes will be set to 0. 03453 * @since 1.3.2 03454 */ 03455 void iso_image_set_app_use(IsoImage *image, const char *app_use_data, 03456 int count); 03457 03458 /** 03459 * Get the current setting for the Application Use field of the Primary Volume 03460 * Descriptor. 03461 * The returned char array of 512 bytes is owned by the image and must not 03462 * be freed or changed. 03463 * 03464 * @param image 03465 * The image to inquire 03466 * @since 1.3.2 03467 */ 03468 const char *iso_image_get_app_use(IsoImage *image); 03469 03470 /** 03471 * Get the four timestamps from the Primary Volume Descriptor of the imported 03472 * ISO image. The timestamps are strings which are either empty or consist 03473 * of 16 digits of the form YYYYMMDDhhmmsscc, plus a signed byte in the range 03474 * of -48 to +52, which gives the timezone offset in steps of 15 minutes. 03475 * None of the returned string pointers shall be used for altering or freeing 03476 * data. They are just for reading. 03477 * 03478 * @param image 03479 * The image to be inquired. 03480 * @param creation_time 03481 * Returns a pointer to the Volume Creation time: 03482 * When "the information in the volume was created." 03483 * @param modification_time 03484 * Returns a pointer to Volume Modification time: 03485 * When "the information in the volume was last modified." 03486 * @param expiration_time 03487 * Returns a pointer to Volume Expiration time: 03488 * When "the information in the volume may be regarded as obsolete." 03489 * @param effective_time 03490 * Returns a pointer to Volume Expiration time: 03491 * When "the information in the volume may be used." 03492 * @return 03493 * ISO_SUCCESS or error 03494 * 03495 * @since 1.2.8 03496 */ 03497 int iso_image_get_pvd_times(IsoImage *image, 03498 char **creation_time, char **modification_time, 03499 char **expiration_time, char **effective_time); 03500 03501 /** 03502 * Create a new set of El-Torito bootable images by adding a boot catalog 03503 * and the default boot image. 03504 * Further boot images may then be added by iso_image_add_boot_image(). 03505 * 03506 * @param image 03507 * The image to make bootable. If it was already bootable this function 03508 * returns an error and the image remains unmodified. 03509 * @param image_path 03510 * The absolute path of a IsoFile to be used as default boot image or 03511 * --interval:appended_partition_$number[_start_$start_size_$size]:... 03512 * if type is ELTORITO_NO_EMUL. $number gives the partition number. 03513 * If _start_$start_size_$size is present, then it overrides the 2 KiB 03514 * start block of the partition and the partition size counted in 03515 * blocks of 512 bytes. 03516 * @param type 03517 * The boot media type. This can be one of 3 types: 03518 * - ELTORITO_FLOPPY_EMUL. 03519 * Floppy emulation: Boot image file must be exactly 03520 * 1200 KiB, 1440 KiB or 2880 KiB. 03521 * - ELTORITO_HARD_DISC_EMUL. 03522 * Hard disc emulation: The image must begin with a master 03523 * boot record with a single image. 03524 * - ELTORITO_NO_EMUL. 03525 * No emulation. You should specify load segment and load size 03526 * of image. 03527 * @param catalog_path 03528 * The absolute path in the image tree where the catalog will be stored. 03529 * The directory component of this path must be a directory existent on 03530 * the image tree, and the filename component must be unique among all 03531 * children of that directory on image. Otherwise a correspodent error 03532 * code will be returned. This function will add an IsoBoot node that acts 03533 * as a placeholder for the real catalog, that will be generated at image 03534 * creation time. 03535 * @param boot 03536 * Location where a pointer to the added boot image will be stored. That 03537 * object is owned by the IsoImage and must not be freed by the user, 03538 * nor dereferenced once the last reference to the IsoImage was disposed 03539 * via iso_image_unref(). A NULL value is allowed if you don't need a 03540 * reference to the boot image. 03541 * @return 03542 * 1 on success, < 0 on error 03543 * 03544 * @since 0.6.2 03545 */ 03546 int iso_image_set_boot_image(IsoImage *image, const char *image_path, 03547 enum eltorito_boot_media_type type, 03548 const char *catalog_path, 03549 ElToritoBootImage **boot); 03550 03551 /** 03552 * Add a further boot image to the set of El-Torito bootable images. 03553 * This set has already to be created by iso_image_set_boot_image(). 03554 * Up to 31 further boot images may be added. 03555 * 03556 * @param image 03557 * The image to which the boot image shall be added. 03558 * returns an error and the image remains unmodified. 03559 * @param image_path 03560 * The absolute path of a IsoFile to be used as boot image or 03561 * --interval:appended_partition_$number[_start_$start_size_$size]:... 03562 * if type is ELTORITO_NO_EMUL. See iso_image_set_boot_image. 03563 * @param type 03564 * The boot media type. See iso_image_set_boot_image. 03565 * @param flag 03566 * Bitfield for control purposes. Unused yet. Submit 0. 03567 * @param boot 03568 * Location where a pointer to the added boot image will be stored. 03569 * See iso_image_set_boot_image 03570 * @return 03571 * 1 on success, < 0 on error 03572 * ISO_BOOT_NO_CATALOG means iso_image_set_boot_image() 03573 * was not called first. 03574 * 03575 * @since 0.6.32 03576 */ 03577 int iso_image_add_boot_image(IsoImage *image, const char *image_path, 03578 enum eltorito_boot_media_type type, int flag, 03579 ElToritoBootImage **boot); 03580 03581 /** 03582 * Get the El-Torito boot catalog and the default boot image of an ISO image. 03583 * 03584 * This can be useful, for example, to check if a volume read from a previous 03585 * session or an existing image is bootable. It can also be useful to get 03586 * the image and catalog tree nodes. An application would want those, for 03587 * example, to prevent the user removing it. 03588 * 03589 * Both nodes are owned by libisofs and must not be freed. You can get your 03590 * own ref with iso_node_ref(). You can also check if the node is already 03591 * on the tree by getting its parent (note that when reading El-Torito info 03592 * from a previous image, the nodes might not be on the tree even if you haven't 03593 * removed them). Remember that you'll need to get a new ref 03594 * (with iso_node_ref()) before inserting them again to the tree, and probably 03595 * you will also need to set the name or permissions. 03596 * 03597 * @param image 03598 * The image from which to get the boot image. 03599 * @param boot 03600 * If not NULL, it will be filled with a pointer to the boot image, if 03601 * any. That object is owned by the IsoImage and must not be freed by 03602 * the user, nor dereferenced once the last reference to the IsoImage was 03603 * disposed via iso_image_unref(). 03604 * @param imgnode 03605 * When not NULL, it will be filled with the image tree node. No extra ref 03606 * is added, you can use iso_node_ref() to get one if you need it. 03607 * The returned value is NULL if the boot image source is no IsoFile. 03608 * @param catnode 03609 * When not NULL, it will be filled with the catnode tree node. No extra 03610 * ref is added, you can use iso_node_ref() to get one if you need it. 03611 * @return 03612 * 1 on success, 0 is the image is not bootable (i.e., it has no El-Torito 03613 * image), < 0 error. 03614 * 03615 * @since 0.6.2 03616 */ 03617 int iso_image_get_boot_image(IsoImage *image, ElToritoBootImage **boot, 03618 IsoFile **imgnode, IsoBoot **catnode); 03619 03620 /** 03621 * Get detailed information about the boot catalog that was loaded from 03622 * an ISO image. 03623 * The boot catalog links the El Torito boot record at LBA 17 with the 03624 * boot images which are IsoFile objects in the image. The boot catalog 03625 * itself is not a regular file and thus will not deliver an IsoStream. 03626 * Its content is usually quite short and can be obtained by this call. 03627 * 03628 * @param image 03629 * The image to inquire. 03630 * @param catnode 03631 * Will return the boot catalog tree node. No extra ref is taken. 03632 * @param lba 03633 * Will return the block address of the boot catalog in the image. 03634 * @param content 03635 * Will return either NULL or an allocated memory buffer with the 03636 * content bytes of the boot catalog. 03637 * Dispose it by free() when no longer needed. 03638 * @param size 03639 * Will return the number of bytes in content. 03640 * @return 03641 * 1 if reply is valid, 0 if not boot catalog was loaded, < 0 on error. 03642 * 03643 * @since 1.1.2 03644 */ 03645 int iso_image_get_bootcat(IsoImage *image, IsoBoot **catnode, uint32_t *lba, 03646 char **content, off_t *size); 03647 03648 03649 /** 03650 * Get all El-Torito boot images of an ISO image. 03651 * 03652 * The first of these boot images is the same as returned by 03653 * iso_image_get_boot_image(). The others are alternative boot images. 03654 * 03655 * @param image 03656 * The image from which to get the boot images. 03657 * @param num_boots 03658 * The number of available array elements in boots and bootnodes. 03659 * @param boots 03660 * Returns NULL or an allocated array of pointers to boot images. 03661 * Apply system call free(boots) to dispose it. 03662 * @param bootnodes 03663 * Returns NULL or an allocated array of pointers to the IsoFile nodes 03664 * which bear the content of the boot images in boots. 03665 * An array entry is NULL if the boot image source is no IsoFile. 03666 03667 >>> Need getter for partition index 03668 03669 * @param flag 03670 * Bitfield for control purposes. Unused yet. Submit 0. 03671 * @return 03672 * 1 on success, 0 no El-Torito catalog and boot image attached, 03673 * < 0 error. 03674 * 03675 * @since 0.6.32 03676 */ 03677 int iso_image_get_all_boot_imgs(IsoImage *image, int *num_boots, 03678 ElToritoBootImage ***boots, IsoFile ***bootnodes, int flag); 03679 03680 03681 /** 03682 * Removes all El-Torito boot images from the ISO image. 03683 * 03684 * The IsoBoot node that acts as placeholder for the catalog is also removed 03685 * for the image tree, if there. 03686 * If the image is not bootable (don't have el-torito boot image) this function 03687 * just returns. 03688 * 03689 * @since 0.6.2 03690 */ 03691 void iso_image_remove_boot_image(IsoImage *image); 03692 03693 /** 03694 * Sets the sort weight of the boot catalog that is attached to an IsoImage. 03695 * 03696 * For the meaning of sort weights see iso_node_set_sort_weight(). 03697 * That function cannot be applied to the emerging boot catalog because 03698 * it is not represented by an IsoFile. 03699 * 03700 * @param image 03701 * The image to manipulate. 03702 * @param sort_weight 03703 * The larger this value, the lower will be the block address of the 03704 * boot catalog record. 03705 * @return 03706 * 0= no boot catalog attached , 1= ok , <0 = error 03707 * 03708 * @since 0.6.32 03709 */ 03710 int iso_image_set_boot_catalog_weight(IsoImage *image, int sort_weight); 03711 03712 /** 03713 * Hides the boot catalog file from directory trees. 03714 * 03715 * For the meaning of hiding files see iso_node_set_hidden(). 03716 * 03717 * 03718 * @param image 03719 * The image to manipulate. 03720 * @param hide_attrs 03721 * Or-combination of values from enum IsoHideNodeFlag to set the trees 03722 * in which the record. 03723 * @return 03724 * 0= no boot catalog attached , 1= ok , <0 = error 03725 * 03726 * @since 0.6.34 03727 */ 03728 int iso_image_set_boot_catalog_hidden(IsoImage *image, int hide_attrs); 03729 03730 03731 /** 03732 * Get the boot media type as of parameter "type" of iso_image_set_boot_image() 03733 * or iso_image_add_boot_image(). 03734 * 03735 * @param bootimg 03736 * The image to inquire 03737 * @param media_type 03738 * Returns the media type 03739 * @return 03740 * 1 = ok , < 0 = error 03741 * 03742 * @since 0.6.32 03743 */ 03744 int el_torito_get_boot_media_type(ElToritoBootImage *bootimg, 03745 enum eltorito_boot_media_type *media_type); 03746 03747 /** 03748 * Sets the platform ID of the boot image. 03749 * 03750 * The Platform ID gets written into the boot catalog at byte 1 of the 03751 * Validation Entry, or at byte 1 of a Section Header Entry. 03752 * If Platform ID and ID String of two consequtive bootimages are the same 03753 * 03754 * @param bootimg 03755 * The image to manipulate. 03756 * @param id 03757 * A Platform ID as of 03758 * El Torito 1.0 : 0x00= 80x86, 0x01= PowerPC, 0x02= Mac 03759 * Others : 0xef= EFI 03760 * @return 03761 * 1 ok , <=0 error 03762 * 03763 * @since 0.6.32 03764 */ 03765 int el_torito_set_boot_platform_id(ElToritoBootImage *bootimg, uint8_t id); 03766 03767 /** 03768 * Get the platform ID value. See el_torito_set_boot_platform_id(). 03769 * 03770 * @param bootimg 03771 * The image to inquire 03772 * @return 03773 * 0 - 255 : The platform ID 03774 * < 0 : error 03775 * 03776 * @since 0.6.32 03777 */ 03778 int el_torito_get_boot_platform_id(ElToritoBootImage *bootimg); 03779 03780 /** 03781 * Sets the load segment for the initial boot image. This is only for 03782 * no emulation boot images, and is a NOP for other image types. 03783 * 03784 * @param bootimg 03785 * The image to to manipulate 03786 * @param segment 03787 * Load segment address. 03788 * The data type of this parameter is not fully suitable. You may submit 03789 * negative numbers in the range ((short) 0x8000) to ((short) 0xffff) 03790 * in order to express the non-negative numbers 0x8000 to 0xffff. 03791 * 03792 * @since 0.6.2 03793 */ 03794 void el_torito_set_load_seg(ElToritoBootImage *bootimg, short segment); 03795 03796 /** 03797 * Get the load segment value. See el_torito_set_load_seg(). 03798 * 03799 * @param bootimg 03800 * The image to inquire 03801 * @return 03802 * 0 - 65535 : The load segment value 03803 * < 0 : error 03804 * 03805 * @since 0.6.32 03806 */ 03807 int el_torito_get_load_seg(ElToritoBootImage *bootimg); 03808 03809 /** 03810 * Sets the number of sectors (512b) to be load at load segment during 03811 * the initial boot procedure. This is only for 03812 * no emulation boot images, and is a NOP for other image types. 03813 * 03814 * @param bootimg 03815 * The image to to manipulate 03816 * @param sectors 03817 * Number of 512-byte blocks to be loaded by the BIOS. 03818 * The data type of this parameter is not fully suitable. You may submit 03819 * negative numbers in the range ((short) 0x8000) to ((short) 0xffff) 03820 * in order to express the non-negative numbers 0x8000 to 0xffff. 03821 * 03822 * @since 0.6.2 03823 */ 03824 void el_torito_set_load_size(ElToritoBootImage *bootimg, short sectors); 03825 03826 /** 03827 * Get the load size. See el_torito_set_load_size(). 03828 * 03829 * @param bootimg 03830 * The image to inquire 03831 * @return 03832 * 0 - 65535 : The load size value 03833 * < 0 : error 03834 * 03835 * @since 0.6.32 03836 */ 03837 int el_torito_get_load_size(ElToritoBootImage *bootimg); 03838 03839 /** 03840 * Marks the specified boot image as not bootable 03841 * 03842 * @since 0.6.2 03843 */ 03844 void el_torito_set_no_bootable(ElToritoBootImage *bootimg); 03845 03846 /** 03847 * Get the bootability flag. See el_torito_set_no_bootable(). 03848 * 03849 * @param bootimg 03850 * The image to inquire 03851 * @return 03852 * 0 = not bootable, 1 = bootable , <0 = error 03853 * 03854 * @since 0.6.32 03855 */ 03856 int el_torito_get_bootable(ElToritoBootImage *bootimg); 03857 03858 /** 03859 * Set the id_string of the Validation Entry or Sector Header Entry which 03860 * will govern the boot image Section Entry in the El Torito Catalog. 03861 * 03862 * @param bootimg 03863 * The image to manipulate. 03864 * @param id_string 03865 * The first boot image puts 24 bytes of ID string into the Validation 03866 * Entry, where they shall "identify the manufacturer/developer of 03867 * the CD-ROM". 03868 * Further boot images put 28 bytes into their Section Header. 03869 * El Torito 1.0 states that "If the BIOS understands the ID string, it 03870 * may choose to boot the system using one of these entries in place 03871 * of the INITIAL/DEFAULT entry." (The INITIAL/DEFAULT entry points to the 03872 * first boot image.) 03873 * @return 03874 * 1 = ok , <0 = error 03875 * 03876 * @since 0.6.32 03877 */ 03878 int el_torito_set_id_string(ElToritoBootImage *bootimg, uint8_t id_string[28]); 03879 03880 /** 03881 * Get the id_string as of el_torito_set_id_string(). 03882 * 03883 * @param bootimg 03884 * The image to inquire 03885 * @param id_string 03886 * Returns 28 bytes of id string 03887 * @return 03888 * 1 = ok , <0 = error 03889 * 03890 * @since 0.6.32 03891 */ 03892 int el_torito_get_id_string(ElToritoBootImage *bootimg, uint8_t id_string[28]); 03893 03894 /** 03895 * Set the Selection Criteria of a boot image. 03896 * 03897 * @param bootimg 03898 * The image to manipulate. 03899 * @param crit 03900 * The first boot image has no selection criteria. They will be ignored. 03901 * Further boot images put 1 byte of Selection Criteria Type and 19 03902 * bytes of data into their Section Entry. 03903 * El Torito 1.0 states that "The format of the selection criteria is 03904 * a function of the BIOS vendor. In the case of a foreign language 03905 * BIOS three bytes would be used to identify the language". 03906 * Type byte == 0 means "no criteria", 03907 * type byte == 1 means "Language and Version Information (IBM)". 03908 * @return 03909 * 1 = ok , <0 = error 03910 * 03911 * @since 0.6.32 03912 */ 03913 int el_torito_set_selection_crit(ElToritoBootImage *bootimg, uint8_t crit[20]); 03914 03915 /** 03916 * Get the Selection Criteria bytes as of el_torito_set_selection_crit(). 03917 * 03918 * @param bootimg 03919 * The image to inquire 03920 * @param crit 03921 * Returns 20 bytes of type and data 03922 * @return 03923 * 1 = ok , <0 = error 03924 * 03925 * @since 0.6.32 03926 */ 03927 int el_torito_get_selection_crit(ElToritoBootImage *bootimg, uint8_t crit[20]); 03928 03929 03930 /** 03931 * Makes a guess whether the boot image was patched by a boot information 03932 * table. It is advisable to patch such boot images if their content gets 03933 * copied to a new location. See el_torito_set_isolinux_options(). 03934 * Note: The reply can be positive only if the boot image was imported 03935 * from an existing ISO image. 03936 * 03937 * @param bootimg 03938 * The image to inquire 03939 * @param flag 03940 * Bitfield for control purposes: 03941 * bit0 - bit3= mode 03942 * 0 = inquire for classic boot info table as described in man mkisofs 03943 * @since 0.6.32 03944 * 1 = inquire for GRUB2 boot info as of bit9 of options of 03945 * el_torito_set_isolinux_options() 03946 * @since 1.3.0 03947 * @return 03948 * 1 = seems to contain the inquired boot info, 0 = quite surely not 03949 * @since 0.6.32 03950 */ 03951 int el_torito_seems_boot_info_table(ElToritoBootImage *bootimg, int flag); 03952 03953 /** 03954 * Specifies options for ISOLINUX or GRUB boot images. This should only be used 03955 * if the type of boot image is known. 03956 * 03957 * @param bootimg 03958 * The image to set options on 03959 * @param options 03960 * bitmask style flag. The following values are defined: 03961 * 03962 * bit0= Patch the boot info table of the boot image. 03963 * This does the same as mkisofs option -boot-info-table. 03964 * Needed for ISOLINUX or GRUB boot images with platform ID 0. 03965 * The table is located at byte 8 of the boot image file. 03966 * Its size is 56 bytes. 03967 * The original boot image file on disk will not be modified. 03968 * 03969 * One may use el_torito_seems_boot_info_table() for a 03970 * qualified guess whether a boot info table is present in 03971 * the boot image. If the result is 1 then it should get bit0 03972 * set if its content gets copied to a new LBA. 03973 * 03974 * bit1= Generate a ISOLINUX isohybrid image with MBR. 03975 * ---------------------------------------------------------- 03976 * @deprecated since 31 Mar 2010: 03977 * The author of syslinux, H. Peter Anvin requested that this 03978 * feature shall not be used any more. He intends to cease 03979 * support for the MBR template that is included in libisofs. 03980 * ---------------------------------------------------------- 03981 * A hybrid image is a boot image that boots from either 03982 * CD/DVD media or from disk-like media, e.g. USB stick. 03983 * For that you need isolinux.bin from SYSLINUX 3.72 or later. 03984 * IMPORTANT: The application has to take care that the image 03985 * on media gets padded up to the next full MB. 03986 * Under seiveral circumstances it might get aligned 03987 * automatically. But there is no warranty. 03988 * bit2-7= Mentioning in isohybrid GPT 03989 * 0= Do not mention in GPT 03990 * 1= Mention as Basic Data partition. 03991 * This cannot be combined with GPT partitions as of 03992 * iso_write_opts_set_efi_bootp() 03993 * @since 1.2.4 03994 * 2= Mention as HFS+ partition. 03995 * This cannot be combined with HFS+ production by 03996 * iso_write_opts_set_hfsplus(). 03997 * @since 1.2.4 03998 * Primary GPT and backup GPT get written if at least one 03999 * ElToritoBootImage shall be mentioned. 04000 * The first three mentioned GPT partitions get mirrored in the 04001 * the partition table of the isohybrid MBR. They get type 0xfe. 04002 * The MBR partition entry for PC-BIOS gets type 0x00 rather 04003 * than 0x17. 04004 * Often it is one of the further MBR partitions which actually 04005 * gets used by EFI. 04006 * @since 1.2.4 04007 * bit8= Mention in isohybrid Apple partition map 04008 * APM get written if at least one ElToritoBootImage shall be 04009 * mentioned. The ISOLINUX MBR must look suitable or else an error 04010 * event will happen at image generation time. 04011 * @since 1.2.4 04012 * bit9= GRUB2 boot info 04013 * Patch the boot image file at byte 1012 with the 512-block 04014 * address + 2. Two little endian 32-bit words. Low word first. 04015 * This is combinable with bit0. 04016 * @since 1.3.0 04017 * @param flag 04018 * Reserved for future usage, set to 0. 04019 * @return 04020 * 1 success, < 0 on error 04021 * @since 0.6.12 04022 */ 04023 int el_torito_set_isolinux_options(ElToritoBootImage *bootimg, 04024 int options, int flag); 04025 04026 /** 04027 * Get the options as of el_torito_set_isolinux_options(). 04028 * 04029 * @param bootimg 04030 * The image to inquire 04031 * @param flag 04032 * Reserved for future usage, set to 0. 04033 * @return 04034 * >= 0 returned option bits , <0 = error 04035 * 04036 * @since 0.6.32 04037 */ 04038 int el_torito_get_isolinux_options(ElToritoBootImage *bootimg, int flag); 04039 04040 /** Deprecated: 04041 * Specifies that this image needs to be patched. This involves the writing 04042 * of a 16 bytes boot information table at offset 8 of the boot image file. 04043 * The original boot image file won't be modified. 04044 * This is needed for isolinux boot images. 04045 * 04046 * @since 0.6.2 04047 * @deprecated Use el_torito_set_isolinux_options() instead 04048 */ 04049 void el_torito_patch_isolinux_image(ElToritoBootImage *bootimg); 04050 04051 /** 04052 * Obtain a copy of the eventually loaded first 32768 bytes of the imported 04053 * session, the System Area. 04054 * It will be written to the start of the next session unless it gets 04055 * overwritten by iso_write_opts_set_system_area(). 04056 * 04057 * @param img 04058 * The image to be inquired. 04059 * @param data 04060 * A byte array of at least 32768 bytes to take the loaded bytes. 04061 * @param options 04062 * The option bits which will be applied if not overridden by 04063 * iso_write_opts_set_system_area(). See there. 04064 * @param flag 04065 * Bitfield for control purposes, unused yet, submit 0 04066 * @return 04067 * 1 on success, 0 if no System Area was loaded, < 0 error. 04068 * @since 0.6.30 04069 */ 04070 int iso_image_get_system_area(IsoImage *img, char data[32768], 04071 int *options, int flag); 04072 04073 /** 04074 * The maximum length of a single line in the output of function 04075 * iso_image_report_system_area() and iso_image_report_el_torito(). 04076 * This number includes the trailing 0. 04077 * @since 1.3.8 04078 */ 04079 #define ISO_MAX_SYSAREA_LINE_LENGTH 4096 04080 04081 /** 04082 * Texts which describe the output format of iso_image_report_system_area(). 04083 * They are publicly defined here only as part of the API description. 04084 * Do not use these macros in your application but rather call 04085 * iso_image_report_system_area() with flag bit0. 04086 */ 04087 #define ISO_SYSAREA_REPORT_DOC \ 04088 \ 04089 "Report format for recognized System Area data.", \ 04090 "", \ 04091 "No text will be reported if no System Area was loaded or if it was", \ 04092 "entirely filled with 0-bytes.", \ 04093 "Else there will be at least these three lines:", \ 04094 " System area options: hex", \ 04095 " see libisofs.h, parameter of iso_write_opts_set_system_area().", \ 04096 " System area summary: word ... word", \ 04097 " human readable interpretation of system area options and other info", \ 04098 " The words are from the set:", \ 04099 " { MBR, CHRP, PReP, GPT, APM, MIPS-Big-Endian, MIPS-Little-Endian,", \ 04100 " SUN-SPARC-Disk-Label, HP-PA-PALO, DEC-Alpha, ", \ 04101 " protective-msdos-label, isohybrid, grub2-mbr,", \ 04102 " cyl-align-{auto,on,off,all}, not-recognized, }", \ 04103 " The acronyms indicate boot data for particular hardware/firmware.", \ 04104 " protective-msdos-label is an MBR conformant to specs of GPT.", \ 04105 " isohybrid is an MBR implementing ISOLINUX isohybrid functionality.", \ 04106 " grub2-mbr is an MBR with GRUB2 64 bit address patching.", \ 04107 " cyl-align-on indicates that the ISO image MBR partition ends at a", \ 04108 " cylinder boundary. cyl-align-all means that more MBR partitions", \ 04109 " exist and all end at a cylinder boundary.", \ 04110 " not-recognized tells about unrecognized non-zero system area data.", \ 04111 " ISO image size/512 : decimal", \ 04112 " size of ISO image in block units of 512 bytes.", \ 04113 "" 04114 #define ISO_SYSAREA_REPORT_DOC_MBR \ 04115 \ 04116 "If an MBR is detected, with at least one partition entry of non-zero size,", \ 04117 "then there may be:", \ 04118 " Partition offset : decimal", \ 04119 " if not 0 then a second ISO 9660 superblock was found to which", \ 04120 " MBR partition 1 or GPT partition 1 is pointing.", \ 04121 " MBR heads per cyl : decimal", \ 04122 " conversion factor between MBR C/H/S address and LBA. 0=inconsistent.", \ 04123 " MBR secs per head : decimal", \ 04124 " conversion factor between MBR C/H/S address and LBA. 0=inconsistent.", \ 04125 " MBR partition table: N Status Type Start Blocks", \ 04126 " headline for MBR partition table.", \ 04127 " MBR partition : X hex hex decimal decimal", \ 04128 " gives partition number, status byte, type byte, start block,", \ 04129 " and number of blocks. 512 bytes per block.", \ 04130 " MBR partition path : X path", \ 04131 " the path of a file in the ISO image which begins at the partition", \ 04132 " start block of partition X.", \ 04133 " PReP boot partition: decimal decimal", \ 04134 " gives start block and size of a PReP boot partition in ISO 9660", \ 04135 " block units of 2048 bytes.", \ 04136 "" 04137 #define ISO_SYSAREA_REPORT_DOC_GPT1 \ 04138 \ 04139 "GUID Partition Table can coexist with MBR:", \ 04140 " GPT : N Info", \ 04141 " headline for GPT partition table. The fields are too wide for a", \ 04142 " neat table. So they are listed with a partition number and a text.", \ 04143 " GPT CRC should be : <hex> to match first 92 GPT header block bytes", \ 04144 " GPT CRC found : <hex> matches all 512 bytes of GPT header block", \ 04145 " libisofs-1.2.4 to 1.2.8 had a bug with the GPT header CRC. So", \ 04146 " libisofs is willing to recognize GPT with the buggy CRC. These", \ 04147 " two lines inform that most partition editors will not accept it.", \ 04148 " GPT array CRC wrong: should be <hex>, found <hex>", \ 04149 " GPT entry arrays are accepted even if their CRC does not match.", \ 04150 " In this case, both CRCs are reported by this line.", \ 04151 " GPT backup problems: text", \ 04152 " reports about inconsistencies between main GPT and backup GPT.", \ 04153 " The statements are comma separated:", \ 04154 " Implausible header LBA <decimal>", \ 04155 " Cannot read header block at 2k LBA <decimal>", \ 04156 " Not a GPT 1.0 header of 92 bytes for 128 bytes per entry", \ 04157 " Head CRC <hex> wrong. Should be <hex>", \ 04158 " Head CRC <hex> wrong. Should be <hex>. Matches all 512 block bytes", \ 04159 " Disk GUID differs (<hex_digits>)", \ 04160 " Cannot read array block at 2k LBA <decimal>", \ 04161 " Array CRC <hex> wrong. Should be <hex>", \ 04162 " Entries differ for partitions <decimal> [... <decimal>]", \ 04163 " GPT disk GUID : hex_digits", \ 04164 " 32 hex digits giving the byte string of the disk's GUID", \ 04165 " GPT entry array : decimal decimal word", \ 04166 " start block of partition entry array and number of entries. 512 bytes", \ 04167 " per block. The word may be \"separated\" if partitions are disjoint,", \ 04168 " \"overlapping\" if they are not. In future there may be \"nested\"", \ 04169 " as special case where all overlapping partitions are superset and", \ 04170 " subset, and \"covering\" as special case of disjoint partitions", \ 04171 " covering the whole GPT block range for partitions.", \ 04172 " GPT lba range : decimal decimal decimal", \ 04173 " addresses of first payload block, last payload block, and of the", \ 04174 " GPT backup header block. 512 bytes per block." \ 04175 04176 #define ISO_SYSAREA_REPORT_DOC_GPT2 \ 04177 \ 04178 " GPT partition name : X hex_digits", \ 04179 " up to 144 hex digits giving the UTF-16LE name byte string of", \ 04180 " partition X. Trailing 16 bit 0-characters are omitted.", \ 04181 " GPT partname local : X text", \ 04182 " the name of partition X converted to the local character set.", \ 04183 " This line may be missing if the name cannot be converted, or is", \ 04184 " empty.", \ 04185 " GPT partition GUID : X hex_digits", \ 04186 " 32 hex digits giving the byte string of the GUID of partition X.", \ 04187 " GPT type GUID : X hex_digits", \ 04188 " 32 hex digits giving the byte string of the type GUID of partition X.", \ 04189 " GPT partition flags: X hex", \ 04190 " 64 flag bits of partition X in hex representation.", \ 04191 " Known bit meanings are:", \ 04192 " bit0 = \"System Partition\" Do not alter.", \ 04193 " bit2 = Legacy BIOS bootable (MBR partition type 0x80)", \ 04194 " bit60= read-only", \ 04195 " GPT start and size : X decimal decimal", \ 04196 " start block and number of blocks of partition X. 512 bytes per block.", \ 04197 " GPT partition path : X path", \ 04198 " the path of a file in the ISO image which begins at the partition", \ 04199 " start block of partition X.", \ 04200 "" 04201 #define ISO_SYSAREA_REPORT_DOC_APM \ 04202 \ 04203 "Apple partition map can coexist with MBR and GPT:", \ 04204 " APM : N Info", \ 04205 " headline for human readers.", \ 04206 " APM block size : decimal", \ 04207 " block size of Apple Partition Map. 512 or 2048. This applies to", \ 04208 " start address and size of all partitions in the APM.", \ 04209 " APM gap fillers : decimal", \ 04210 " tells the number of partitions with name \"Gap[0-9[0-9]]\" and type", \ 04211 " \"ISO9660_data\".", \ 04212 " APM partition name : X text", \ 04213 " the name of partition X. Up to 32 characters.", \ 04214 " APM partition type : X text", \ 04215 " the type string of partition X. Up to 32 characters.", \ 04216 " APM start and size : X decimal decimal", \ 04217 " start block and number of blocks of partition X.", \ 04218 " APM partition path : X path", \ 04219 " the path of a file in the ISO image which begins at the partition", \ 04220 " start block of partition X.", \ 04221 "" 04222 #define ISO_SYSAREA_REPORT_DOC_MIPS \ 04223 \ 04224 "If a MIPS Big Endian Volume Header is detected, there may be:", \ 04225 " MIPS-BE volume dir : N Name Block Bytes", \ 04226 " headline for human readers.", \ 04227 " MIPS-BE boot entry : X upto8chr decimal decimal", \ 04228 " tells name, 512-byte block address, and byte count of boot entry X.", \ 04229 " MIPS-BE boot path : X path", \ 04230 " tells the path to the boot image file in the ISO image which belongs", \ 04231 " to the block address given by boot entry X.", \ 04232 "", \ 04233 "If a DEC Boot Block for MIPS Little Endian is detected, there may be:", \ 04234 " MIPS-LE boot map : LoadAddr ExecAddr SegmentSize SegmentStart", \ 04235 " headline for human readers.", \ 04236 " MIPS-LE boot params: decimal decimal decimal decimal", \ 04237 " tells four numbers which are originally derived from the ELF header", \ 04238 " of the boot file. The first two are counted in bytes, the other two", \ 04239 " are counted in blocks of 512 bytes.", \ 04240 " MIPS-LE boot path : path", \ 04241 " tells the path to the boot file in the ISO image which belongs to the", \ 04242 " address given by SegmentStart.", \ 04243 " MIPS-LE elf offset : decimal", \ 04244 " tells the relative 512-byte block offset inside the boot file:", \ 04245 " SegmentStart - FileStartBlock", \ 04246 "" 04247 #define ISO_SYSAREA_REPORT_DOC_SUN \ 04248 \ 04249 "If a SUN SPARC Disk Label is present:", \ 04250 " SUN SPARC disklabel: text", \ 04251 " tells the disk label text.", \ 04252 " SUN SPARC secs/head: decimal", \ 04253 " tells the number of sectors per head.", \ 04254 " SUN SPARC heads/cyl: decimal", \ 04255 " tells the number of heads per cylinder.", \ 04256 " SUN SPARC partmap : N IdTag Perms StartCyl NumBlock", \ 04257 " headline for human readers.", \ 04258 " SUN SPARC partition: X hex hex decimal decimal", \ 04259 " gives partition number, type word, permission word, start cylinder,", \ 04260 " and number of of blocks. 512 bytes per block. Type word may be: ", \ 04261 " 0=unused, 2=root partition with boot, 4=user partition.", \ 04262 " Permission word is 0x10 = read-only.", \ 04263 " SPARC GRUB2 core : decimal decimal", \ 04264 " tells byte address and byte count of the GRUB2 SPARC core file.", \ 04265 " SPARC GRUB2 path : path", \ 04266 " tells the path to the data file in the ISO image which belongs to the", \ 04267 " address given by core.", \ 04268 "" 04269 #define ISO_SYSAREA_REPORT_DOC_HPPA \ 04270 \ 04271 "If a HP-PA PALO boot sector version 4 or 5 is present:", \ 04272 " PALO header version: decimal", \ 04273 " tells the PALO header version: 4 or 5.", \ 04274 " HP-PA cmdline : text", \ 04275 " tells the command line for the kernels.", \ 04276 " HP-PA boot files : ByteAddr ByteSize Path", \ 04277 " headline for human readers.", \ 04278 " HP-PA 32-bit kernel: decimal decimal path", \ 04279 " tells start byte, byte count, and file path of the 32-bit kernel.", \ 04280 " HP-PA 64-bit kernel: decimal decimal path", \ 04281 " tells the same for the 64-bit kernel.", \ 04282 " HP-PA ramdisk : decimal decimal path", \ 04283 " tells the same for the ramdisk file.", \ 04284 " HP-PA bootloader : decimal decimal path", \ 04285 " tells the same for the bootloader file.", \ 04286 "" 04287 #define ISO_SYSAREA_REPORT_DOC_ALPHA \ 04288 "If a DEC Alpha SRM boot sector is present:", \ 04289 " DEC Alpha ldr size : decimal", \ 04290 " tells the number of 512-byte blocks in DEC Alpha Secondary Bootstrap", \ 04291 " Loader file.", \ 04292 " DEC Alpha ldr adr : decimal", \ 04293 " tells the start of the loader file in units of 512-byte blocks.", \ 04294 " DEC Alpha ldr path : path", \ 04295 " tells the path of a file in the ISO image which starts at the loader", \ 04296 " start address." 04297 04298 /** 04299 * Obtain an array of texts describing the detected properties of the 04300 * eventually loaded System Area. 04301 * The array will be NULL if no System Area was loaded. It will be non-NULL 04302 * with zero line count if the System Area was loaded and contains only 04303 * 0-bytes. 04304 * Else it will consist of lines as described in ISO_SYSAREA_REPORT_DOC above. 04305 * 04306 * File paths and other long texts are reported as "(too long to show here)" 04307 * if their length plus preceding text plus trailing 0-byte exceeds the 04308 * line length limit of ISO_MAX_SYSAREA_LINE_LENGTH bytes. 04309 * Texts which may contain whitespace or unprintable characters will start 04310 * at fixed positions and extend to the end of the line. 04311 * Note that newline characters may well appearing in the middle of a "line". 04312 * 04313 * @param image 04314 * The image to be inquired. 04315 * @param reply 04316 * Will return an array of pointers to the result text lines or NULL. 04317 * Dispose a non-NULL reply by a call to iso_image_report_system_area() 04318 * with flag bit15, when no longer needed. 04319 * Be prepared for a long text with up to ISO_MAX_SYSAREA_LINE_LENGTH 04320 * characters per line. 04321 * @param line_count 04322 * Will return the number of valid pointers in reply. 04323 * @param flag 04324 * Bitfield for control purposes 04325 * bit0= do not report system area but rather reply a copy of 04326 * above text line arrays ISO_SYSAREA_REPORT_DOC*. 04327 * With this bit it is permissible to submit image as NULL. 04328 * bit15= dispose result from previous call. 04329 * @return 04330 * 1 on success, 0 if no System Area was loaded, < 0 error. 04331 * @since 1.3.8 04332 */ 04333 int iso_image_report_system_area(IsoImage *image, 04334 char ***reply, int *line_count, int flag); 04335 04336 /** 04337 * Text which describes the output format of iso_image_report_el_torito(). 04338 * It is publicly defined here only as part of the API description. 04339 * Do not use it as macro in your application but rather call 04340 * iso_image_report_el_torito() with flag bit0. 04341 */ 04342 #define ISO_ELTORITO_REPORT_DOC \ 04343 "Report format for recognized El Torito boot information.", \ 04344 "", \ 04345 "No text will be reported if no El Torito information was found.", \ 04346 "Else there will be at least these three lines", \ 04347 " El Torito catalog : decimal decimal", \ 04348 " tells the block address and number of 2048-blocks of the boot catalog.", \ 04349 " El Torito images : N Pltf B Emul Ld_seg Hdpt Ldsiz LBA", \ 04350 " is the headline of the boot image list.", \ 04351 " El Torito boot img : X word char word hex hex decimal decimal", \ 04352 " tells about boot image number X:", \ 04353 " - Platform Id: \"BIOS\", \"PPC\", \"Mac\", \"UEFI\" or a hex number.", \ 04354 " - Bootability: either \"y\" or \"n\".", \ 04355 " - Emulation: \"none\", \"fd1.2\", \"fd1.4\", \"fd2.8\", \"hd\"", \ 04356 " for no emulation, three floppy MB sizes, hard disk.", \ 04357 " - Load Segment: start offset in boot image. 0x0000 means 0x07c0.", \ 04358 " - Hard disk emulation partition type: MBR partition type code.", \ 04359 " - Load size: number of 512-blocks to load with emulation mode \"none\".", \ 04360 " - LBA: start block number in ISO filesystem (2048-block).", \ 04361 "", \ 04362 "The following lines appear conditionally:", \ 04363 " El Torito cat path : iso_rr_path", \ 04364 " tells the path to the data file in the ISO image which belongs to", \ 04365 " the block address where the boot catalog starts.", \ 04366 " (This line is not reported if no path points to that block.)", \ 04367 " El Torito img path : X iso_rr_path", \ 04368 " tells the path to the data file in the ISO image which belongs to", \ 04369 " the block address given by LBA of boot image X.", \ 04370 " (This line is not reported if no path points to that block.)", \ 04371 " El Torito img opts : X word ... word", \ 04372 " tells the presence of extra features:", \ 04373 " \"boot-info-table\" image got boot info table patching.", \ 04374 " \"isohybrid-suitable\" image is suitable for ISOLINUX isohybrid MBR.", \ 04375 " \"grub2-boot-info\" image got GRUB2 boot info patching.", \ 04376 " (This line is not reported if no such options were detected.)", \ 04377 " El Torito id string: X hex_digits", \ 04378 " tells the id string of the catalog section which hosts boot image X.", \ 04379 " (This line is not reported if the id string is all zero.)", \ 04380 " El Torito sel crit : X hex_digits", \ 04381 " tells the selection criterion of boot image X.", \ 04382 " (This line is not reported if the criterion is all zero.)", \ 04383 " El Torito img blks : X decimal", \ 04384 " gives an upper limit of the number of 2048-blocks in the boot image", \ 04385 " if it is not accessible via a path in the ISO directory tree.", \ 04386 " The boot image is supposed to end before the start block of any", \ 04387 " other entity of the ISO filesystem.", \ 04388 " (This line is not reported if no limiting entity is found.)", \ 04389 "" 04390 04391 /** 04392 * Obtain an array of texts describing the detected properties of the 04393 * eventually loaded El Torito boot information. 04394 * The array will be NULL if no El Torito info was loaded. 04395 * Else it will consist of lines as described in ISO_ELTORITO_REPORT_DOC above. 04396 * 04397 * The lines have the same length restrictions and whitespace rules as the ones 04398 * returned by iso_image_report_system_area(). 04399 * 04400 * @param image 04401 * The image to be inquired. 04402 * @param reply 04403 * Will return an array of pointers to the result text lines or NULL. 04404 * Dispose a non-NULL reply by a call to iso_image_report_el_torito() 04405 * with flag bit15, when no longer needed. 04406 * Be prepared for a long text with up to ISO_MAX_SYSAREA_LINE_LENGTH 04407 * characters per line. 04408 * @param line_count 04409 * Will return the number of valid pointers in reply. 04410 * @param flag 04411 * Bitfield for control purposes 04412 * bit0= do not report system area but rather reply a copy of 04413 * above text line array ISO_ELTORITO_REPORT_DOC. 04414 * With this bit it is permissible to submit image as NULL. 04415 * bit15= dispose result from previous call. 04416 * @return 04417 * 1 on success, 0 if no El Torito information was loaded, < 0 error. 04418 * @since 1.3.8 04419 */ 04420 int iso_image_report_el_torito(IsoImage *image, 04421 char ***reply, int *line_count, int flag); 04422 04423 04424 /** 04425 * Compute a CRC number as expected in the GPT main and backup header blocks. 04426 * 04427 * The CRC at byte offset 88 is supposed to cover the array of partition 04428 * entries. 04429 * The CRC at byte offset 16 is supposed to cover the readily produced 04430 * first 92 bytes of the header block while its bytes 16 to 19 are still 04431 * set to 0. 04432 * Block size is 512 bytes. Numbers are stored little-endian. 04433 * See doc/boot_sectors.txt for the byte layout of GPT. 04434 * 04435 * This might be helpful for applications which want to manipulate GPT 04436 * directly. The function is in libisofs/system_area.c and self-contained. 04437 * So if you want to copy+paste it under the license of that file: Be invited. 04438 * Be warned that this implementation works bit-wise and thus is much slower 04439 * than table-driven ones. For less than 32 KiB, it fully suffices, though. 04440 * 04441 * @param data 04442 * The memory buffer with the data to sum up. 04443 * @param count 04444 * Number of bytes in data. 04445 * @param flag 04446 * Bitfield for control purposes. Submit 0. 04447 * @return 04448 * The CRC of data. 04449 * @since 1.3.8 04450 */ 04451 uint32_t iso_crc32_gpt(unsigned char *data, int count, int flag); 04452 04453 /** 04454 * Add a MIPS boot file path to the image. 04455 * Up to 15 such files can be written into a MIPS Big Endian Volume Header 04456 * if this is enabled by value 1 in iso_write_opts_set_system_area() option 04457 * bits 2 to 7. 04458 * A single file can be written into a DEC Boot Block if this is enabled by 04459 * value 2 in iso_write_opts_set_system_area() option bits 2 to 7. So only 04460 * the first added file gets into effect with this system area type. 04461 * The data files which shall serve as MIPS boot files have to be brought into 04462 * the image by the normal means. 04463 * @param image 04464 * The image to be manipulated. 04465 * @param path 04466 * Absolute path of the boot file in the ISO 9660 Rock Ridge tree. 04467 * @param flag 04468 * Bitfield for control purposes, unused yet, submit 0 04469 * @return 04470 * 1 on success, < 0 error 04471 * @since 0.6.38 04472 */ 04473 int iso_image_add_mips_boot_file(IsoImage *image, char *path, int flag); 04474 04475 /** 04476 * Obtain the number of added MIPS Big Endian boot files and pointers to 04477 * their paths in the ISO 9660 Rock Ridge tree. 04478 * @param image 04479 * The image to be inquired. 04480 * @param paths 04481 * An array of pointers to be set to the registered boot file paths. 04482 * This are just pointers to data inside IsoImage. Do not free() them. 04483 * Eventually make own copies of the data before manipulating the image. 04484 * @param flag 04485 * Bitfield for control purposes, unused yet, submit 0 04486 * @return 04487 * >= 0 is the number of valid path pointers , <0 means error 04488 * @since 0.6.38 04489 */ 04490 int iso_image_get_mips_boot_files(IsoImage *image, char *paths[15], int flag); 04491 04492 /** 04493 * Clear the list of MIPS Big Endian boot file paths. 04494 * @param image 04495 * The image to be manipulated. 04496 * @param flag 04497 * Bitfield for control purposes, unused yet, submit 0 04498 * @return 04499 * 1 is success , <0 means error 04500 * @since 0.6.38 04501 */ 04502 int iso_image_give_up_mips_boot(IsoImage *image, int flag); 04503 04504 /** 04505 * Designate a data file in the ISO image of which the position and size 04506 * shall be written after the SUN Disk Label. The position is written as 04507 * 64-bit big-endian number to byte position 0x228. The size is written 04508 * as 32-bit big-endian to 0x230. 04509 * This setting has an effect only if system area type is set to 3 04510 * with iso_write_opts_set_system_area(). 04511 * 04512 * @param img 04513 * The image to be manipulated. 04514 * @param sparc_core 04515 * The IsoFile which shall be mentioned after the SUN Disk label. 04516 * NULL is a permissible value. It disables this feature. 04517 * @param flag 04518 * Bitfield for control purposes, unused yet, submit 0 04519 * @return 04520 * 1 is success , <0 means error 04521 * @since 1.3.0 04522 */ 04523 int iso_image_set_sparc_core(IsoImage *img, IsoFile *sparc_core, int flag); 04524 04525 /** 04526 * Obtain the current setting of iso_image_set_sparc_core(). 04527 * 04528 * @param img 04529 * The image to be inquired. 04530 * @param sparc_core 04531 * Will return a pointer to the IsoFile (or NULL, which is not an error) 04532 * @param flag 04533 * Bitfield for control purposes, unused yet, submit 0 04534 * @return 04535 * 1 is success , <0 means error 04536 * @since 1.3.0 04537 */ 04538 int iso_image_get_sparc_core(IsoImage *img, IsoFile **sparc_core, int flag); 04539 04540 /** 04541 * Define a command line and submit the paths of four mandatory files for 04542 * production of a HP-PA PALO boot sector for PA-RISC machines. 04543 * The paths must lead to already existing data files in the ISO image 04544 * which stay with these paths until image production. 04545 * 04546 * @param img 04547 * The image to be manipulated. 04548 * @param cmdline 04549 * Up to 127 characters of command line. 04550 * @param bootloader 04551 * Absolute path of a data file in the ISO image. 04552 * @param kernel_32 04553 * Absolute path of a data file in the ISO image which serves as 04554 * 32 bit kernel. 04555 * @param kernel_64 04556 * Absolute path of a data file in the ISO image which serves as 04557 * 64 bit kernel. 04558 * @param ramdisk 04559 * Absolute path of a data file in the ISO image. 04560 * @param flag 04561 * Bitfield for control purposes 04562 * bit0= Let NULL parameters free the corresponding image properties. 04563 * Else only the non-NULL parameters of this call have an effect 04564 * @return 04565 * 1 is success , <0 means error 04566 * @since 1.3.8 04567 */ 04568 int iso_image_set_hppa_palo(IsoImage *img, char *cmdline, char *bootloader, 04569 char *kernel_32, char *kernel_64, char *ramdisk, 04570 int flag); 04571 04572 /** 04573 * Inquire the current settings of iso_image_set_hppa_palo(). 04574 * Do not free() the returned pointers. 04575 * 04576 * @param img 04577 * The image to be inquired. 04578 * @param cmdline 04579 * Will return the command line. 04580 * @param bootloader 04581 * Will return the absolute path of the bootloader file. 04582 * @param kernel_32 04583 * Will return the absolute path of the 32 bit kernel file. 04584 * @param kernel_64 04585 * Will return the absolute path of the 64 bit kernel file. 04586 * @param ramdisk 04587 * Will return the absolute path of the RAM disk file. 04588 * @return 04589 * 1 is success , <0 means error 04590 * @since 1.3.8 04591 */ 04592 int iso_image_get_hppa_palo(IsoImage *img, char **cmdline, char **bootloader, 04593 char **kernel_32, char **kernel_64, char **ramdisk); 04594 04595 04596 /** 04597 * Submit the path of the DEC Alpha Secondary Bootstrap Loader file. 04598 * The path must lead to an already existing data file in the ISO image 04599 * which stays with this path until image production. 04600 * This setting has an effect only if system area type is set to 6 04601 * with iso_write_opts_set_system_area(). 04602 * 04603 * @param img 04604 * The image to be manipulated. 04605 * @param boot_loader_path 04606 * Absolute path of a data file in the ISO image. 04607 * Submit NULL to free this image property. 04608 * @param flag 04609 * Bitfield for control purposes. Unused yet. Submit 0. 04610 * @return 04611 * 1 is success , <0 means error 04612 * @since 1.4.0 04613 */ 04614 int iso_image_set_alpha_boot(IsoImage *img, char *boot_loader_path, int flag); 04615 04616 /** 04617 * Inquire the path submitted by iso_image_set_alpha_boot() 04618 * Do not free() the returned pointer. 04619 * 04620 * @param img 04621 * The image to be inquired. 04622 * @param boot_loader_path 04623 * Will return the path. NULL if none is currently submitted. 04624 * @return 04625 * 1 is success , <0 means error 04626 * @since 1.4.0 04627 */ 04628 int iso_image_get_alpha_boot(IsoImage *img, char **boot_loader_path); 04629 04630 04631 /** 04632 * Increments the reference counting of the given node. 04633 * 04634 * @since 0.6.2 04635 */ 04636 void iso_node_ref(IsoNode *node); 04637 04638 /** 04639 * Decrements the reference couting of the given node. 04640 * If it reach 0, the node is free, and, if the node is a directory, 04641 * its children will be unref() too. 04642 * 04643 * @since 0.6.2 04644 */ 04645 void iso_node_unref(IsoNode *node); 04646 04647 /** 04648 * Get the type of an IsoNode. 04649 * 04650 * @since 0.6.2 04651 */ 04652 enum IsoNodeType iso_node_get_type(IsoNode *node); 04653 04654 /** 04655 * Class of functions to handle particular extended information. A function 04656 * instance acts as an identifier for the type of the information. Structs 04657 * with same information type must use a pointer to the same function. 04658 * 04659 * @param data 04660 * Attached data 04661 * @param flag 04662 * What to do with the data. At this time the following values are 04663 * defined: 04664 * -> 1 the data must be freed 04665 * @return 04666 * 1 in any case. 04667 * 04668 * @since 0.6.4 04669 */ 04670 typedef int (*iso_node_xinfo_func)(void *data, int flag); 04671 04672 /** 04673 * Add extended information to the given node. Extended info allows 04674 * applications (and libisofs itself) to add more information to an IsoNode. 04675 * You can use this facilities to associate temporary information with a given 04676 * node. This information is not written into the ISO 9660 image on media 04677 * and thus does not persist longer than the node memory object. 04678 * 04679 * Each node keeps a list of added extended info, meaning you can add several 04680 * extended info data to each node. Each extended info you add is identified 04681 * by the proc parameter, a pointer to a function that knows how to manage 04682 * the external info data. Thus, in order to add several types of extended 04683 * info, you need to define a "proc" function for each type. 04684 * 04685 * @param node 04686 * The node where to add the extended info 04687 * @param proc 04688 * A function pointer used to identify the type of the data, and that 04689 * knows how to manage it 04690 * @param data 04691 * Extended info to add. 04692 * @return 04693 * 1 if success, 0 if the given node already has extended info of the 04694 * type defined by the "proc" function, < 0 on error 04695 * 04696 * @since 0.6.4 04697 */ 04698 int iso_node_add_xinfo(IsoNode *node, iso_node_xinfo_func proc, void *data); 04699 04700 /** 04701 * Remove the given extended info (defined by the proc function) from the 04702 * given node. 04703 * 04704 * @return 04705 * 1 on success, 0 if node does not have extended info of the requested 04706 * type, < 0 on error 04707 * 04708 * @since 0.6.4 04709 */ 04710 int iso_node_remove_xinfo(IsoNode *node, iso_node_xinfo_func proc); 04711 04712 /** 04713 * Remove all extended information from the given node. 04714 * 04715 * @param node 04716 * The node where to remove all extended info 04717 * @param flag 04718 * Bitfield for control purposes, unused yet, submit 0 04719 * @return 04720 * 1 on success, < 0 on error 04721 * 04722 * @since 1.0.2 04723 */ 04724 int iso_node_remove_all_xinfo(IsoNode *node, int flag); 04725 04726 /** 04727 * Get the given extended info (defined by the proc function) from the 04728 * given node. 04729 * 04730 * @param node 04731 * The node to inquire 04732 * @param proc 04733 * The function pointer which serves as key 04734 * @param data 04735 * Will after successful call point to the xinfo data corresponding 04736 * to the given proc. This is a pointer, not a feeable data copy. 04737 * @return 04738 * 1 on success, 0 if node does not have extended info of the requested 04739 * type, < 0 on error 04740 * 04741 * @since 0.6.4 04742 */ 04743 int iso_node_get_xinfo(IsoNode *node, iso_node_xinfo_func proc, void **data); 04744 04745 04746 /** 04747 * Get the next pair of function pointer and data of an iteration of the 04748 * list of extended informations. Like: 04749 * iso_node_xinfo_func proc; 04750 * void *handle = NULL, *data; 04751 * while (iso_node_get_next_xinfo(node, &handle, &proc, &data) == 1) { 04752 * ... make use of proc and data ... 04753 * } 04754 * The iteration allocates no memory. So you may end it without any disposal 04755 * action. 04756 * IMPORTANT: Do not continue iterations after manipulating the extended 04757 * information of a node. Memory corruption hazard ! 04758 * @param node 04759 * The node to inquire 04760 * @param handle 04761 * The opaque iteration handle. Initialize iteration by submitting 04762 * a pointer to a void pointer with value NULL. 04763 * Do not alter its content until iteration has ended. 04764 * @param proc 04765 * The function pointer which serves as key 04766 * @param data 04767 * Will be filled with the extended info corresponding to the given proc 04768 * function 04769 * @return 04770 * 1 on success 04771 * 0 if iteration has ended (proc and data are invalid then) 04772 * < 0 on error 04773 * 04774 * @since 1.0.2 04775 */ 04776 int iso_node_get_next_xinfo(IsoNode *node, void **handle, 04777 iso_node_xinfo_func *proc, void **data); 04778 04779 04780 /** 04781 * Class of functions to clone extended information. A function instance gets 04782 * associated to a particular iso_node_xinfo_func instance by function 04783 * iso_node_xinfo_make_clonable(). This is a precondition to have IsoNode 04784 * objects clonable which carry data for a particular iso_node_xinfo_func. 04785 * 04786 * @param old_data 04787 * Data item to be cloned 04788 * @param new_data 04789 * Shall return the cloned data item 04790 * @param flag 04791 * Unused yet, submit 0 04792 * The function shall return ISO_XINFO_NO_CLONE on unknown flag bits. 04793 * @return 04794 * > 0 number of allocated bytes 04795 * 0 no size info is available 04796 * < 0 error 04797 * 04798 * @since 1.0.2 04799 */ 04800 typedef int (*iso_node_xinfo_cloner)(void *old_data, void **new_data,int flag); 04801 04802 /** 04803 * Associate a iso_node_xinfo_cloner to a particular class of extended 04804 * information in order to make it clonable. 04805 * 04806 * @param proc 04807 * The key and disposal function which identifies the particular 04808 * extended information class. 04809 * @param cloner 04810 * The cloner function which shall be associated with proc. 04811 * @param flag 04812 * Unused yet, submit 0 04813 * @return 04814 * 1 success, < 0 error 04815 * 04816 * @since 1.0.2 04817 */ 04818 int iso_node_xinfo_make_clonable(iso_node_xinfo_func proc, 04819 iso_node_xinfo_cloner cloner, int flag); 04820 04821 /** 04822 * Inquire the registered cloner function for a particular class of 04823 * extended information. 04824 * 04825 * @param proc 04826 * The key and disposal function which identifies the particular 04827 * extended information class. 04828 * @param cloner 04829 * Will return the cloner function which is associated with proc, or NULL. 04830 * @param flag 04831 * Unused yet, submit 0 04832 * @return 04833 * 1 success, 0 no cloner registered for proc, < 0 error 04834 * 04835 * @since 1.0.2 04836 */ 04837 int iso_node_xinfo_get_cloner(iso_node_xinfo_func proc, 04838 iso_node_xinfo_cloner *cloner, int flag); 04839 04840 /** 04841 * Set the name of a node. Note that if the node is already added to a dir 04842 * this can fail if dir already contains a node with the new name. 04843 * The IsoImage context defines a maximum permissible name length and a mode 04844 * how to react on oversized names. See iso_image_set_truncate_mode(). 04845 * 04846 * @param image 04847 * The image object to which the node belongs or shall belong in future. 04848 * @param node 04849 * The node of which you want to change the name. One cannot change the 04850 * name of the root directory. 04851 * @param name 04852 * The new name for the node. It may not be empty. If it is oversized 04853 * then it will be handled according to iso_image_set_truncate_mode(). 04854 * @param flag 04855 * bit0= issue warning in case of truncation 04856 * @return 04857 * 1 on success, < 0 on error 04858 * 04859 * @since 1.4.2 04860 */ 04861 int iso_image_set_node_name(IsoImage *image, IsoNode *node, const char *name, 04862 int flag); 04863 04864 /** 04865 * *** Deprecated *** 04866 * use iso_image_set_node_name() instead 04867 * 04868 * Set the name of a node without taking into respect name truncation mode of 04869 * an IsoImage. 04870 * 04871 * @param node 04872 * The node whose name you want to change. Note that you can't change 04873 * the name of the root. 04874 * @param name 04875 * The name for the node. If you supply an empty string or a 04876 * name greater than 255 characters this returns with failure, and 04877 * node name is not modified. 04878 * @return 04879 * 1 on success, < 0 on error 04880 * 04881 * @since 0.6.2 04882 */ 04883 int iso_node_set_name(IsoNode *node, const char *name); 04884 04885 04886 /** 04887 * Get the name of a node. 04888 * The returned string belongs to the node and must not be modified nor 04889 * freed. Use strdup if you really need your own copy. 04890 * 04891 * Up to version 1.4.2 inquiry of the root directory name returned NULL, 04892 * which is a bug in the light of above description. 04893 * Since 1.4.2 the return value is an empty string. 04894 * 04895 * @since 0.6.2 04896 */ 04897 const char *iso_node_get_name(const IsoNode *node); 04898 04899 /** 04900 * Set the permissions for the node. This attribute is only useful when 04901 * Rock Ridge extensions are enabled. 04902 * 04903 * @param node 04904 * The node to change 04905 * @param mode 04906 * bitmask with the permissions of the node, as specified in 'man 2 stat'. 04907 * The file type bitfields will be ignored, only file permissions will be 04908 * modified. 04909 * 04910 * @since 0.6.2 04911 */ 04912 void iso_node_set_permissions(IsoNode *node, mode_t mode); 04913 04914 /** 04915 * Get the permissions for the node 04916 * 04917 * @since 0.6.2 04918 */ 04919 mode_t iso_node_get_permissions(const IsoNode *node); 04920 04921 /** 04922 * Get the mode of the node, both permissions and file type, as specified in 04923 * 'man 2 stat'. 04924 * 04925 * @since 0.6.2 04926 */ 04927 mode_t iso_node_get_mode(const IsoNode *node); 04928 04929 /** 04930 * Set the user id for the node. This attribute is only useful when 04931 * Rock Ridge extensions are enabled. 04932 * 04933 * @since 0.6.2 04934 */ 04935 void iso_node_set_uid(IsoNode *node, uid_t uid); 04936 04937 /** 04938 * Get the user id of the node. 04939 * 04940 * @since 0.6.2 04941 */ 04942 uid_t iso_node_get_uid(const IsoNode *node); 04943 04944 /** 04945 * Set the group id for the node. This attribute is only useful when 04946 * Rock Ridge extensions are enabled. 04947 * 04948 * @since 0.6.2 04949 */ 04950 void iso_node_set_gid(IsoNode *node, gid_t gid); 04951 04952 /** 04953 * Get the group id of the node. 04954 * 04955 * @since 0.6.2 04956 */ 04957 gid_t iso_node_get_gid(const IsoNode *node); 04958 04959 /** 04960 * Set the time of last modification of the file 04961 * 04962 * @since 0.6.2 04963 */ 04964 void iso_node_set_mtime(IsoNode *node, time_t time); 04965 04966 /** 04967 * Get the time of last modification of the file 04968 * 04969 * @since 0.6.2 04970 */ 04971 time_t iso_node_get_mtime(const IsoNode *node); 04972 04973 /** 04974 * Set the time of last access to the file 04975 * 04976 * @since 0.6.2 04977 */ 04978 void iso_node_set_atime(IsoNode *node, time_t time); 04979 04980 /** 04981 * Get the time of last access to the file 04982 * 04983 * @since 0.6.2 04984 */ 04985 time_t iso_node_get_atime(const IsoNode *node); 04986 04987 /** 04988 * Set the time of last status change of the file 04989 * 04990 * @since 0.6.2 04991 */ 04992 void iso_node_set_ctime(IsoNode *node, time_t time); 04993 04994 /** 04995 * Get the time of last status change of the file 04996 * 04997 * @since 0.6.2 04998 */ 04999 time_t iso_node_get_ctime(const IsoNode *node); 05000 05001 /** 05002 * Set whether the node will be hidden in the directory trees of RR/ISO 9660, 05003 * or of Joliet (if enabled at all), or of ISO-9660:1999 (if enabled at all). 05004 * 05005 * A hidden file does not show up by name in the affected directory tree. 05006 * For example, if a file is hidden only in Joliet, it will normally 05007 * not be visible on Windows systems, while being shown on GNU/Linux. 05008 * 05009 * If a file is not shown in any of the enabled trees, then its content will 05010 * not be written to the image, unless LIBISO_HIDE_BUT_WRITE is given (which 05011 * is available only since release 0.6.34). 05012 * 05013 * @param node 05014 * The node that is to be hidden. 05015 * @param hide_attrs 05016 * Or-combination of values from enum IsoHideNodeFlag to set the trees 05017 * in which the node's name shall be hidden. 05018 * 05019 * @since 0.6.2 05020 */ 05021 void iso_node_set_hidden(IsoNode *node, int hide_attrs); 05022 05023 /** 05024 * Get the hide_attrs as eventually set by iso_node_set_hidden(). 05025 * 05026 * @param node 05027 * The node to inquire. 05028 * @return 05029 * Or-combination of values from enum IsoHideNodeFlag which are 05030 * currently set for the node. 05031 * 05032 * @since 0.6.34 05033 */ 05034 int iso_node_get_hidden(IsoNode *node); 05035 05036 /** 05037 * Compare two nodes whether they are based on the same input and 05038 * can be considered as hardlinks to the same file objects. 05039 * 05040 * @param n1 05041 * The first node to compare. 05042 * @param n2 05043 * The second node to compare. 05044 * @return 05045 * -1 if n1 is smaller n2 , 0 if n1 matches n2 , 1 if n1 is larger n2 05046 * @param flag 05047 * Bitfield for control purposes, unused yet, submit 0 05048 * @since 0.6.20 05049 */ 05050 int iso_node_cmp_ino(IsoNode *n1, IsoNode *n2, int flag); 05051 05052 /** 05053 * Add a new node to a dir. Note that this function don't add a new ref to 05054 * the node, so you don't need to free it, it will be automatically freed 05055 * when the dir is deleted. Of course, if you want to keep using the node 05056 * after the dir life, you need to iso_node_ref() it. 05057 * 05058 * @param dir 05059 * the dir where to add the node 05060 * @param child 05061 * the node to add. You must ensure that the node hasn't previously added 05062 * to other dir, and that the node name is unique inside the child. 05063 * Otherwise this function will return a failure, and the child won't be 05064 * inserted. 05065 * @param replace 05066 * if the dir already contains a node with the same name, whether to 05067 * replace or not the old node with this. 05068 * @return 05069 * number of nodes in dir if succes, < 0 otherwise 05070 * Possible errors: 05071 * ISO_NULL_POINTER, if dir or child are NULL 05072 * ISO_NODE_ALREADY_ADDED, if child is already added to other dir 05073 * ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists 05074 * ISO_WRONG_ARG_VALUE, if child == dir, or replace != (0,1) 05075 * 05076 * @since 0.6.2 05077 */ 05078 int iso_dir_add_node(IsoDir *dir, IsoNode *child, 05079 enum iso_replace_mode replace); 05080 05081 /** 05082 * Locate a node inside a given dir. 05083 * 05084 * The IsoImage context defines a maximum permissible name length and a mode 05085 * how to react on oversized names. See iso_image_set_truncate_mode(). 05086 * If the caller looks for an oversized name and image truncate mode is 1, 05087 * then this call looks for the truncated name among the nodes of dir. 05088 * 05089 * @param image 05090 * The image object to which dir belongs. 05091 * @param dir 05092 * The dir where to look for the node. 05093 * @param name 05094 * The name of the node. (Will not be changed if truncation happens.) 05095 * @param node 05096 * Location for a pointer to the node, it will filled with NULL if the dir 05097 * doesn't have a child with the given name. 05098 * The node will be owned by the dir and shouldn't be unref(). Just call 05099 * iso_node_ref() to get your own reference to the node. 05100 * Note that you can pass NULL is the only thing you want to do is check 05101 * if a node with such name already exists on dir. 05102 * @param flag 05103 * Bitfield for control purposes. 05104 * bit0= do not truncate name but lookup exactly as given. 05105 * @return 05106 * 1 node found 05107 * 0 no name truncation was needed, name not found in dir 05108 * 2 name truncation happened, truncated name not found in dir 05109 * < 0 error, see iso_dir_get_node(). 05110 * 05111 * @since 1.4.2 05112 */ 05113 int iso_image_dir_get_node(IsoImage *image, IsoDir *dir, 05114 const char *name, IsoNode **node, int flag); 05115 05116 /** 05117 * *** Deprecated *** 05118 * In most cases use iso_image_dir_get_node() instead. 05119 * 05120 * Locate a node inside a given dir without taking into respect name truncation 05121 * mode of an IsoImage. 05122 * 05123 * @param dir 05124 * The dir where to look for the node. 05125 * @param name 05126 * The name of the node 05127 * @param node 05128 * Location for a pointer to the node. See iso_image_get_node(). 05129 * @return 05130 * 1 node found, 0 child has no such node, < 0 error 05131 * Possible errors: 05132 * ISO_NULL_POINTER, if dir or name are NULL 05133 * 05134 * @since 0.6.2 05135 */ 05136 int iso_dir_get_node(IsoDir *dir, const char *name, IsoNode **node); 05137 05138 /** 05139 * Get the number of children of a directory. 05140 * 05141 * @return 05142 * >= 0 number of items, < 0 error 05143 * Possible errors: 05144 * ISO_NULL_POINTER, if dir is NULL 05145 * 05146 * @since 0.6.2 05147 */ 05148 int iso_dir_get_children_count(IsoDir *dir); 05149 05150 /** 05151 * Removes a child from a directory. 05152 * The child is not freed, so you will become the owner of the node. Later 05153 * you can add the node to another dir (calling iso_dir_add_node), or free 05154 * it if you don't need it (with iso_node_unref). 05155 * 05156 * @return 05157 * 1 on success, < 0 error 05158 * Possible errors: 05159 * ISO_NULL_POINTER, if node is NULL 05160 * ISO_NODE_NOT_ADDED_TO_DIR, if node doesn't belong to a dir 05161 * 05162 * @since 0.6.2 05163 */ 05164 int iso_node_take(IsoNode *node); 05165 05166 /** 05167 * Removes a child from a directory and free (unref) it. 05168 * If you want to keep the child alive, you need to iso_node_ref() it 05169 * before this call, but in that case iso_node_take() is a better 05170 * alternative. 05171 * 05172 * @return 05173 * 1 on success, < 0 error 05174 * 05175 * @since 0.6.2 05176 */ 05177 int iso_node_remove(IsoNode *node); 05178 05179 /* 05180 * Get the parent of the given iso tree node. No extra ref is added to the 05181 * returned directory, you must take your ref. with iso_node_ref() if you 05182 * need it. 05183 * 05184 * If node is the root node, the same node will be returned as its parent. 05185 * 05186 * This returns NULL if the node doesn't pertain to any tree 05187 * (it was removed/taken). 05188 * 05189 * @since 0.6.2 05190 */ 05191 IsoDir *iso_node_get_parent(IsoNode *node); 05192 05193 /** 05194 * Get an iterator for the children of the given dir. 05195 * 05196 * You can iterate over the children with iso_dir_iter_next. When finished, 05197 * you should free the iterator with iso_dir_iter_free. 05198 * You musn't delete a child of the same dir, using iso_node_take() or 05199 * iso_node_remove(), while you're using the iterator. You can use 05200 * iso_dir_iter_take() or iso_dir_iter_remove() instead. 05201 * 05202 * You can use the iterator in the way like this 05203 * 05204 * IsoDirIter *iter; 05205 * IsoNode *node; 05206 * if ( iso_dir_get_children(dir, &iter) != 1 ) { 05207 * // handle error 05208 * } 05209 * while ( iso_dir_iter_next(iter, &node) == 1 ) { 05210 * // do something with the child 05211 * } 05212 * iso_dir_iter_free(iter); 05213 * 05214 * An iterator is intended to be used in a single iteration over the 05215 * children of a dir. Thus, it should be treated as a temporary object, 05216 * and free as soon as possible. 05217 * 05218 * @return 05219 * 1 success, < 0 error 05220 * Possible errors: 05221 * ISO_NULL_POINTER, if dir or iter are NULL 05222 * ISO_OUT_OF_MEM 05223 * 05224 * @since 0.6.2 05225 */ 05226 int iso_dir_get_children(const IsoDir *dir, IsoDirIter **iter); 05227 05228 /** 05229 * Get the next child. 05230 * Take care that the node is owned by its parent, and will be unref() when 05231 * the parent is freed. If you want your own ref to it, call iso_node_ref() 05232 * on it. 05233 * 05234 * @return 05235 * 1 success, 0 if dir has no more elements, < 0 error 05236 * Possible errors: 05237 * ISO_NULL_POINTER, if node or iter are NULL 05238 * ISO_ERROR, on wrong iter usage, usual caused by modiying the 05239 * dir during iteration 05240 * 05241 * @since 0.6.2 05242 */ 05243 int iso_dir_iter_next(IsoDirIter *iter, IsoNode **node); 05244 05245 /** 05246 * Check if there're more children. 05247 * 05248 * @return 05249 * 1 dir has more elements, 0 no, < 0 error 05250 * Possible errors: 05251 * ISO_NULL_POINTER, if iter is NULL 05252 * 05253 * @since 0.6.2 05254 */ 05255 int iso_dir_iter_has_next(IsoDirIter *iter); 05256 05257 /** 05258 * Free a dir iterator. 05259 * 05260 * @since 0.6.2 05261 */ 05262 void iso_dir_iter_free(IsoDirIter *iter); 05263 05264 /** 05265 * Removes a child from a directory during an iteration, without freeing it. 05266 * It's like iso_node_take(), but to be used during a directory iteration. 05267 * The node removed will be the last returned by the iteration. 05268 * 05269 * If you call this function twice without calling iso_dir_iter_next between 05270 * them is not allowed and you will get an ISO_ERROR in second call. 05271 * 05272 * @return 05273 * 1 on succes, < 0 error 05274 * Possible errors: 05275 * ISO_NULL_POINTER, if iter is NULL 05276 * ISO_ERROR, on wrong iter usage, for example by call this before 05277 * iso_dir_iter_next. 05278 * 05279 * @since 0.6.2 05280 */ 05281 int iso_dir_iter_take(IsoDirIter *iter); 05282 05283 /** 05284 * Removes a child from a directory during an iteration and unref() it. 05285 * Like iso_node_remove(), but to be used during a directory iteration. 05286 * The node removed will be the one returned by the previous iteration. 05287 * 05288 * It is not allowed to call this function twice without calling 05289 * iso_dir_iter_next between the calls. 05290 * 05291 * @return 05292 * 1 on succes, < 0 error 05293 * Possible errors: 05294 * ISO_NULL_POINTER, if iter is NULL 05295 * ISO_ERROR, on wrong iter usage, for example by calling this before 05296 * iso_dir_iter_next. 05297 * 05298 * @since 0.6.2 05299 */ 05300 int iso_dir_iter_remove(IsoDirIter *iter); 05301 05302 /** 05303 * Removes a node by iso_node_remove() or iso_dir_iter_remove(). If the node 05304 * is a directory then the whole tree of nodes underneath is removed too. 05305 * 05306 * @param node 05307 * The node to be removed. 05308 * @param boss_iter 05309 * If not NULL, then the node will be removed by 05310 * iso_dir_iter_remove(boss_iter) 05311 * else it will be removed by iso_node_remove(node). 05312 * @return 05313 * 1 is success, <0 indicates error 05314 * 05315 * @since 1.0.2 05316 */ 05317 int iso_node_remove_tree(IsoNode *node, IsoDirIter *boss_iter); 05318 05319 05320 /** 05321 * @since 0.6.4 05322 */ 05323 typedef struct iso_find_condition IsoFindCondition; 05324 05325 /** 05326 * Create a new condition that checks if the node name matches the given 05327 * wildcard. 05328 * 05329 * @param wildcard 05330 * @result 05331 * The created IsoFindCondition, NULL on error. 05332 * 05333 * @since 0.6.4 05334 */ 05335 IsoFindCondition *iso_new_find_conditions_name(const char *wildcard); 05336 05337 /** 05338 * Create a new condition that checks the node mode against a mode mask. It 05339 * can be used to check both file type and permissions. 05340 * 05341 * For example: 05342 * 05343 * iso_new_find_conditions_mode(S_IFREG) : search for regular files 05344 * iso_new_find_conditions_mode(S_IFCHR | S_IWUSR) : search for character 05345 * devices where owner has write permissions. 05346 * 05347 * @param mask 05348 * Mode mask to AND against node mode. 05349 * @result 05350 * The created IsoFindCondition, NULL on error. 05351 * 05352 * @since 0.6.4 05353 */ 05354 IsoFindCondition *iso_new_find_conditions_mode(mode_t mask); 05355 05356 /** 05357 * Create a new condition that checks the node gid. 05358 * 05359 * @param gid 05360 * Desired Group Id. 05361 * @result 05362 * The created IsoFindCondition, NULL on error. 05363 * 05364 * @since 0.6.4 05365 */ 05366 IsoFindCondition *iso_new_find_conditions_gid(gid_t gid); 05367 05368 /** 05369 * Create a new condition that checks the node uid. 05370 * 05371 * @param uid 05372 * Desired User Id. 05373 * @result 05374 * The created IsoFindCondition, NULL on error. 05375 * 05376 * @since 0.6.4 05377 */ 05378 IsoFindCondition *iso_new_find_conditions_uid(uid_t uid); 05379 05380 /** 05381 * Possible comparison between IsoNode and given conditions. 05382 * 05383 * @since 0.6.4 05384 */ 05385 enum iso_find_comparisons { 05386 ISO_FIND_COND_GREATER, 05387 ISO_FIND_COND_GREATER_OR_EQUAL, 05388 ISO_FIND_COND_EQUAL, 05389 ISO_FIND_COND_LESS, 05390 ISO_FIND_COND_LESS_OR_EQUAL 05391 }; 05392 05393 /** 05394 * Create a new condition that checks the time of last access. 05395 * 05396 * @param time 05397 * Time to compare against IsoNode atime. 05398 * @param comparison 05399 * Comparison to be done between IsoNode atime and submitted time. 05400 * Note that ISO_FIND_COND_GREATER, for example, is true if the node 05401 * time is greater than the submitted time. 05402 * @result 05403 * The created IsoFindCondition, NULL on error. 05404 * 05405 * @since 0.6.4 05406 */ 05407 IsoFindCondition *iso_new_find_conditions_atime(time_t time, 05408 enum iso_find_comparisons comparison); 05409 05410 /** 05411 * Create a new condition that checks the time of last modification. 05412 * 05413 * @param time 05414 * Time to compare against IsoNode mtime. 05415 * @param comparison 05416 * Comparison to be done between IsoNode mtime and submitted time. 05417 * Note that ISO_FIND_COND_GREATER, for example, is true if the node 05418 * time is greater than the submitted time. 05419 * @result 05420 * The created IsoFindCondition, NULL on error. 05421 * 05422 * @since 0.6.4 05423 */ 05424 IsoFindCondition *iso_new_find_conditions_mtime(time_t time, 05425 enum iso_find_comparisons comparison); 05426 05427 /** 05428 * Create a new condition that checks the time of last status change. 05429 * 05430 * @param time 05431 * Time to compare against IsoNode ctime. 05432 * @param comparison 05433 * Comparison to be done between IsoNode ctime and submitted time. 05434 * Note that ISO_FIND_COND_GREATER, for example, is true if the node 05435 * time is greater than the submitted time. 05436 * @result 05437 * The created IsoFindCondition, NULL on error. 05438 * 05439 * @since 0.6.4 05440 */ 05441 IsoFindCondition *iso_new_find_conditions_ctime(time_t time, 05442 enum iso_find_comparisons comparison); 05443 05444 /** 05445 * Create a new condition that check if the two given conditions are 05446 * valid. 05447 * 05448 * @param a 05449 * @param b 05450 * IsoFindCondition to compare 05451 * @result 05452 * The created IsoFindCondition, NULL on error. 05453 * 05454 * @since 0.6.4 05455 */ 05456 IsoFindCondition *iso_new_find_conditions_and(IsoFindCondition *a, 05457 IsoFindCondition *b); 05458 05459 /** 05460 * Create a new condition that check if at least one the two given conditions 05461 * is valid. 05462 * 05463 * @param a 05464 * @param b 05465 * IsoFindCondition to compare 05466 * @result 05467 * The created IsoFindCondition, NULL on error. 05468 * 05469 * @since 0.6.4 05470 */ 05471 IsoFindCondition *iso_new_find_conditions_or(IsoFindCondition *a, 05472 IsoFindCondition *b); 05473 05474 /** 05475 * Create a new condition that check if the given conditions is false. 05476 * 05477 * @param negate 05478 * @result 05479 * The created IsoFindCondition, NULL on error. 05480 * 05481 * @since 0.6.4 05482 */ 05483 IsoFindCondition *iso_new_find_conditions_not(IsoFindCondition *negate); 05484 05485 /** 05486 * Find all directory children that match the given condition. 05487 * 05488 * @param dir 05489 * Directory where we will search children. 05490 * @param cond 05491 * Condition that the children must match in order to be returned. 05492 * It will be free together with the iterator. Remember to delete it 05493 * if this function return error. 05494 * @param iter 05495 * Iterator that returns only the children that match condition. 05496 * @return 05497 * 1 on success, < 0 on error 05498 * 05499 * @since 0.6.4 05500 */ 05501 int iso_dir_find_children(IsoDir* dir, IsoFindCondition *cond, 05502 IsoDirIter **iter); 05503 05504 /** 05505 * Get the destination of a node. 05506 * The returned string belongs to the node and must not be modified nor 05507 * freed. Use strdup if you really need your own copy. 05508 * 05509 * @since 0.6.2 05510 */ 05511 const char *iso_symlink_get_dest(const IsoSymlink *link); 05512 05513 /** 05514 * Set the destination of a symbolic 05515 * 05516 * @param link 05517 * The link node to be manipulated 05518 * @param dest 05519 * New destination for the link. It must be a non-empty string, otherwise 05520 * this function doesn't modify previous destination. 05521 * @return 05522 * 1 on success, < 0 on error 05523 * 05524 * @since 0.6.2 05525 */ 05526 int iso_symlink_set_dest(IsoSymlink *link, const char *dest); 05527 05528 /** 05529 * Sets the order in which a node will be written on image. The data content 05530 * of files with high weight will be written to low block addresses. 05531 * 05532 * @param node 05533 * The node which weight will be changed. If it's a dir, this function 05534 * will change the weight of all its children. For nodes other that dirs 05535 * or regular files, this function has no effect. 05536 * @param w 05537 * The weight as a integer number, the greater this value is, the 05538 * closer from the beginning of image the file will be written. 05539 * Default value at IsoNode creation is 0. 05540 * 05541 * @since 0.6.2 05542 */ 05543 void iso_node_set_sort_weight(IsoNode *node, int w); 05544 05545 /** 05546 * Get the sort weight of a file. 05547 * 05548 * @since 0.6.2 05549 */ 05550 int iso_file_get_sort_weight(IsoFile *file); 05551 05552 /** 05553 * Get the size of the file, in bytes 05554 * 05555 * @since 0.6.2 05556 */ 05557 off_t iso_file_get_size(IsoFile *file); 05558 05559 /** 05560 * Get the device id (major/minor numbers) of the given block or 05561 * character device file. The result is undefined for other kind 05562 * of special files, of first be sure iso_node_get_mode() returns either 05563 * S_IFBLK or S_IFCHR. 05564 * 05565 * @since 0.6.6 05566 */ 05567 dev_t iso_special_get_dev(IsoSpecial *special); 05568 05569 /** 05570 * Get the IsoStream that represents the contents of the given IsoFile. 05571 * The stream may be a filter stream which itself get its input from a 05572 * further stream. This may be inquired by iso_stream_get_input_stream(). 05573 * 05574 * If you iso_stream_open() the stream, iso_stream_close() it before 05575 * image generation begins. 05576 * 05577 * @return 05578 * The IsoStream. No extra ref is added, so the IsoStream belongs to the 05579 * IsoFile, and it may be freed together with it. Add your own ref with 05580 * iso_stream_ref() if you need it. 05581 * 05582 * @since 0.6.4 05583 */ 05584 IsoStream *iso_file_get_stream(IsoFile *file); 05585 05586 /** 05587 * Get the block lba of a file node, if it was imported from an old image. 05588 * 05589 * @param file 05590 * The file 05591 * @param lba 05592 * Will be filled with the kba 05593 * @param flag 05594 * Reserved for future usage, submit 0 05595 * @return 05596 * 1 if lba is valid (file comes from old image and has only one section), 05597 * 0 if file was newly added, i.e. it does not come from an old image, 05598 * < 0 error, especially ISO_WRONG_ARG_VALUE if the file has more than 05599 * one file section. 05600 * 05601 * @since 0.6.4 05602 * 05603 * @deprecated Use iso_file_get_old_image_sections(), as this function does 05604 * not work with multi-extend files. 05605 */ 05606 int iso_file_get_old_image_lba(IsoFile *file, uint32_t *lba, int flag); 05607 05608 /** 05609 * Get the start addresses and the sizes of the data extents of a file node 05610 * if it was imported from an old image. 05611 * 05612 * @param file 05613 * The file 05614 * @param section_count 05615 * Returns the number of extent entries in sections array. 05616 * @param sections 05617 * Returns the array of file sections if section_count > 0. 05618 * In this case, apply free() to dispose it. 05619 * @param flag 05620 * Reserved for future usage, submit 0 05621 * @return 05622 * 1 if there are valid extents (file comes from old image), 05623 * 0 if file was newly added, i.e. it does not come from an old image, 05624 * < 0 error 05625 * 05626 * @since 0.6.8 05627 */ 05628 int iso_file_get_old_image_sections(IsoFile *file, int *section_count, 05629 struct iso_file_section **sections, 05630 int flag); 05631 05632 /* 05633 * Like iso_file_get_old_image_lba(), but take an IsoNode. 05634 * 05635 * @return 05636 * 1 if lba is valid (file comes from old image), 0 if file was newly 05637 * added, i.e. it does not come from an old image, 2 node type has no 05638 * LBA (no regular file), < 0 error 05639 * 05640 * @since 0.6.4 05641 */ 05642 int iso_node_get_old_image_lba(IsoNode *node, uint32_t *lba, int flag); 05643 05644 /** 05645 * Add a new directory to the iso tree. Permissions, owner and hidden atts 05646 * are taken from parent, you can modify them later. 05647 * 05648 * @param image 05649 * The image object to which the new directory shall belong. 05650 * @param parent 05651 * The directory node where the new directory will be grafted in. 05652 * @param name 05653 * Name for the new directory. If truncation mode is set to 1, 05654 * an oversized name gets truncated before further processing. 05655 * If a node with same name already exists on parent, this function 05656 * fails with ISO_NODE_NAME_NOT_UNIQUE. 05657 * @param dir 05658 * place where to store a pointer to the newly created dir. No extra 05659 * ref is addded, so you will need to call iso_node_ref() if you really 05660 * need it. You can pass NULL in this parameter if you don't need the 05661 * pointer. 05662 * @return 05663 * number of nodes in parent if success, < 0 otherwise 05664 * Possible errors: 05665 * ISO_NULL_POINTER, if parent or name are NULL 05666 * ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists 05667 * ISO_OUT_OF_MEM 05668 * ISO_RR_NAME_TOO_LONG 05669 * 05670 * @since 1.4.2 05671 */ 05672 int iso_image_add_new_dir(IsoImage *image, IsoDir *parent, const char *name, 05673 IsoDir **dir); 05674 05675 /** 05676 * *** Deprecated *** 05677 * use iso_image_add_new_dir() instead 05678 * 05679 * Add a new directory to the iso tree without taking into respect name 05680 * truncation mode of an IsoImage. 05681 * For detailed description of parameters, see above iso_image_add_new_dir(). 05682 * 05683 * @param parent 05684 * the dir where the new directory will be created 05685 * @param name 05686 * name for the new dir. 05687 * @param dir 05688 * place where to store a pointer to the newly created dir.i 05689 * @return 05690 * number of nodes in parent if success, < 0 otherwise 05691 * Possible errors: 05692 * ISO_NULL_POINTER, if parent or name are NULL 05693 * ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists 05694 * ISO_OUT_OF_MEM 05695 * 05696 * @since 0.6.2 05697 */ 05698 int iso_tree_add_new_dir(IsoDir *parent, const char *name, IsoDir **dir); 05699 05700 /** 05701 * Add a new regular file to the iso tree. Permissions are set to 0444, 05702 * owner and hidden atts are taken from parent. You can modify any of them 05703 * later. 05704 * 05705 * @param image 05706 * The image object to which the new file shall belong. 05707 * @param parent 05708 * The directory node where the new directory will be grafted in. 05709 * @param name 05710 * Name for the new file. If truncation mode is set to 1, 05711 * an oversized name gets truncated before further processing. 05712 * If a node with same name already exists on parent, this function 05713 * fails with ISO_NODE_NAME_NOT_UNIQUE. 05714 * @param stream 05715 * IsoStream for the contents of the file. The reference will be taken 05716 * by the newly created file, you will need to take an extra ref to it 05717 * if you need it. 05718 * @param file 05719 * place where to store a pointer to the newly created file. No extra 05720 * ref is addded, so you will need to call iso_node_ref() if you really 05721 * need it. You can pass NULL in this parameter if you don't need the 05722 * pointer 05723 * @return 05724 * number of nodes in parent if success, < 0 otherwise 05725 * Possible errors: 05726 * ISO_NULL_POINTER, if parent, name or dest are NULL 05727 * ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists 05728 * ISO_OUT_OF_MEM 05729 * ISO_RR_NAME_TOO_LONG 05730 * 05731 * @since 1.4.2 05732 */ 05733 int iso_image_add_new_file(IsoImage *image, IsoDir *parent, const char *name, 05734 IsoStream *stream, IsoFile **file); 05735 05736 /** 05737 * *** Deprecated *** 05738 * use iso_image_add_new_file() instead 05739 * 05740 * Add a new regular file to the iso tree without taking into respect name 05741 * truncation mode of an IsoImage. 05742 * For detailed description of parameters, see above iso_image_add_new_file(). 05743 * 05744 * @param parent 05745 * the dir where the new file will be created 05746 * @param name 05747 * name for the new file. 05748 * @param stream 05749 * IsoStream for the contents of the file. 05750 * @param file 05751 * place where to store a pointer to the newly created file. 05752 * @return 05753 * number of nodes in parent if success, < 0 otherwise 05754 * Possible errors: 05755 * ISO_NULL_POINTER, if parent, name or dest are NULL 05756 * ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists 05757 * ISO_OUT_OF_MEM 05758 * 05759 * @since 0.6.4 05760 */ 05761 int iso_tree_add_new_file(IsoDir *parent, const char *name, IsoStream *stream, 05762 IsoFile **file); 05763 05764 /** 05765 * Create an IsoStream object from content which is stored in a dynamically 05766 * allocated memory buffer. The new stream will become owner of the buffer 05767 * and apply free() to it when the stream finally gets destroyed itself. 05768 * 05769 * @param buf 05770 * The dynamically allocated memory buffer with the stream content. 05771 * @param size 05772 * The number of bytes which may be read from buf. 05773 * @param stream 05774 * Will return a reference to the newly created stream. 05775 * @return 05776 * ISO_SUCCESS or <0 for error. E.g. ISO_NULL_POINTER, ISO_OUT_OF_MEM. 05777 * 05778 * @since 1.0.0 05779 */ 05780 int iso_memory_stream_new(unsigned char *buf, size_t size, IsoStream **stream); 05781 05782 /** 05783 * Add a new symbolic link to the directory tree. Permissions are set to 0777, 05784 * owner and hidden atts are taken from parent. You can modify any of them 05785 * later. 05786 * 05787 * @param image 05788 * The image object to which the new directory shall belong. 05789 * @param parent 05790 * The directory node where the new symlink will be grafted in. 05791 * @param name 05792 * Name for the new symlink. If truncation mode is set to 1, 05793 * an oversized name gets truncated before further processing. 05794 * If a node with same name already exists on parent, this function 05795 * fails with ISO_NODE_NAME_NOT_UNIQUE. 05796 * @param dest 05797 * The destination path of the link. The components of this path are 05798 * not checked for being oversized. 05799 * @param link 05800 * Place where to store a pointer to the newly created link. No extra 05801 * ref is addded, so you will need to call iso_node_ref() if you really 05802 * need it. You can pass NULL in this parameter if you don't need the 05803 * pointer 05804 * @return 05805 * number of nodes in parent if success, < 0 otherwise 05806 * Possible errors: 05807 * ISO_NULL_POINTER, if parent, name or dest are NULL 05808 * ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists 05809 * ISO_OUT_OF_MEM 05810 * ISO_RR_NAME_TOO_LONG 05811 * 05812 * @since 1.4.2 05813 */ 05814 int iso_image_add_new_symlink(IsoImage *image, IsoDir *parent, 05815 const char *name, const char *dest, 05816 IsoSymlink **link); 05817 05818 /** 05819 * *** Deprecated *** 05820 * use iso_image_add_new_symlink() instead 05821 * 05822 * Add a new symlink to the directory tree without taking into respect name 05823 * truncation mode of an IsoImage. 05824 * For detailed description of parameters, see above 05825 * iso_image_add_new_isymlink(). 05826 * 05827 * @param parent 05828 * the dir where the new symlink will be created 05829 * @param name 05830 * name for the new symlink. 05831 * @param dest 05832 * destination of the link 05833 * @param link 05834 * place where to store a pointer to the newly created link. 05835 * @return 05836 * number of nodes in parent if success, < 0 otherwise 05837 * Possible errors: 05838 * ISO_NULL_POINTER, if parent, name or dest are NULL 05839 * ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists 05840 * ISO_OUT_OF_MEM 05841 * 05842 * @since 0.6.2 05843 */ 05844 int iso_tree_add_new_symlink(IsoDir *parent, const char *name, 05845 const char *dest, IsoSymlink **link); 05846 05847 /** 05848 * Add a new special file to the directory tree. As far as libisofs concerns, 05849 * a special file is a block device, a character device, a FIFO (named pipe) 05850 * or a socket. You can choose the specific kind of file you want to add 05851 * by setting mode propertly (see man 2 stat). 05852 * 05853 * Note that special files are only written to image when Rock Ridge 05854 * extensions are enabled. Moreover, a special file is just a directory entry 05855 * in the image tree, no data is written beyond that. 05856 * 05857 * Owner and hidden atts are taken from parent. You can modify any of them 05858 * later. 05859 * 05860 * @param image 05861 * The image object to which the new special file shall belong. 05862 * @param parent 05863 * The directory node where the new special file will be grafted in. 05864 * @param name 05865 * Name for the new special file. If truncation mode is set to 1, 05866 * an oversized name gets truncated before further processing. 05867 * If a node with same name already exists on parent, this function 05868 * fails with ISO_NODE_NAME_NOT_UNIQUE. 05869 * @param mode 05870 * File type and permissions for the new node. Note that only the file 05871 * types S_IFSOCK, S_IFBLK, S_IFCHR, and S_IFIFO are allowed. 05872 * S_IFLNK, S_IFREG, or S_IFDIR are not. 05873 * @param dev 05874 * Device ID, equivalent to the st_rdev field in man 2 stat. 05875 * @param special 05876 * Place where to store a pointer to the newly created special file. No 05877 * extra ref is addded, so you will need to call iso_node_ref() if you 05878 * really need it. You can pass NULL in this parameter if you don't need 05879 * the pointer. 05880 * @return 05881 * Number of nodes in parent if success, < 0 otherwise 05882 * Possible errors: 05883 * ISO_NULL_POINTER, if parent, name or dest are NULL 05884 * ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists 05885 * ISO_WRONG_ARG_VALUE if you select a incorrect mode 05886 * ISO_OUT_OF_MEM 05887 * ISO_RR_NAME_TOO_LONG 05888 * 05889 * @since 1.4.2 05890 */ 05891 int iso_image_add_new_special(IsoImage *image, IsoDir *parent, 05892 const char *name, mode_t mode, 05893 dev_t dev, IsoSpecial **special); 05894 05895 /** 05896 * *** Deprecated *** 05897 * use iso_image_add_new_special() instead 05898 * 05899 * Add a new special file to the directory tree without taking into respect name 05900 * truncation mode of an IsoImage. 05901 * For detailed description of parameters, see above 05902 * iso_image_add_new_special(). 05903 * 05904 * @param parent 05905 * the dir where the new special file will be created 05906 * @param name 05907 * name for the new special file. 05908 * @param mode 05909 * file type and permissions for the new node. 05910 * @param dev 05911 * device ID, equivalent to the st_rdev field in man 2 stat. 05912 * @param special 05913 * place where to store a pointer to the newly created special file. 05914 * @return 05915 * number of nodes in parent if success, < 0 otherwise 05916 * Possible errors: 05917 * ISO_NULL_POINTER, if parent, name or dest are NULL 05918 * ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists 05919 * ISO_WRONG_ARG_VALUE if you select a incorrect mode 05920 * ISO_OUT_OF_MEM 05921 * 05922 * @since 0.6.2 05923 */ 05924 int iso_tree_add_new_special(IsoDir *parent, const char *name, mode_t mode, 05925 dev_t dev, IsoSpecial **special); 05926 05927 /** 05928 * Set whether to follow or not symbolic links when added a file from a source 05929 * to IsoImage. Default behavior is to not follow symlinks. 05930 * 05931 * @since 0.6.2 05932 */ 05933 void iso_tree_set_follow_symlinks(IsoImage *image, int follow); 05934 05935 /** 05936 * Get current setting for follow_symlinks. 05937 * 05938 * @see iso_tree_set_follow_symlinks 05939 * @since 0.6.2 05940 */ 05941 int iso_tree_get_follow_symlinks(IsoImage *image); 05942 05943 /** 05944 * Set whether to skip or not disk files with names beginning by '.' 05945 * when adding a directory recursively. 05946 * Default behavior is to not ignore them. 05947 * 05948 * Clarification: This is not related to the IsoNode property to be hidden 05949 * in one or more of the resulting image trees as of 05950 * IsoHideNodeFlag and iso_node_set_hidden(). 05951 * 05952 * @since 0.6.2 05953 */ 05954 void iso_tree_set_ignore_hidden(IsoImage *image, int skip); 05955 05956 /** 05957 * Get current setting for ignore_hidden. 05958 * 05959 * @see iso_tree_set_ignore_hidden 05960 * @since 0.6.2 05961 */ 05962 int iso_tree_get_ignore_hidden(IsoImage *image); 05963 05964 /** 05965 * Set the replace mode, that defines the behavior of libisofs when adding 05966 * a node whit the same name that an existent one, during a recursive 05967 * directory addition. 05968 * 05969 * @since 0.6.2 05970 */ 05971 void iso_tree_set_replace_mode(IsoImage *image, enum iso_replace_mode mode); 05972 05973 /** 05974 * Get current setting for replace_mode. 05975 * 05976 * @see iso_tree_set_replace_mode 05977 * @since 0.6.2 05978 */ 05979 enum iso_replace_mode iso_tree_get_replace_mode(IsoImage *image); 05980 05981 /** 05982 * Set whether to skip or not special files. Default behavior is to not skip 05983 * them. Note that, despite of this setting, special files will never be added 05984 * to an image unless RR extensions were enabled. 05985 * 05986 * @param image 05987 * The image to manipulate. 05988 * @param skip 05989 * Bitmask to determine what kind of special files will be skipped: 05990 * bit0: ignore FIFOs 05991 * bit1: ignore Sockets 05992 * bit2: ignore char devices 05993 * bit3: ignore block devices 05994 * 05995 * @since 0.6.2 05996 */ 05997 void iso_tree_set_ignore_special(IsoImage *image, int skip); 05998 05999 /** 06000 * Get current setting for ignore_special. 06001 * 06002 * @see iso_tree_set_ignore_special 06003 * @since 0.6.2 06004 */ 06005 int iso_tree_get_ignore_special(IsoImage *image); 06006 06007 /** 06008 * Add a excluded path. These are paths that won't never added to image, and 06009 * will be excluded even when adding recursively its parent directory. 06010 * 06011 * For example, in 06012 * 06013 * iso_tree_add_exclude(image, "/home/user/data/private"); 06014 * iso_tree_add_dir_rec(image, root, "/home/user/data"); 06015 * 06016 * the directory /home/user/data/private won't be added to image. 06017 * 06018 * However, if you explicity add a deeper dir, it won't be excluded. i.e., 06019 * in the following example. 06020 * 06021 * iso_tree_add_exclude(image, "/home/user/data"); 06022 * iso_tree_add_dir_rec(image, root, "/home/user/data/private"); 06023 * 06024 * the directory /home/user/data/private is added. On the other, side, and 06025 * following the example above, 06026 * 06027 * iso_tree_add_dir_rec(image, root, "/home/user"); 06028 * 06029 * will exclude the directory "/home/user/data". 06030 * 06031 * Absolute paths are not mandatory, you can, for example, add a relative 06032 * path such as: 06033 * 06034 * iso_tree_add_exclude(image, "private"); 06035 * iso_tree_add_exclude(image, "user/data"); 06036 * 06037 * to exclude, respectively, all files or dirs named private, and also all 06038 * files or dirs named data that belong to a folder named "user". Note that the 06039 * above rule about deeper dirs is still valid. i.e., if you call 06040 * 06041 * iso_tree_add_dir_rec(image, root, "/home/user/data/music"); 06042 * 06043 * it is included even containing "user/data" string. However, a possible 06044 * "/home/user/data/music/user/data" is not added. 06045 * 06046 * Usual wildcards, such as * or ? are also supported, with the usual meaning 06047 * as stated in "man 7 glob". For example 06048 * 06049 * // to exclude backup text files 06050 * iso_tree_add_exclude(image, "*.~"); 06051 * 06052 * @return 06053 * 1 on success, < 0 on error 06054 * 06055 * @since 0.6.2 06056 */ 06057 int iso_tree_add_exclude(IsoImage *image, const char *path); 06058 06059 /** 06060 * Remove a previously added exclude. 06061 * 06062 * @see iso_tree_add_exclude 06063 * @return 06064 * 1 on success, 0 exclude do not exists, < 0 on error 06065 * 06066 * @since 0.6.2 06067 */ 06068 int iso_tree_remove_exclude(IsoImage *image, const char *path); 06069 06070 /** 06071 * Set a callback function that libisofs will call for each file that is 06072 * added to the given image by a recursive addition function. This includes 06073 * image import. 06074 * 06075 * @param image 06076 * The image to manipulate. 06077 * @param report 06078 * pointer to a function that will be called just before a file will be 06079 * added to the image. You can control whether the file will be in fact 06080 * added or ignored. 06081 * This function should return 1 to add the file, 0 to ignore it and 06082 * continue, < 0 to abort the process 06083 * NULL is allowed if you don't want any callback. 06084 * 06085 * @since 0.6.2 06086 */ 06087 void iso_tree_set_report_callback(IsoImage *image, 06088 int (*report)(IsoImage*, IsoFileSource*)); 06089 06090 /** 06091 * Add a new node to the image tree, from an existing file. 06092 * 06093 * TODO comment Builder and Filesystem related issues when exposing both 06094 * 06095 * All attributes will be taken from the source file. The appropriate file 06096 * type will be created. 06097 * 06098 * @param image 06099 * The image 06100 * @param parent 06101 * The directory in the image tree where the node will be added. 06102 * @param path 06103 * The absolute path of the file in the local filesystem. 06104 * The node will have the same leaf name as the file on disk, possibly 06105 * truncated according to iso_image_set_truncate_mode(). 06106 * Its directory path depends on the parent node. 06107 * @param node 06108 * place where to store a pointer to the newly added file. No 06109 * extra ref is addded, so you will need to call iso_node_ref() if you 06110 * really need it. You can pass NULL in this parameter if you don't need 06111 * the pointer. 06112 * @return 06113 * number of nodes in parent if success, < 0 otherwise 06114 * Possible errors: 06115 * ISO_NULL_POINTER, if image, parent or path are NULL 06116 * ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists 06117 * ISO_OUT_OF_MEM 06118 * ISO_RR_NAME_TOO_LONG 06119 * 06120 * @since 0.6.2 06121 */ 06122 int iso_tree_add_node(IsoImage *image, IsoDir *parent, const char *path, 06123 IsoNode **node); 06124 06125 /** 06126 * This is a more versatile form of iso_tree_add_node which allows to set 06127 * the node name in ISO image already when it gets added. 06128 * 06129 * Add a new node to the image tree, from an existing file, and with the 06130 * given name, that must not exist on dir. 06131 * 06132 * @param image 06133 * The image 06134 * @param parent 06135 * The directory in the image tree where the node will be added. 06136 * @param name 06137 * The leaf name that the node will have on image, possibly truncated 06138 * according to iso_image_set_truncate_mode(). 06139 * Its directory path depends on the parent node. 06140 * @param path 06141 * The absolute path of the file in the local filesystem. 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.4 06156 */ 06157 int iso_tree_add_new_node(IsoImage *image, IsoDir *parent, const char *name, 06158 const char *path, IsoNode **node); 06159 06160 /** 06161 * Add a new node to the image tree with the given name that must not exist 06162 * on dir. The node data content will be a byte interval out of the data 06163 * content of a file in the local filesystem. 06164 * 06165 * @param image 06166 * The image 06167 * @param parent 06168 * The directory in the image tree where the node will be added. 06169 * @param name 06170 * The leaf name that the node will have on image, possibly truncated 06171 * according to iso_image_set_truncate_mode(). 06172 * Its directory path depends on the parent node. 06173 * @param path 06174 * The absolute path of the file in the local filesystem. For now 06175 * only regular files and symlinks to regular files are supported. 06176 * @param offset 06177 * Byte number in the given file from where to start reading data. 06178 * @param size 06179 * Max size of the file. This may be more than actually available from 06180 * byte offset to the end of the file in the local filesystem. 06181 * @param node 06182 * place where to store a pointer to the newly added file. No 06183 * extra ref is addded, so you will need to call iso_node_ref() if you 06184 * really need it. You can pass NULL in this parameter if you don't need 06185 * the pointer. 06186 * @return 06187 * number of nodes in parent if success, < 0 otherwise 06188 * Possible errors: 06189 * ISO_NULL_POINTER, if image, parent or path are NULL 06190 * ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists 06191 * ISO_OUT_OF_MEM 06192 * ISO_RR_NAME_TOO_LONG 06193 * 06194 * @since 0.6.4 06195 */ 06196 int iso_tree_add_new_cut_out_node(IsoImage *image, IsoDir *parent, 06197 const char *name, const char *path, 06198 off_t offset, off_t size, 06199 IsoNode **node); 06200 06201 /** 06202 * Create a copy of the given node under a different path. If the node is 06203 * actually a directory then clone its whole subtree. 06204 * This call may fail because an IsoFile is encountered which gets fed by an 06205 * IsoStream which cannot be cloned. See also IsoStream_Iface method 06206 * clone_stream(). 06207 * Surely clonable node types are: 06208 * IsoDir, 06209 * IsoSymlink, 06210 * IsoSpecial, 06211 * IsoFile from a loaded ISO image, 06212 * IsoFile referring to local filesystem files, 06213 * IsoFile created by iso_tree_add_new_file 06214 * from a stream created by iso_memory_stream_new(), 06215 * IsoFile created by iso_tree_add_new_cut_out_node() 06216 * Silently ignored are nodes of type IsoBoot. 06217 * An IsoFile node with IsoStream filters can be cloned if all those filters 06218 * are clonable and the node would be clonable without filter. 06219 * Clonable IsoStream filters are created by: 06220 * iso_file_add_zisofs_filter() 06221 * iso_file_add_gzip_filter() 06222 * iso_file_add_external_filter() 06223 * An IsoNode with extended information as of iso_node_add_xinfo() can only be 06224 * cloned if each of the iso_node_xinfo_func instances is associated to a 06225 * clone function. See iso_node_xinfo_make_clonable(). 06226 * All internally used classes of extended information are clonable. 06227 * 06228 * The IsoImage context defines a maximum permissible name length and a mode 06229 * how to react on oversized names. See iso_image_set_truncate_mode(). 06230 * 06231 * @param image 06232 * The image object to which the node belongs. 06233 * @param node 06234 * The node to be cloned. 06235 * @param new_parent 06236 * The existing directory node where to insert the cloned node. 06237 * @param new_name 06238 * The name for the cloned node. It must not yet exist in new_parent, 06239 * unless it is a directory and node is a directory and flag bit0 is set. 06240 * @param new_node 06241 * Will return a pointer (without reference) to the newly created clone. 06242 * @param flag 06243 * Bitfield for control purposes. Submit any undefined bits as 0. 06244 * bit0= Merge directories rather than returning ISO_NODE_NAME_NOT_UNIQUE. 06245 * This will not allow to overwrite any existing node. 06246 * Attributes of existing directories will not be overwritten. 06247 * bit1= issue warning in case of new_name truncation 06248 * @return 06249 * <0 means error, 1 = new node created, 06250 * 2 = if flag bit0 is set: new_node is a directory which already existed. 06251 * 06252 * @since 1.4.2 06253 */ 06254 int iso_image_tree_clone(IsoImage *image, IsoNode *node, IsoDir *new_parent, 06255 char *new_name, IsoNode **new_node, int flag); 06256 06257 /** 06258 * *** Deprecated *** 06259 * use iso_image_tree_clone() instead 06260 * 06261 * Create a copy of the given node under a different path without taking 06262 * into respect name truncation mode of an IsoImage. 06263 * 06264 * @param node 06265 * The node to be cloned. 06266 * @param new_parent 06267 * The existing directory node where to insert the cloned node. 06268 * @param new_name 06269 * The name for the cloned node. It must not yet exist in new_parent, 06270 * unless it is a directory and node is a directory and flag bit0 is set. 06271 * @param new_node 06272 * Will return a pointer (without reference) to the newly created clone. 06273 * @param flag 06274 * Bitfield for control purposes. Submit any undefined bits as 0. 06275 * bit0= Merge directories rather than returning ISO_NODE_NAME_NOT_UNIQUE. 06276 * This will not allow to overwrite any existing node. 06277 * Attributes of existing directories will not be overwritten. 06278 * @return 06279 * <0 means error, 1 = new node created, 06280 * 2 = if flag bit0 is set: new_node is a directory which already existed. 06281 * 06282 * @since 1.0.2 06283 */ 06284 int iso_tree_clone(IsoNode *node, 06285 IsoDir *new_parent, char *new_name, IsoNode **new_node, 06286 int flag); 06287 06288 /** 06289 * Add the contents of a dir to a given directory of the iso tree. 06290 * 06291 * There are several options to control what files are added or how they are 06292 * managed. Take a look at iso_tree_set_* functions to see different options 06293 * for recursive directory addition. 06294 * 06295 * TODO comment Builder and Filesystem related issues when exposing both 06296 * 06297 * @param image 06298 * The image to which the directory belongs. 06299 * @param parent 06300 * Directory on the image tree where to add the contents of the dir 06301 * @param dir 06302 * Path to a dir in the filesystem 06303 * @return 06304 * number of nodes in parent if success, < 0 otherwise 06305 * 06306 * @since 0.6.2 06307 */ 06308 int iso_tree_add_dir_rec(IsoImage *image, IsoDir *parent, const char *dir); 06309 06310 /** 06311 * Locate a node by its absolute path in the image. 06312 * The IsoImage context defines a maximum permissible name length and a mode 06313 * how to react on oversized names. See iso_image_set_truncate_mode(). 06314 * 06315 * @param image 06316 * The image to which the node belongs. 06317 * @param path 06318 * File path beginning at the root directory of image. If truncation mode 06319 * is set to 1, oversized path components will be truncated before lookup. 06320 * @param node 06321 * Location for a pointer to the node, it will be filled with NULL if the 06322 * given path does not exists on image. 06323 * The node will be owned by the image and shouldn't be unref(). Just call 06324 * iso_node_ref() to get your own reference to the node. 06325 * Note that you can pass NULL is the only thing you want to do is check 06326 * if a node with such path really exists. 06327 * 06328 * @return 06329 * 1 node found 06330 * 0 no truncation was needed, path not found in image 06331 * 2 truncation happened, truncated path component not found in parent dir 06332 * < 0 error, see iso_dir_get_node(). 06333 * 06334 * @since 1.4.2 06335 */ 06336 int iso_image_path_to_node(IsoImage *image, const char *path, IsoNode **node); 06337 06338 /** 06339 * *** Deprecated *** 06340 * In most cases use iso_image_path_to_node() instead 06341 * 06342 * Locate a node by its absolute path on image without taking into respect 06343 * name truncation mode of the image. 06344 * 06345 * @param image 06346 * The image to which the node belongs. 06347 * @param path 06348 * File path beginning at the root directory of image. No truncation will 06349 * happen. 06350 * @param node 06351 * Location for a pointer to the node, it will be filled with NULL if the 06352 * given path does not exists on image. See iso_image_path_to_node(). 06353 * @return 06354 * 1 found, 0 not found, < 0 error 06355 * 06356 * @since 0.6.2 06357 */ 06358 int iso_tree_path_to_node(IsoImage *image, const char *path, IsoNode **node); 06359 06360 /** 06361 * Get the absolute path on image of the given node. 06362 * 06363 * @return 06364 * The path on the image, that must be freed when no more needed. If the 06365 * given node is not added to any image, this returns NULL. 06366 * @since 0.6.4 06367 */ 06368 char *iso_tree_get_node_path(IsoNode *node); 06369 06370 /** 06371 * Get the destination node of a symbolic link within the IsoImage. 06372 * 06373 * @param img 06374 * The image wherein to try resolving the link. 06375 * @param sym 06376 * The symbolic link node which to resolve. 06377 * @param res 06378 * Will return the found destination node, in case of success. 06379 * Call iso_node_ref() / iso_node_unref() if you intend to use the node 06380 * over API calls which might in any event delete it. 06381 * @param depth 06382 * Prevents endless loops. Submit as 0. 06383 * @param flag 06384 * Bitfield for control purposes. Submit 0 for now. 06385 * @return 06386 * 1 on success, 06387 * < 0 on failure, especially ISO_DEEP_SYMLINK and ISO_DEAD_SYMLINK 06388 * 06389 * @since 1.2.4 06390 */ 06391 int iso_tree_resolve_symlink(IsoImage *img, IsoSymlink *sym, IsoNode **res, 06392 int *depth, int flag); 06393 06394 /* Maximum number link resolution steps before ISO_DEEP_SYMLINK gets 06395 * returned by iso_tree_resolve_symlink(). 06396 * 06397 * @since 1.2.4 06398 */ 06399 #define LIBISO_MAX_LINK_DEPTH 100 06400 06401 /** 06402 * Increments the reference counting of the given IsoDataSource. 06403 * 06404 * @since 0.6.2 06405 */ 06406 void iso_data_source_ref(IsoDataSource *src); 06407 06408 /** 06409 * Decrements the reference counting of the given IsoDataSource, freeing it 06410 * if refcount reach 0. 06411 * 06412 * @since 0.6.2 06413 */ 06414 void iso_data_source_unref(IsoDataSource *src); 06415 06416 /** 06417 * Create a new IsoDataSource from a local file. This is suitable for 06418 * accessing regular files or block devices with ISO images. 06419 * 06420 * @param path 06421 * The absolute path of the file 06422 * @param src 06423 * Will be filled with the pointer to the newly created data source. 06424 * @return 06425 * 1 on success, < 0 on error. 06426 * 06427 * @since 0.6.2 06428 */ 06429 int iso_data_source_new_from_file(const char *path, IsoDataSource **src); 06430 06431 /** 06432 * Get the status of the buffer used by a burn_source. 06433 * 06434 * @param b 06435 * A burn_source previously obtained with 06436 * iso_image_create_burn_source(). 06437 * @param size 06438 * Will be filled with the total size of the buffer, in bytes 06439 * @param free_bytes 06440 * Will be filled with the bytes currently available in buffer 06441 * @return 06442 * < 0 error, > 0 state: 06443 * 1="active" : input and consumption are active 06444 * 2="ending" : input has ended without error 06445 * 3="failing" : input had error and ended, 06446 * 5="abandoned" : consumption has ended prematurely 06447 * 6="ended" : consumption has ended without input error 06448 * 7="aborted" : consumption has ended after input error 06449 * 06450 * @since 0.6.2 06451 */ 06452 int iso_ring_buffer_get_status(struct burn_source *b, size_t *size, 06453 size_t *free_bytes); 06454 06455 #define ISO_MSGS_MESSAGE_LEN 4096 06456 06457 /** 06458 * Control queueing and stderr printing of messages from libisofs. 06459 * Severity may be one of "NEVER", "FATAL", "SORRY", "WARNING", "HINT", 06460 * "NOTE", "UPDATE", "DEBUG", "ALL". 06461 * 06462 * @param queue_severity Gives the minimum limit for messages to be queued. 06463 * Default: "NEVER". If you queue messages then you 06464 * must consume them by iso_obtain_msgs(). 06465 * @param print_severity Does the same for messages to be printed directly 06466 * to stderr. 06467 * @param print_id A text prefix to be printed before the message. 06468 * @return >0 for success, <=0 for error 06469 * 06470 * @since 0.6.2 06471 */ 06472 int iso_set_msgs_severities(char *queue_severity, char *print_severity, 06473 char *print_id); 06474 06475 /** 06476 * Obtain the oldest pending libisofs message from the queue which has at 06477 * least the given minimum_severity. This message and any older message of 06478 * lower severity will get discarded from the queue and is then lost forever. 06479 * 06480 * Severity may be one of "NEVER", "FATAL", "SORRY", "WARNING", "HINT", 06481 * "NOTE", "UPDATE", "DEBUG", "ALL". To call with minimum_severity "NEVER" 06482 * will discard the whole queue. 06483 * 06484 * @param minimum_severity 06485 * Threshold 06486 * @param error_code 06487 * Will become a unique error code as listed at the end of this header 06488 * @param imgid 06489 * Id of the image that was issued the message. 06490 * @param msg_text 06491 * Must provide at least ISO_MSGS_MESSAGE_LEN bytes. 06492 * @param severity 06493 * Will become the severity related to the message and should provide at 06494 * least 80 bytes. 06495 * @return 06496 * 1 if a matching item was found, 0 if not, <0 for severe errors 06497 * 06498 * @since 0.6.2 06499 */ 06500 int iso_obtain_msgs(char *minimum_severity, int *error_code, int *imgid, 06501 char msg_text[], char severity[]); 06502 06503 06504 /** 06505 * Submit a message to the libisofs queueing system. It will be queued or 06506 * printed as if it was generated by libisofs itself. 06507 * 06508 * @param error_code 06509 * The unique error code of your message. 06510 * Submit 0 if you do not have reserved error codes within the libburnia 06511 * project. 06512 * @param msg_text 06513 * Not more than ISO_MSGS_MESSAGE_LEN characters of message text. 06514 * @param os_errno 06515 * Eventual errno related to the message. Submit 0 if the message is not 06516 * related to a operating system error. 06517 * @param severity 06518 * One of "ABORT", "FATAL", "FAILURE", "SORRY", "WARNING", "HINT", "NOTE", 06519 * "UPDATE", "DEBUG". Defaults to "FATAL". 06520 * @param origin 06521 * Submit 0 for now. 06522 * @return 06523 * 1 if message was delivered, <=0 if failure 06524 * 06525 * @since 0.6.4 06526 */ 06527 int iso_msgs_submit(int error_code, char msg_text[], int os_errno, 06528 char severity[], int origin); 06529 06530 06531 /** 06532 * Convert a severity name into a severity number, which gives the severity 06533 * rank of the name. 06534 * 06535 * @param severity_name 06536 * A name as with iso_msgs_submit(), e.g. "SORRY". 06537 * @param severity_number 06538 * The rank number: the higher, the more severe. 06539 * @return 06540 * >0 success, <=0 failure 06541 * 06542 * @since 0.6.4 06543 */ 06544 int iso_text_to_sev(char *severity_name, int *severity_number); 06545 06546 06547 /** 06548 * Convert a severity number into a severity name 06549 * 06550 * @param severity_number 06551 * The rank number: the higher, the more severe. 06552 * @param severity_name 06553 * A name as with iso_msgs_submit(), e.g. "SORRY". 06554 * 06555 * @since 0.6.4 06556 */ 06557 int iso_sev_to_text(int severity_number, char **severity_name); 06558 06559 06560 /** 06561 * Get the id of an IsoImage, used for message reporting. This message id, 06562 * retrieved with iso_obtain_msgs(), can be used to distinguish what 06563 * IsoImage has isssued a given message. 06564 * 06565 * @since 0.6.2 06566 */ 06567 int iso_image_get_msg_id(IsoImage *image); 06568 06569 /** 06570 * Get a textual description of a libisofs error. 06571 * 06572 * @since 0.6.2 06573 */ 06574 const char *iso_error_to_msg(int errcode); 06575 06576 /** 06577 * Get the severity of a given error code 06578 * @return 06579 * 0x10000000 -> DEBUG 06580 * 0x20000000 -> UPDATE 06581 * 0x30000000 -> NOTE 06582 * 0x40000000 -> HINT 06583 * 0x50000000 -> WARNING 06584 * 0x60000000 -> SORRY 06585 * 0x64000000 -> MISHAP 06586 * 0x68000000 -> FAILURE 06587 * 0x70000000 -> FATAL 06588 * 0x71000000 -> ABORT 06589 * 06590 * @since 0.6.2 06591 */ 06592 int iso_error_get_severity(int e); 06593 06594 /** 06595 * Get the priority of a given error. 06596 * @return 06597 * 0x00000000 -> ZERO 06598 * 0x10000000 -> LOW 06599 * 0x20000000 -> MEDIUM 06600 * 0x30000000 -> HIGH 06601 * 06602 * @since 0.6.2 06603 */ 06604 int iso_error_get_priority(int e); 06605 06606 /** 06607 * Get the message queue code of a libisofs error. 06608 */ 06609 int iso_error_get_code(int e); 06610 06611 /** 06612 * Set the minimum error severity that causes a libisofs operation to 06613 * be aborted as soon as possible. 06614 * 06615 * @param severity 06616 * one of "FAILURE", "MISHAP", "SORRY", "WARNING", "HINT", "NOTE". 06617 * Severities greater or equal than FAILURE always cause program to abort. 06618 * Severities under NOTE won't never cause function abort. 06619 * @return 06620 * Previous abort priority on success, < 0 on error. 06621 * 06622 * @since 0.6.2 06623 */ 06624 int iso_set_abort_severity(char *severity); 06625 06626 /** 06627 * Return the messenger object handle used by libisofs. This handle 06628 * may be used by related libraries to their own compatible 06629 * messenger objects and thus to direct their messages to the libisofs 06630 * message queue. See also: libburn, API function burn_set_messenger(). 06631 * 06632 * @return the handle. Do only use with compatible 06633 * 06634 * @since 0.6.2 06635 */ 06636 void *iso_get_messenger(); 06637 06638 /** 06639 * Take a ref to the given IsoFileSource. 06640 * 06641 * @since 0.6.2 06642 */ 06643 void iso_file_source_ref(IsoFileSource *src); 06644 06645 /** 06646 * Drop your ref to the given IsoFileSource, eventually freeing the associated 06647 * system resources. 06648 * 06649 * @since 0.6.2 06650 */ 06651 void iso_file_source_unref(IsoFileSource *src); 06652 06653 /* 06654 * this are just helpers to invoque methods in class 06655 */ 06656 06657 /** 06658 * Get the absolute path in the filesystem this file source belongs to. 06659 * 06660 * @return 06661 * the path of the FileSource inside the filesystem, it should be 06662 * freed when no more needed. 06663 * 06664 * @since 0.6.2 06665 */ 06666 char* iso_file_source_get_path(IsoFileSource *src); 06667 06668 /** 06669 * Get the name of the file, with the dir component of the path. 06670 * 06671 * @return 06672 * the name of the file, it should be freed when no more needed. 06673 * 06674 * @since 0.6.2 06675 */ 06676 char* iso_file_source_get_name(IsoFileSource *src); 06677 06678 /** 06679 * Get information about the file. 06680 * @return 06681 * 1 success, < 0 error 06682 * Error codes: 06683 * ISO_FILE_ACCESS_DENIED 06684 * ISO_FILE_BAD_PATH 06685 * ISO_FILE_DOESNT_EXIST 06686 * ISO_OUT_OF_MEM 06687 * ISO_FILE_ERROR 06688 * ISO_NULL_POINTER 06689 * 06690 * @since 0.6.2 06691 */ 06692 int iso_file_source_lstat(IsoFileSource *src, struct stat *info); 06693 06694 /** 06695 * Check if the process has access to read file contents. Note that this 06696 * is not necessarily related with (l)stat functions. For example, in a 06697 * filesystem implementation to deal with an ISO image, if the user has 06698 * read access to the image it will be able to read all files inside it, 06699 * despite of the particular permission of each file in the RR tree, that 06700 * are what the above functions return. 06701 * 06702 * @return 06703 * 1 if process has read access, < 0 on error 06704 * Error codes: 06705 * ISO_FILE_ACCESS_DENIED 06706 * ISO_FILE_BAD_PATH 06707 * ISO_FILE_DOESNT_EXIST 06708 * ISO_OUT_OF_MEM 06709 * ISO_FILE_ERROR 06710 * ISO_NULL_POINTER 06711 * 06712 * @since 0.6.2 06713 */ 06714 int iso_file_source_access(IsoFileSource *src); 06715 06716 /** 06717 * Get information about the file. If the file is a symlink, the info 06718 * returned refers to the destination. 06719 * 06720 * @return 06721 * 1 success, < 0 error 06722 * Error codes: 06723 * ISO_FILE_ACCESS_DENIED 06724 * ISO_FILE_BAD_PATH 06725 * ISO_FILE_DOESNT_EXIST 06726 * ISO_OUT_OF_MEM 06727 * ISO_FILE_ERROR 06728 * ISO_NULL_POINTER 06729 * 06730 * @since 0.6.2 06731 */ 06732 int iso_file_source_stat(IsoFileSource *src, struct stat *info); 06733 06734 /** 06735 * Opens the source. 06736 * @return 1 on success, < 0 on error 06737 * Error codes: 06738 * ISO_FILE_ALREADY_OPENED 06739 * ISO_FILE_ACCESS_DENIED 06740 * ISO_FILE_BAD_PATH 06741 * ISO_FILE_DOESNT_EXIST 06742 * ISO_OUT_OF_MEM 06743 * ISO_FILE_ERROR 06744 * ISO_NULL_POINTER 06745 * 06746 * @since 0.6.2 06747 */ 06748 int iso_file_source_open(IsoFileSource *src); 06749 06750 /** 06751 * Close a previuously openned file 06752 * @return 1 on success, < 0 on error 06753 * Error codes: 06754 * ISO_FILE_ERROR 06755 * ISO_NULL_POINTER 06756 * ISO_FILE_NOT_OPENED 06757 * 06758 * @since 0.6.2 06759 */ 06760 int iso_file_source_close(IsoFileSource *src); 06761 06762 /** 06763 * Attempts to read up to count bytes from the given source into 06764 * the buffer starting at buf. 06765 * 06766 * The file src must be open() before calling this, and close() when no 06767 * more needed. Not valid for dirs. On symlinks it reads the destination 06768 * file. 06769 * 06770 * @param src 06771 * The given source 06772 * @param buf 06773 * Pointer to a buffer of at least count bytes where the read data will be 06774 * stored 06775 * @param count 06776 * Bytes to read 06777 * @return 06778 * number of bytes read, 0 if EOF, < 0 on error 06779 * Error codes: 06780 * ISO_FILE_ERROR 06781 * ISO_NULL_POINTER 06782 * ISO_FILE_NOT_OPENED 06783 * ISO_WRONG_ARG_VALUE -> if count == 0 06784 * ISO_FILE_IS_DIR 06785 * ISO_OUT_OF_MEM 06786 * ISO_INTERRUPTED 06787 * 06788 * @since 0.6.2 06789 */ 06790 int iso_file_source_read(IsoFileSource *src, void *buf, size_t count); 06791 06792 /** 06793 * Repositions the offset of the given IsoFileSource (must be opened) to the 06794 * given offset according to the value of flag. 06795 * 06796 * @param src 06797 * The given source 06798 * @param offset 06799 * in bytes 06800 * @param flag 06801 * 0 The offset is set to offset bytes (SEEK_SET) 06802 * 1 The offset is set to its current location plus offset bytes 06803 * (SEEK_CUR) 06804 * 2 The offset is set to the size of the file plus offset bytes 06805 * (SEEK_END). 06806 * @return 06807 * Absolute offset posistion on the file, or < 0 on error. Cast the 06808 * returning value to int to get a valid libisofs error. 06809 * @since 0.6.4 06810 */ 06811 off_t iso_file_source_lseek(IsoFileSource *src, off_t offset, int flag); 06812 06813 /** 06814 * Read a directory. 06815 * 06816 * Each call to this function will return a new child, until we reach 06817 * the end of file (i.e, no more children), in that case it returns 0. 06818 * 06819 * The dir must be open() before calling this, and close() when no more 06820 * needed. Only valid for dirs. 06821 * 06822 * Note that "." and ".." children MUST NOT BE returned. 06823 * 06824 * @param src 06825 * The given source 06826 * @param child 06827 * pointer to be filled with the given child. Undefined on error or OEF 06828 * @return 06829 * 1 on success, 0 if EOF (no more children), < 0 on error 06830 * Error codes: 06831 * ISO_FILE_ERROR 06832 * ISO_NULL_POINTER 06833 * ISO_FILE_NOT_OPENED 06834 * ISO_FILE_IS_NOT_DIR 06835 * ISO_OUT_OF_MEM 06836 * 06837 * @since 0.6.2 06838 */ 06839 int iso_file_source_readdir(IsoFileSource *src, IsoFileSource **child); 06840 06841 /** 06842 * Read the destination of a symlink. You don't need to open the file 06843 * to call this. 06844 * 06845 * @param src 06846 * An IsoFileSource corresponding to a symbolic link. 06847 * @param buf 06848 * Allocated buffer of at least bufsiz bytes. 06849 * The destination string will be copied there, and it will be 0-terminated 06850 * if the return value indicates success or ISO_RR_PATH_TOO_LONG. 06851 * @param bufsiz 06852 * Maximum number of buf characters + 1. The string will be truncated if 06853 * it is larger than bufsiz - 1 and ISO_RR_PATH_TOO_LONG. will be returned. 06854 * @return 06855 * 1 on success, < 0 on error 06856 * Error codes: 06857 * ISO_FILE_ERROR 06858 * ISO_NULL_POINTER 06859 * ISO_WRONG_ARG_VALUE -> if bufsiz <= 0 06860 * ISO_FILE_IS_NOT_SYMLINK 06861 * ISO_OUT_OF_MEM 06862 * ISO_FILE_BAD_PATH 06863 * ISO_FILE_DOESNT_EXIST 06864 * ISO_RR_PATH_TOO_LONG (@since 1.0.6) 06865 * 06866 * @since 0.6.2 06867 */ 06868 int iso_file_source_readlink(IsoFileSource *src, char *buf, size_t bufsiz); 06869 06870 06871 /** 06872 * Get the AAIP string with encoded ACL and xattr. 06873 * (Not to be confused with ECMA-119 Extended Attributes). 06874 * @param src The file source object to be inquired. 06875 * @param aa_string Returns a pointer to the AAIP string data. If no AAIP 06876 * string is available, *aa_string becomes NULL. 06877 * (See doc/susp_aaip_2_0.txt for the meaning of AAIP.) 06878 * The caller is responsible for finally calling free() 06879 * on non-NULL results. 06880 * @param flag Bitfield for control purposes 06881 * bit0= Transfer ownership of AAIP string data. 06882 * src will free the eventual cached data and might 06883 * not be able to produce it again. 06884 * bit1= No need to get ACL (but no guarantee of exclusion) 06885 * bit2= No need to get xattr (but no guarantee of exclusion) 06886 * @return 1 means success (*aa_string == NULL is possible) 06887 * <0 means failure and must b a valid libisofs error code 06888 * (e.g. ISO_FILE_ERROR if no better one can be found). 06889 * @since 0.6.14 06890 */ 06891 int iso_file_source_get_aa_string(IsoFileSource *src, 06892 unsigned char **aa_string, int flag); 06893 06894 /** 06895 * Get the filesystem for this source. No extra ref is added, so you 06896 * musn't unref the IsoFilesystem. 06897 * 06898 * @return 06899 * The filesystem, NULL on error 06900 * 06901 * @since 0.6.2 06902 */ 06903 IsoFilesystem* iso_file_source_get_filesystem(IsoFileSource *src); 06904 06905 /** 06906 * Take a ref to the given IsoFilesystem 06907 * 06908 * @since 0.6.2 06909 */ 06910 void iso_filesystem_ref(IsoFilesystem *fs); 06911 06912 /** 06913 * Drop your ref to the given IsoFilesystem, evetually freeing associated 06914 * resources. 06915 * 06916 * @since 0.6.2 06917 */ 06918 void iso_filesystem_unref(IsoFilesystem *fs); 06919 06920 /** 06921 * Create a new IsoFilesystem to access a existent ISO image. 06922 * 06923 * @param src 06924 * Data source to access data. 06925 * @param opts 06926 * Image read options 06927 * @param msgid 06928 * An image identifer, obtained with iso_image_get_msg_id(), used to 06929 * associated messages issued by the filesystem implementation with an 06930 * existent image. If you are not using this filesystem in relation with 06931 * any image context, just use 0x1fffff as the value for this parameter. 06932 * @param fs 06933 * Will be filled with a pointer to the filesystem that can be used 06934 * to access image contents. 06935 * @return 06936 * 1 on success, < 0 on error 06937 * 06938 * @since 0.6.2 06939 */ 06940 int iso_image_filesystem_new(IsoDataSource *src, IsoReadOpts *opts, int msgid, 06941 IsoImageFilesystem **fs); 06942 06943 /** 06944 * Get the volset identifier for an existent image. The returned string belong 06945 * to the IsoImageFilesystem and shouldn't be free() nor modified. 06946 * 06947 * @since 0.6.2 06948 */ 06949 const char *iso_image_fs_get_volset_id(IsoImageFilesystem *fs); 06950 06951 /** 06952 * Get the volume identifier for an existent image. The returned string belong 06953 * to the IsoImageFilesystem and shouldn't be free() nor modified. 06954 * 06955 * @since 0.6.2 06956 */ 06957 const char *iso_image_fs_get_volume_id(IsoImageFilesystem *fs); 06958 06959 /** 06960 * Get the publisher identifier for an existent image. The returned string 06961 * belong to the IsoImageFilesystem and shouldn't be free() nor modified. 06962 * 06963 * @since 0.6.2 06964 */ 06965 const char *iso_image_fs_get_publisher_id(IsoImageFilesystem *fs); 06966 06967 /** 06968 * Get the data preparer identifier for an existent image. The returned string 06969 * belong to the IsoImageFilesystem and shouldn't be free() nor modified. 06970 * 06971 * @since 0.6.2 06972 */ 06973 const char *iso_image_fs_get_data_preparer_id(IsoImageFilesystem *fs); 06974 06975 /** 06976 * Get the system identifier for an existent image. The returned string belong 06977 * to the IsoImageFilesystem and shouldn't be free() nor modified. 06978 * 06979 * @since 0.6.2 06980 */ 06981 const char *iso_image_fs_get_system_id(IsoImageFilesystem *fs); 06982 06983 /** 06984 * Get the application identifier for an existent image. The returned string 06985 * belong to the IsoImageFilesystem and shouldn't be free() nor modified. 06986 * 06987 * @since 0.6.2 06988 */ 06989 const char *iso_image_fs_get_application_id(IsoImageFilesystem *fs); 06990 06991 /** 06992 * Get the copyright file identifier for an existent image. The returned string 06993 * belong to the IsoImageFilesystem and shouldn't be free() nor modified. 06994 * 06995 * @since 0.6.2 06996 */ 06997 const char *iso_image_fs_get_copyright_file_id(IsoImageFilesystem *fs); 06998 06999 /** 07000 * Get the abstract file identifier for an existent image. The returned string 07001 * belong to the IsoImageFilesystem and shouldn't be free() nor modified. 07002 * 07003 * @since 0.6.2 07004 */ 07005 const char *iso_image_fs_get_abstract_file_id(IsoImageFilesystem *fs); 07006 07007 /** 07008 * Get the biblio file identifier for an existent image. The returned string 07009 * belong to the IsoImageFilesystem and shouldn't be free() nor modified. 07010 * 07011 * @since 0.6.2 07012 */ 07013 const char *iso_image_fs_get_biblio_file_id(IsoImageFilesystem *fs); 07014 07015 /** 07016 * Increment reference count of an IsoStream. 07017 * 07018 * @since 0.6.4 07019 */ 07020 void iso_stream_ref(IsoStream *stream); 07021 07022 /** 07023 * Decrement reference count of an IsoStream, and eventually free it if 07024 * refcount reach 0. 07025 * 07026 * @since 0.6.4 07027 */ 07028 void iso_stream_unref(IsoStream *stream); 07029 07030 /** 07031 * Opens the given stream. Remember to close the Stream before writing the 07032 * image. 07033 * 07034 * @return 07035 * 1 on success, 2 file greater than expected, 3 file smaller than 07036 * expected, < 0 on error 07037 * 07038 * @since 0.6.4 07039 */ 07040 int iso_stream_open(IsoStream *stream); 07041 07042 /** 07043 * Close a previously openned IsoStream. 07044 * 07045 * @return 07046 * 1 on success, < 0 on error 07047 * 07048 * @since 0.6.4 07049 */ 07050 int iso_stream_close(IsoStream *stream); 07051 07052 /** 07053 * Get the size of a given stream. This function should always return the same 07054 * size, even if the underlying source size changes, unless you call 07055 * iso_stream_update_size(). 07056 * 07057 * @return 07058 * IsoStream size in bytes 07059 * 07060 * @since 0.6.4 07061 */ 07062 off_t iso_stream_get_size(IsoStream *stream); 07063 07064 /** 07065 * Attempts to read up to count bytes from the given stream into 07066 * the buffer starting at buf. 07067 * 07068 * The stream must be open() before calling this, and close() when no 07069 * more needed. 07070 * 07071 * @return 07072 * number of bytes read, 0 if EOF, < 0 on error 07073 * 07074 * @since 0.6.4 07075 */ 07076 int iso_stream_read(IsoStream *stream, void *buf, size_t count); 07077 07078 /** 07079 * Whether the given IsoStream can be read several times, with the same 07080 * results. 07081 * For example, a regular file is repeatable, you can read it as many 07082 * times as you want. However, a pipe isn't. 07083 * 07084 * This function doesn't take into account if the file has been modified 07085 * between the two reads. 07086 * 07087 * @return 07088 * 1 if stream is repeatable, 0 if not, < 0 on error 07089 * 07090 * @since 0.6.4 07091 */ 07092 int iso_stream_is_repeatable(IsoStream *stream); 07093 07094 /** 07095 * Updates the size of the IsoStream with the current size of the 07096 * underlying source. 07097 * 07098 * @return 07099 * 1 if ok, < 0 on error (has to be a valid libisofs error code), 07100 * 0 if the IsoStream does not support this function. 07101 * @since 0.6.8 07102 */ 07103 int iso_stream_update_size(IsoStream *stream); 07104 07105 /** 07106 * Get an unique identifier for a given IsoStream. 07107 * 07108 * @since 0.6.4 07109 */ 07110 void iso_stream_get_id(IsoStream *stream, unsigned int *fs_id, dev_t *dev_id, 07111 ino_t *ino_id); 07112 07113 /** 07114 * Try to get eventual source path string of a stream. Meaning and availability 07115 * of this string depends on the stream.class . Expect valid results with 07116 * types "fsrc" and "cout". Result formats are 07117 * fsrc: result of file_source_get_path() 07118 * cout: result of file_source_get_path() " " offset " " size 07119 * @param stream 07120 * The stream to be inquired. 07121 * @param flag 07122 * Bitfield for control purposes, unused yet, submit 0 07123 * @return 07124 * A copy of the path string. Apply free() when no longer needed. 07125 * NULL if no path string is available. 07126 * 07127 * @since 0.6.18 07128 */ 07129 char *iso_stream_get_source_path(IsoStream *stream, int flag); 07130 07131 /** 07132 * Compare two streams whether they are based on the same input and will 07133 * produce the same output. If in any doubt, then this comparison will 07134 * indicate no match. 07135 * 07136 * @param s1 07137 * The first stream to compare. 07138 * @param s2 07139 * The second stream to compare. 07140 * @return 07141 * -1 if s1 is smaller s2 , 0 if s1 matches s2 , 1 if s1 is larger s2 07142 * @param flag 07143 * bit0= do not use s1->class->cmp_ino() even if available 07144 * 07145 * @since 0.6.20 07146 */ 07147 int iso_stream_cmp_ino(IsoStream *s1, IsoStream *s2, int flag); 07148 07149 07150 /** 07151 * Produce a copy of a stream. It must be possible to operate both stream 07152 * objects concurrently. The success of this function depends on the 07153 * existence of a IsoStream_Iface.clone_stream() method with the stream 07154 * and with its eventual subordinate streams. 07155 * See iso_tree_clone() for a list of surely clonable built-in streams. 07156 * 07157 * @param old_stream 07158 * The existing stream object to be copied 07159 * @param new_stream 07160 * Will return a pointer to the copy 07161 * @param flag 07162 * Bitfield for control purposes. Submit 0 for now. 07163 * @return 07164 * >0 means success 07165 * ISO_STREAM_NO_CLONE is issued if no .clone_stream() exists 07166 * other error return values < 0 may occur depending on kind of stream 07167 * 07168 * @since 1.0.2 07169 */ 07170 int iso_stream_clone(IsoStream *old_stream, IsoStream **new_stream, int flag); 07171 07172 07173 /* --------------------------------- AAIP --------------------------------- */ 07174 07175 /** 07176 * Function to identify and manage AAIP strings as xinfo of IsoNode. 07177 * 07178 * An AAIP string contains the Attribute List with the xattr and ACL of a node 07179 * in the image tree. It is formatted according to libisofs specification 07180 * AAIP-2.0 and ready to be written into the System Use Area or Continuation 07181 * Area of a directory entry in an ISO image. 07182 * 07183 * Applications are not supposed to manipulate AAIP strings directly. 07184 * They should rather make use of the appropriate iso_node_get_* and 07185 * iso_node_set_* calls. 07186 * 07187 * AAIP represents ACLs as xattr with empty name and AAIP-specific binary 07188 * content. Local filesystems may represent ACLs as xattr with names like 07189 * "system.posix_acl_access". libisofs does not interpret those local 07190 * xattr representations of ACL directly but rather uses the ACL interface of 07191 * the local system. By default the local xattr representations of ACL will 07192 * not become part of the AAIP Attribute List via iso_local_get_attrs() and 07193 * not be attached to local files via iso_local_set_attrs(). 07194 * 07195 * @since 0.6.14 07196 */ 07197 int aaip_xinfo_func(void *data, int flag); 07198 07199 /** 07200 * The iso_node_xinfo_cloner function which gets associated to aaip_xinfo_func 07201 * by iso_init() or iso_init_with_flag() via iso_node_xinfo_make_clonable(). 07202 * @since 1.0.2 07203 */ 07204 int aaip_xinfo_cloner(void *old_data, void **new_data, int flag); 07205 07206 /** 07207 * Get the eventual ACLs which are associated with the node. 07208 * The result will be in "long" text form as of man acl and acl_to_text(). 07209 * Call this function with flag bit15 to finally release the memory 07210 * occupied by an ACL inquiry. 07211 * 07212 * @param node 07213 * The node that is to be inquired. 07214 * @param access_text 07215 * Will return a pointer to the eventual "access" ACL text or NULL if it 07216 * is not available and flag bit 4 is set. 07217 * @param default_text 07218 * Will return a pointer to the eventual "default" ACL or NULL if it 07219 * is not available. 07220 * (GNU/Linux directories can have a "default" ACL which influences 07221 * the permissions of newly created files.) 07222 * @param flag 07223 * Bitfield for control purposes 07224 * bit4= if no "access" ACL is available: return *access_text == NULL 07225 * else: produce ACL from stat(2) permissions 07226 * bit15= free memory and return 1 (node may be NULL) 07227 * @return 07228 * 2 *access_text was produced from stat(2) permissions 07229 * 1 *access_text was produced from ACL of node 07230 * 0 if flag bit4 is set and no ACL is available 07231 * < 0 on error 07232 * 07233 * @since 0.6.14 07234 */ 07235 int iso_node_get_acl_text(IsoNode *node, 07236 char **access_text, char **default_text, int flag); 07237 07238 07239 /** 07240 * Set the ACLs of the given node to the lists in parameters access_text and 07241 * default_text or delete them. 07242 * 07243 * The stat(2) permission bits get updated according to the new "access" ACL if 07244 * neither bit1 of parameter flag is set nor parameter access_text is NULL. 07245 * Note that S_IRWXG permission bits correspond to ACL mask permissions 07246 * if a "mask::" entry exists in the ACL. Only if there is no "mask::" then 07247 * the "group::" entry corresponds to to S_IRWXG. 07248 * 07249 * @param node 07250 * The node that is to be manipulated. 07251 * @param access_text 07252 * The text to be set into effect as "access" ACL. NULL will delete an 07253 * eventually existing "access" ACL of the node. 07254 * @param default_text 07255 * The text to be set into effect as "default" ACL. NULL will delete an 07256 * eventually existing "default" ACL of the node. 07257 * (GNU/Linux directories can have a "default" ACL which influences 07258 * the permissions of newly created files.) 07259 * @param flag 07260 * Bitfield for control purposes 07261 * bit1= ignore text parameters but rather update eventual "access" ACL 07262 * to the stat(2) permissions of node. If no "access" ACL exists, 07263 * then do nothing and return success. 07264 * @return 07265 * > 0 success 07266 * < 0 failure 07267 * 07268 * @since 0.6.14 07269 */ 07270 int iso_node_set_acl_text(IsoNode *node, 07271 char *access_text, char *default_text, int flag); 07272 07273 /** 07274 * Like iso_node_get_permissions but reflecting ACL entry "group::" in S_IRWXG 07275 * rather than ACL entry "mask::". This is necessary if the permissions of a 07276 * node with ACL shall be restored to a filesystem without restoring the ACL. 07277 * The same mapping happens internally when the ACL of a node is deleted. 07278 * If the node has no ACL then the result is iso_node_get_permissions(node). 07279 * @param node 07280 * The node that is to be inquired. 07281 * @return 07282 * Permission bits as of stat(2) 07283 * 07284 * @since 0.6.14 07285 */ 07286 mode_t iso_node_get_perms_wo_acl(const IsoNode *node); 07287 07288 07289 /** 07290 * Get the list of xattr which is associated with the node. 07291 * The resulting data may finally be disposed by a call to this function 07292 * with flag bit15 set, or its components may be freed one-by-one. 07293 * The following values are either NULL or malloc() memory: 07294 * *names, *value_lengths, *values, (*names)[i], (*values)[i] 07295 * with 0 <= i < *num_attrs. 07296 * It is allowed to replace or reallocate those memory items in order to 07297 * to manipulate the attribute list before submitting it to other calls. 07298 * 07299 * If enabled by flag bit0, this list possibly includes the ACLs of the node. 07300 * They are eventually encoded in a pair with empty name. It is not advisable 07301 * to alter the value or name of that pair. One may decide to erase both ACLs 07302 * by deleting this pair or to copy both ACLs by copying the content of this 07303 * pair to an empty named pair of another node. 07304 * For all other ACL purposes use iso_node_get_acl_text(). 07305 * 07306 * @param node 07307 * The node that is to be inquired. 07308 * @param num_attrs 07309 * Will return the number of name-value pairs 07310 * @param names 07311 * Will return an array of pointers to 0-terminated names 07312 * @param value_lengths 07313 * Will return an array with the lengths of values 07314 * @param values 07315 * Will return an array of pointers to strings of 8-bit bytes 07316 * @param flag 07317 * Bitfield for control purposes 07318 * bit0= obtain eventual ACLs as attribute with empty name 07319 * bit2= with bit0: do not obtain attributes other than ACLs 07320 * bit15= free memory (node may be NULL) 07321 * @return 07322 * 1 = ok (but *num_attrs may be 0) 07323 * < 0 = error 07324 * 07325 * @since 0.6.14 07326 */ 07327 int iso_node_get_attrs(IsoNode *node, size_t *num_attrs, 07328 char ***names, size_t **value_lengths, char ***values, int flag); 07329 07330 07331 /** 07332 * Obtain the value of a particular xattr name. Eventually make a copy of 07333 * that value and add a trailing 0 byte for caller convenience. 07334 * @param node 07335 * The node that is to be inquired. 07336 * @param name 07337 * The xattr name that shall be looked up. 07338 * @param value_length 07339 * Will return the length of value 07340 * @param value 07341 * Will return a string of 8-bit bytes. free() it when no longer needed. 07342 * @param flag 07343 * Bitfield for control purposes, unused yet, submit 0 07344 * @return 07345 * 1= name found , 0= name not found , <0 indicates error 07346 * 07347 * @since 0.6.18 07348 */ 07349 int iso_node_lookup_attr(IsoNode *node, char *name, 07350 size_t *value_length, char **value, int flag); 07351 07352 /** 07353 * Set the list of xattr which is associated with the node. 07354 * The data get copied so that you may dispose your input data afterwards. 07355 * 07356 * If enabled by flag bit0 then the submitted list of attributes will not only 07357 * overwrite xattr but also both eventual ACLs of the node. Eventual ACL in 07358 * the submitted list have to reside in an attribute with empty name. 07359 * 07360 * @param node 07361 * The node that is to be manipulated. 07362 * @param num_attrs 07363 * Number of attributes 07364 * @param names 07365 * Array of pointers to 0 terminated name strings 07366 * @param value_lengths 07367 * Array of byte lengths for each value 07368 * @param values 07369 * Array of pointers to the value bytes 07370 * @param flag 07371 * Bitfield for control purposes 07372 * bit0= Do not maintain eventual existing ACL of the node. 07373 * Set eventual new ACL from value of empty name. 07374 * bit1= Do not clear the existing attribute list but merge it with 07375 * the list given by this call. 07376 * The given values override the values of their eventually existing 07377 * names. If no xattr with a given name exists, then it will be 07378 * added as new xattr. So this bit can be used to set a single 07379 * xattr without inquiring any other xattr of the node. 07380 * bit2= Delete the attributes with the given names 07381 * bit3= Allow to affect non-user attributes. 07382 * I.e. those with a non-empty name which does not begin by "user." 07383 * (The empty name is always allowed and governed by bit0.) This 07384 * deletes all previously existing attributes if not bit1 is set. 07385 * bit4= Do not affect attributes from namespace "isofs". 07386 * To be combined with bit3 for copying attributes from local 07387 * filesystem to ISO image. 07388 * @since 1.2.4 07389 * @return 07390 * 1 = ok 07391 * < 0 = error 07392 * 07393 * @since 0.6.14 07394 */ 07395 int iso_node_set_attrs(IsoNode *node, size_t num_attrs, char **names, 07396 size_t *value_lengths, char **values, int flag); 07397 07398 07399 /* ----- This is an interface to ACL and xattr of the local filesystem ----- */ 07400 07401 /** 07402 * libisofs has an internal system dependent adapter to ACL and xattr 07403 * operations. For the sake of completeness and simplicity it exposes this 07404 * functionality to its applications which might want to get and set ACLs 07405 * from local files. 07406 */ 07407 07408 /** 07409 * Inquire whether local filesystem operations with ACL or xattr are enabled 07410 * inside libisofs. They may be disabled because of compile time decisions. 07411 * E.g. because the operating system does not support these features or 07412 * because libisofs has not yet an adapter to use them. 07413 * 07414 * @param flag 07415 * Bitfield for control purposes 07416 * bit0= inquire availability of ACL 07417 * bit1= inquire availability of xattr 07418 * bit2 - bit7= Reserved for future types. 07419 * It is permissibile to set them to 1 already now. 07420 * bit8 and higher: reserved, submit 0 07421 * @return 07422 * Bitfield corresponding to flag. 07423 * bit0= ACL adapter is enabled 07424 * bit1= xattr adapter is enabled 07425 * bit2 - bit7= Reserved for future types. 07426 * bit8 and higher: reserved, do not interpret these 07427 * 07428 * @since 1.1.6 07429 */ 07430 int iso_local_attr_support(int flag); 07431 07432 /** 07433 * Get an ACL of the given file in the local filesystem in long text form. 07434 * 07435 * @param disk_path 07436 * Absolute path to the file 07437 * @param text 07438 * Will return a pointer to the ACL text. If not NULL the text will be 07439 * 0 terminated and finally has to be disposed by a call to this function 07440 * with bit15 set. 07441 * @param flag 07442 * Bitfield for control purposes 07443 * bit0= get "default" ACL rather than "access" ACL 07444 * bit4= set *text = NULL and return 2 07445 * if the ACL matches st_mode permissions. 07446 * bit5= in case of symbolic link: inquire link target 07447 * bit15= free text and return 1 07448 * @return 07449 * 1 ok 07450 * 2 ok, trivial ACL found while bit4 is set, *text is NULL 07451 * 0 no ACL manipulation adapter available / ACL not supported on fs 07452 * -1 failure of system ACL service (see errno) 07453 * -2 attempt to inquire ACL of a symbolic link without bit4 or bit5 07454 * or with no suitable link target 07455 * 07456 * @since 0.6.14 07457 */ 07458 int iso_local_get_acl_text(char *disk_path, char **text, int flag); 07459 07460 07461 /** 07462 * Set the ACL of the given file in the local filesystem to a given list 07463 * in long text form. 07464 * 07465 * @param disk_path 07466 * Absolute path to the file 07467 * @param text 07468 * The input text (0 terminated, ACL long text form) 07469 * @param flag 07470 * Bitfield for control purposes 07471 * bit0= set "default" ACL rather than "access" ACL 07472 * bit5= in case of symbolic link: manipulate link target 07473 * @return 07474 * > 0 ok 07475 * 0 no ACL manipulation adapter available for desired ACL type 07476 * -1 failure of system ACL service (see errno) 07477 * -2 attempt to manipulate ACL of a symbolic link without bit5 07478 * or with no suitable link target 07479 * 07480 * @since 0.6.14 07481 */ 07482 int iso_local_set_acl_text(char *disk_path, char *text, int flag); 07483 07484 07485 /** 07486 * Obtain permissions of a file in the local filesystem which shall reflect 07487 * ACL entry "group::" in S_IRWXG rather than ACL entry "mask::". This is 07488 * necessary if the permissions of a disk file with ACL shall be copied to 07489 * an object which has no ACL. 07490 * @param disk_path 07491 * Absolute path to the local file which may have an "access" ACL or not. 07492 * @param flag 07493 * Bitfield for control purposes 07494 * bit5= in case of symbolic link: inquire link target 07495 * @param st_mode 07496 * Returns permission bits as of stat(2) 07497 * @return 07498 * 1 success 07499 * -1 failure of lstat() or stat() (see errno) 07500 * 07501 * @since 0.6.14 07502 */ 07503 int iso_local_get_perms_wo_acl(char *disk_path, mode_t *st_mode, int flag); 07504 07505 07506 /** 07507 * Get xattr and non-trivial ACLs of the given file in the local filesystem. 07508 * The resulting data has finally to be disposed by a call to this function 07509 * with flag bit15 set. 07510 * 07511 * Eventual ACLs will get encoded as attribute pair with empty name if this is 07512 * enabled by flag bit0. An ACL which simply replects stat(2) permissions 07513 * will not be put into the result. 07514 * 07515 * @param disk_path 07516 * Absolute path to the file 07517 * @param num_attrs 07518 * Will return the number of name-value pairs 07519 * @param names 07520 * Will return an array of pointers to 0-terminated names 07521 * @param value_lengths 07522 * Will return an array with the lengths of values 07523 * @param values 07524 * Will return an array of pointers to 8-bit values 07525 * @param flag 07526 * Bitfield for control purposes 07527 * bit0= obtain eventual ACLs as attribute with empty name 07528 * bit2= do not obtain attributes other than ACLs 07529 * bit3= do not ignore eventual non-user attributes. 07530 * I.e. those with a name which does not begin by "user." 07531 * bit5= in case of symbolic link: inquire link target 07532 * bit15= free memory 07533 * @return 07534 * 1 ok 07535 * < 0 failure 07536 * 07537 * @since 0.6.14 07538 */ 07539 int iso_local_get_attrs(char *disk_path, size_t *num_attrs, char ***names, 07540 size_t **value_lengths, char ***values, int flag); 07541 07542 07543 /** 07544 * Attach a list of xattr and ACLs to the given file in the local filesystem. 07545 * 07546 * Eventual ACLs have to be encoded as attribute pair with empty name. 07547 * 07548 * @param disk_path 07549 * Absolute path to the file 07550 * @param num_attrs 07551 * Number of attributes 07552 * @param names 07553 * Array of pointers to 0 terminated name strings 07554 * @param value_lengths 07555 * Array of byte lengths for each attribute payload 07556 * @param values 07557 * Array of pointers to the attribute payload bytes 07558 * @param flag 07559 * Bitfield for control purposes 07560 * bit0= do not attach ACLs from an eventual attribute with empty name 07561 * bit3= do not ignore eventual non-user attributes. 07562 * I.e. those with a name which does not begin by "user." 07563 * bit5= in case of symbolic link: manipulate link target 07564 * bit6= @since 1.1.6 07565 tolerate inappropriate presence or absence of 07566 * directory "default" ACL 07567 * @return 07568 * 1 = ok 07569 * < 0 = error 07570 * 07571 * @since 0.6.14 07572 */ 07573 int iso_local_set_attrs(char *disk_path, size_t num_attrs, char **names, 07574 size_t *value_lengths, char **values, int flag); 07575 07576 07577 /* Default in case that the compile environment has no macro PATH_MAX. 07578 */ 07579 #define Libisofs_default_path_maX 4096 07580 07581 07582 /* --------------------------- Filters in General -------------------------- */ 07583 07584 /* 07585 * A filter is an IsoStream which uses another IsoStream as input. It gets 07586 * attached to an IsoFile by specialized calls iso_file_add_*_filter() which 07587 * replace its current IsoStream by the filter stream which takes over the 07588 * current IsoStream as input. 07589 * The consequences are: 07590 * iso_file_get_stream() will return the filter stream. 07591 * iso_stream_get_size() will return the (cached) size of the filtered data, 07592 * iso_stream_open() will start eventual child processes, 07593 * iso_stream_close() will kill eventual child processes, 07594 * iso_stream_read() will return filtered data. E.g. as data file content 07595 * during ISO image generation. 07596 * 07597 * There are external filters which run child processes 07598 * iso_file_add_external_filter() 07599 * and internal filters 07600 * iso_file_add_zisofs_filter() 07601 * iso_file_add_gzip_filter() 07602 * which may or may not be available depending on compile time settings and 07603 * installed software packages like libz. 07604 * 07605 * During image generation filters get not in effect if the original IsoStream 07606 * is an "fsrc" stream based on a file in the loaded ISO image and if the 07607 * image generation type is set to 1 by iso_write_opts_set_appendable(). 07608 */ 07609 07610 /** 07611 * Delete the top filter stream from a data file. This is the most recent one 07612 * which was added by iso_file_add_*_filter(). 07613 * Caution: One should not do this while the IsoStream of the file is opened. 07614 * For now there is no general way to determine this state. 07615 * Filter stream implementations are urged to eventually call .close() 07616 * inside method .free() . This will close the input stream too. 07617 * @param file 07618 * The data file node which shall get rid of one layer of content 07619 * filtering. 07620 * @param flag 07621 * Bitfield for control purposes, unused yet, submit 0. 07622 * @return 07623 * 1 on success, 0 if no filter was present 07624 * <0 on error 07625 * 07626 * @since 0.6.18 07627 */ 07628 int iso_file_remove_filter(IsoFile *file, int flag); 07629 07630 /** 07631 * Obtain the eventual input stream of a filter stream. 07632 * @param stream 07633 * The eventual filter stream to be inquired. 07634 * @param flag 07635 * Bitfield for control purposes. 07636 * bit0= Follow the chain of input streams and return the one at the 07637 * end of the chain. 07638 * @since 1.3.2 07639 * @return 07640 * The input stream, if one exists. Elsewise NULL. 07641 * No extra reference to the stream is taken by this call. 07642 * 07643 * @since 0.6.18 07644 */ 07645 IsoStream *iso_stream_get_input_stream(IsoStream *stream, int flag); 07646 07647 07648 /* ---------------------------- External Filters --------------------------- */ 07649 07650 /** 07651 * Representation of an external program that shall serve as filter for 07652 * an IsoStream. This object may be shared among many IsoStream objects. 07653 * It is to be created and disposed by the application. 07654 * 07655 * The filter will act as proxy between the original IsoStream of an IsoFile. 07656 * Up to completed image generation it will be run at least twice: 07657 * for IsoStream.class.get_size() and for .open() with subsequent .read(). 07658 * So the original IsoStream has to return 1 by its .class.is_repeatable(). 07659 * The filter program has to be repeateable too. I.e. it must produce the same 07660 * output on the same input. 07661 * 07662 * @since 0.6.18 07663 */ 07664 struct iso_external_filter_command 07665 { 07666 /* Will indicate future extensions. It has to be 0 for now. */ 07667 int version; 07668 07669 /* Tells how many IsoStream objects depend on this command object. 07670 * One may only dispose an IsoExternalFilterCommand when this count is 0. 07671 * Initially this value has to be 0. 07672 */ 07673 int refcount; 07674 07675 /* An optional instance id. 07676 * Set to empty text if no individual name for this object is intended. 07677 */ 07678 char *name; 07679 07680 /* Absolute local filesystem path to the executable program. */ 07681 char *path; 07682 07683 /* Tells the number of arguments. */ 07684 int argc; 07685 07686 /* NULL terminated list suitable for system call execv(3). 07687 * I.e. argv[0] points to the alleged program name, 07688 * argv[1] to argv[argc] point to program arguments (if argc > 0) 07689 * argv[argc+1] is NULL 07690 */ 07691 char **argv; 07692 07693 /* A bit field which controls behavior variations: 07694 * bit0= Do not install filter if the input has size 0. 07695 * bit1= Do not install filter if the output is not smaller than the input. 07696 * bit2= Do not install filter if the number of output blocks is 07697 * not smaller than the number of input blocks. Block size is 2048. 07698 * Assume that non-empty input yields non-empty output and thus do 07699 * not attempt to attach a filter to files smaller than 2049 bytes. 07700 * bit3= suffix removed rather than added. 07701 * (Removal and adding suffixes is the task of the application. 07702 * This behavior bit serves only as reminder for the application.) 07703 */ 07704 int behavior; 07705 07706 /* The eventual suffix which is supposed to be added to the IsoFile name 07707 * or to be removed from the name. 07708 * (This is to be done by the application, not by calls 07709 * iso_file_add_external_filter() or iso_file_remove_filter(). 07710 * The value recorded here serves only as reminder for the application.) 07711 */ 07712 char *suffix; 07713 }; 07714 07715 typedef struct iso_external_filter_command IsoExternalFilterCommand; 07716 07717 /** 07718 * Install an external filter command on top of the content stream of a data 07719 * file. The filter process must be repeatable. It will be run once by this 07720 * call in order to cache the output size. 07721 * @param file 07722 * The data file node which shall show filtered content. 07723 * @param cmd 07724 * The external program and its arguments which shall do the filtering. 07725 * @param flag 07726 * Bitfield for control purposes, unused yet, submit 0. 07727 * @return 07728 * 1 on success, 2 if filter installation revoked (e.g. cmd.behavior bit1) 07729 * <0 on error 07730 * 07731 * @since 0.6.18 07732 */ 07733 int iso_file_add_external_filter(IsoFile *file, IsoExternalFilterCommand *cmd, 07734 int flag); 07735 07736 /** 07737 * Obtain the IsoExternalFilterCommand which is eventually associated with the 07738 * given stream. (Typically obtained from an IsoFile by iso_file_get_stream() 07739 * or from an IsoStream by iso_stream_get_input_stream()). 07740 * @param stream 07741 * The stream to be inquired. 07742 * @param cmd 07743 * Will return the external IsoExternalFilterCommand. Valid only if 07744 * the call returns 1. This does not increment cmd->refcount. 07745 * @param flag 07746 * Bitfield for control purposes, unused yet, submit 0. 07747 * @return 07748 * 1 on success, 0 if the stream is not an external filter 07749 * <0 on error 07750 * 07751 * @since 0.6.18 07752 */ 07753 int iso_stream_get_external_filter(IsoStream *stream, 07754 IsoExternalFilterCommand **cmd, int flag); 07755 07756 07757 /* ---------------------------- Internal Filters --------------------------- */ 07758 07759 07760 /** 07761 * Install a zisofs filter on top of the content stream of a data file. 07762 * zisofs is a compression format which is decompressed by some Linux kernels. 07763 * See also doc/zisofs_format.txt . 07764 * The filter will not be installed if its output size is not smaller than 07765 * the size of the input stream. 07766 * This is only enabled if the use of libz was enabled at compile time. 07767 * @param file 07768 * The data file node which shall show filtered content. 07769 * @param flag 07770 * Bitfield for control purposes 07771 * bit0= Do not install filter if the number of output blocks is 07772 * not smaller than the number of input blocks. Block size is 2048. 07773 * bit1= Install a decompression filter rather than one for compression. 07774 * bit2= Only inquire availability of zisofs filtering. file may be NULL. 07775 * If available return 2, else return error. 07776 * bit3= is reserved for internal use and will be forced to 0 07777 * @return 07778 * 1 on success, 2 if filter available but installation revoked 07779 * <0 on error, e.g. ISO_ZLIB_NOT_ENABLED 07780 * 07781 * @since 0.6.18 07782 */ 07783 int iso_file_add_zisofs_filter(IsoFile *file, int flag); 07784 07785 /** 07786 * Inquire the number of zisofs compression and uncompression filters which 07787 * are in use. 07788 * @param ziso_count 07789 * Will return the number of currently installed compression filters. 07790 * @param osiz_count 07791 * Will return the number of currently installed uncompression filters. 07792 * @param flag 07793 * Bitfield for control purposes, unused yet, submit 0 07794 * @return 07795 * 1 on success, <0 on error 07796 * 07797 * @since 0.6.18 07798 */ 07799 int iso_zisofs_get_refcounts(off_t *ziso_count, off_t *osiz_count, int flag); 07800 07801 07802 /** 07803 * Parameter set for iso_zisofs_set_params(). 07804 * 07805 * @since 0.6.18 07806 */ 07807 struct iso_zisofs_ctrl { 07808 07809 /* Set to 0 for this version of the structure */ 07810 int version; 07811 07812 /* Compression level for zlib function compress2(). From <zlib.h>: 07813 * "between 0 and 9: 07814 * 1 gives best speed, 9 gives best compression, 0 gives no compression" 07815 * Default is 6. 07816 */ 07817 int compression_level; 07818 07819 /* Log2 of the block size for compression filters. Allowed values are: 07820 * 15 = 32 kiB , 16 = 64 kiB , 17 = 128 kiB 07821 */ 07822 uint8_t block_size_log2; 07823 07824 }; 07825 07826 /** 07827 * Set the global parameters for zisofs filtering. 07828 * This is only allowed while no zisofs compression filters are installed. 07829 * i.e. ziso_count returned by iso_zisofs_get_refcounts() has to be 0. 07830 * @param params 07831 * Pointer to a structure with the intended settings. 07832 * @param flag 07833 * Bitfield for control purposes, unused yet, submit 0 07834 * @return 07835 * 1 on success, <0 on error 07836 * 07837 * @since 0.6.18 07838 */ 07839 int iso_zisofs_set_params(struct iso_zisofs_ctrl *params, int flag); 07840 07841 /** 07842 * Get the current global parameters for zisofs filtering. 07843 * @param params 07844 * Pointer to a caller provided structure which shall take the settings. 07845 * @param flag 07846 * Bitfield for control purposes, unused yet, submit 0 07847 * @return 07848 * 1 on success, <0 on error 07849 * 07850 * @since 0.6.18 07851 */ 07852 int iso_zisofs_get_params(struct iso_zisofs_ctrl *params, int flag); 07853 07854 07855 /** 07856 * Check for the given node or for its subtree whether the data file content 07857 * effectively bears zisofs file headers and eventually mark the outcome 07858 * by an xinfo data record if not already marked by a zisofs compressor filter. 07859 * This does not install any filter but only a hint for image generation 07860 * that the already compressed files shall get written with zisofs ZF entries. 07861 * Use this if you insert the compressed reults of program mkzftree from disk 07862 * into the image. 07863 * @param node 07864 * The node which shall be checked and eventually marked. 07865 * @param flag 07866 * Bitfield for control purposes, unused yet, submit 0 07867 * bit0= prepare for a run with iso_write_opts_set_appendable(,1). 07868 * Take into account that files from the imported image 07869 * do not get their content filtered. 07870 * bit1= permission to overwrite existing zisofs_zf_info 07871 * bit2= if no zisofs header is found: 07872 * create xinfo with parameters which indicate no zisofs 07873 * bit3= no tree recursion if node is a directory 07874 * bit4= skip files which stem from the imported image 07875 * @return 07876 * 0= no zisofs data found 07877 * 1= zf xinfo added 07878 * 2= found existing zf xinfo and flag bit1 was not set 07879 * 3= both encountered: 1 and 2 07880 * <0 means error 07881 * 07882 * @since 0.6.18 07883 */ 07884 int iso_node_zf_by_magic(IsoNode *node, int flag); 07885 07886 07887 /** 07888 * Install a gzip or gunzip filter on top of the content stream of a data file. 07889 * gzip is a compression format which is used by programs gzip and gunzip. 07890 * The filter will not be installed if its output size is not smaller than 07891 * the size of the input stream. 07892 * This is only enabled if the use of libz was enabled at compile time. 07893 * @param file 07894 * The data file node which shall show filtered content. 07895 * @param flag 07896 * Bitfield for control purposes 07897 * bit0= Do not install filter if the number of output blocks is 07898 * not smaller than the number of input blocks. Block size is 2048. 07899 * bit1= Install a decompression filter rather than one for compression. 07900 * bit2= Only inquire availability of gzip filtering. file may be NULL. 07901 * If available return 2, else return error. 07902 * bit3= is reserved for internal use and will be forced to 0 07903 * @return 07904 * 1 on success, 2 if filter available but installation revoked 07905 * <0 on error, e.g. ISO_ZLIB_NOT_ENABLED 07906 * 07907 * @since 0.6.18 07908 */ 07909 int iso_file_add_gzip_filter(IsoFile *file, int flag); 07910 07911 07912 /** 07913 * Inquire the number of gzip compression and uncompression filters which 07914 * are in use. 07915 * @param gzip_count 07916 * Will return the number of currently installed compression filters. 07917 * @param gunzip_count 07918 * Will return the number of currently installed uncompression filters. 07919 * @param flag 07920 * Bitfield for control purposes, unused yet, submit 0 07921 * @return 07922 * 1 on success, <0 on error 07923 * 07924 * @since 0.6.18 07925 */ 07926 int iso_gzip_get_refcounts(off_t *gzip_count, off_t *gunzip_count, int flag); 07927 07928 07929 /* ---------------------------- MD5 Checksums --------------------------- */ 07930 07931 /* Production and loading of MD5 checksums is controlled by calls 07932 iso_write_opts_set_record_md5() and iso_read_opts_set_no_md5(). 07933 For data representation details see doc/checksums.txt . 07934 */ 07935 07936 /** 07937 * Eventually obtain the recorded MD5 checksum of the session which was 07938 * loaded as ISO image. Such a checksum may be stored together with others 07939 * in a contiguous array at the end of the session. The session checksum 07940 * covers the data blocks from address start_lba to address end_lba - 1. 07941 * It does not cover the recorded array of md5 checksums. 07942 * Layout, size, and position of the checksum array is recorded in the xattr 07943 * "isofs.ca" of the session root node. 07944 * @param image 07945 * The image to inquire 07946 * @param start_lba 07947 * Eventually returns the first block address covered by md5 07948 * @param end_lba 07949 * Eventually returns the first block address not covered by md5 any more 07950 * @param md5 07951 * Eventually returns 16 byte of MD5 checksum 07952 * @param flag 07953 * Bitfield for control purposes, unused yet, submit 0 07954 * @return 07955 * 1= md5 found , 0= no md5 available , <0 indicates error 07956 * 07957 * @since 0.6.22 07958 */ 07959 int iso_image_get_session_md5(IsoImage *image, uint32_t *start_lba, 07960 uint32_t *end_lba, char md5[16], int flag); 07961 07962 /** 07963 * Eventually obtain the recorded MD5 checksum of a data file from the loaded 07964 * ISO image. Such a checksum may be stored with others in a contiguous 07965 * array at the end of the loaded session. The data file eventually has an 07966 * xattr "isofs.cx" which gives the index in that array. 07967 * @param image 07968 * The image from which file stems. 07969 * @param file 07970 * The file object to inquire 07971 * @param md5 07972 * Eventually returns 16 byte of MD5 checksum 07973 * @param flag 07974 * Bitfield for control purposes 07975 * bit0= only determine return value, do not touch parameter md5 07976 * @return 07977 * 1= md5 found , 0= no md5 available , <0 indicates error 07978 * 07979 * @since 0.6.22 07980 */ 07981 int iso_file_get_md5(IsoImage *image, IsoFile *file, char md5[16], int flag); 07982 07983 /** 07984 * Read the content of an IsoFile object, compute its MD5 and attach it to 07985 * the IsoFile. It can then be inquired by iso_file_get_md5() and will get 07986 * written into the next session if this is enabled at write time and if the 07987 * image write process does not compute an MD5 from content which it copies. 07988 * So this call can be used to equip nodes from the old image with checksums 07989 * or to make available checksums of newly added files before the session gets 07990 * written. 07991 * @param file 07992 * The file object to read data from and to which to attach the checksum. 07993 * If the file is from the imported image, then its most original stream 07994 * will be checksummed. Else the eventual filter streams will get into 07995 * effect. 07996 * @param flag 07997 * Bitfield for control purposes. Unused yet. Submit 0. 07998 * @return 07999 * 1= ok, MD5 is computed and attached , <0 indicates error 08000 * 08001 * @since 0.6.22 08002 */ 08003 int iso_file_make_md5(IsoFile *file, int flag); 08004 08005 /** 08006 * Check a data block whether it is a libisofs session checksum tag and 08007 * eventually obtain its recorded parameters. These tags get written after 08008 * volume descriptors, directory tree and checksum array and can be detected 08009 * without loading the image tree. 08010 * One may start reading and computing MD5 at the suspected image session 08011 * start and look out for a session tag on the fly. See doc/checksum.txt . 08012 * @param data 08013 * A complete and aligned data block read from an ISO image session. 08014 * @param tag_type 08015 * 0= no tag 08016 * 1= session tag 08017 * 2= superblock tag 08018 * 3= tree tag 08019 * 4= relocated 64 kB superblock tag (at LBA 0 of overwriteable media) 08020 * @param pos 08021 * Returns the LBA where the tag supposes itself to be stored. 08022 * If this does not match the data block LBA then the tag might be 08023 * image data payload and should be ignored for image checksumming. 08024 * @param range_start 08025 * Returns the block address where the session is supposed to start. 08026 * If this does not match the session start on media then the image 08027 * volume descriptors have been been relocated. 08028 * A proper checksum will only emerge if computing started at range_start. 08029 * @param range_size 08030 * Returns the number of blocks beginning at range_start which are 08031 * covered by parameter md5. 08032 * @param next_tag 08033 * Returns the predicted block address of the next tag. 08034 * next_tag is valid only if not 0 and only with return values 2, 3, 4. 08035 * With tag types 2 and 3, reading shall go on sequentially and the MD5 08036 * computation shall continue up to that address. 08037 * With tag type 4, reading shall resume either at LBA 32 for the first 08038 * session or at the given address for the session which is to be loaded 08039 * by default. In both cases the MD5 computation shall be re-started from 08040 * scratch. 08041 * @param md5 08042 * Returns 16 byte of MD5 checksum. 08043 * @param flag 08044 * Bitfield for control purposes: 08045 * bit0-bit7= tag type being looked for 08046 * 0= any checksum tag 08047 * 1= session tag 08048 * 2= superblock tag 08049 * 3= tree tag 08050 * 4= relocated superblock tag 08051 * @return 08052 * 0= not a checksum tag, return parameters are invalid 08053 * 1= checksum tag found, return parameters are valid 08054 * <0= error 08055 * (return parameters are valid with error ISO_MD5_AREA_CORRUPTED 08056 * but not trustworthy because the tag seems corrupted) 08057 * 08058 * @since 0.6.22 08059 */ 08060 int iso_util_decode_md5_tag(char data[2048], int *tag_type, uint32_t *pos, 08061 uint32_t *range_start, uint32_t *range_size, 08062 uint32_t *next_tag, char md5[16], int flag); 08063 08064 08065 /* The following functions allow to do own MD5 computations. E.g for 08066 comparing the result with a recorded checksum. 08067 */ 08068 /** 08069 * Create a MD5 computation context and hand out an opaque handle. 08070 * 08071 * @param md5_context 08072 * Returns the opaque handle. Submitted *md5_context must be NULL or 08073 * point to freeable memory. 08074 * @return 08075 * 1= success , <0 indicates error 08076 * 08077 * @since 0.6.22 08078 */ 08079 int iso_md5_start(void **md5_context); 08080 08081 /** 08082 * Advance the computation of a MD5 checksum by a chunk of data bytes. 08083 * 08084 * @param md5_context 08085 * An opaque handle once returned by iso_md5_start() or iso_md5_clone(). 08086 * @param data 08087 * The bytes which shall be processed into to the checksum. 08088 * @param datalen 08089 * The number of bytes to be processed. 08090 * @return 08091 * 1= success , <0 indicates error 08092 * 08093 * @since 0.6.22 08094 */ 08095 int iso_md5_compute(void *md5_context, char *data, int datalen); 08096 08097 /** 08098 * Create a MD5 computation context as clone of an existing one. One may call 08099 * iso_md5_clone(old, &new, 0) and then iso_md5_end(&new, result, 0) in order 08100 * to obtain an intermediate MD5 sum before the computation goes on. 08101 * 08102 * @param old_md5_context 08103 * An opaque handle once returned by iso_md5_start() or iso_md5_clone(). 08104 * @param new_md5_context 08105 * Returns the opaque handle to the new MD5 context. Submitted 08106 * *md5_context must be NULL or point to freeable memory. 08107 * @return 08108 * 1= success , <0 indicates error 08109 * 08110 * @since 0.6.22 08111 */ 08112 int iso_md5_clone(void *old_md5_context, void **new_md5_context); 08113 08114 /** 08115 * Obtain the MD5 checksum from a MD5 computation context and dispose this 08116 * context. (If you want to keep the context then call iso_md5_clone() and 08117 * apply iso_md5_end() to the clone.) 08118 * 08119 * @param md5_context 08120 * A pointer to an opaque handle once returned by iso_md5_start() or 08121 * iso_md5_clone(). *md5_context will be set to NULL in this call. 08122 * @param result 08123 * Gets filled with the 16 bytes of MD5 checksum. 08124 * @return 08125 * 1= success , <0 indicates error 08126 * 08127 * @since 0.6.22 08128 */ 08129 int iso_md5_end(void **md5_context, char result[16]); 08130 08131 /** 08132 * Inquire whether two MD5 checksums match. (This is trivial but such a call 08133 * is convenient and completes the interface.) 08134 * @param first_md5 08135 * A MD5 byte string as returned by iso_md5_end() 08136 * @param second_md5 08137 * A MD5 byte string as returned by iso_md5_end() 08138 * @return 08139 * 1= match , 0= mismatch 08140 * 08141 * @since 0.6.22 08142 */ 08143 int iso_md5_match(char first_md5[16], char second_md5[16]); 08144 08145 08146 /* -------------------------------- For HFS+ ------------------------------- */ 08147 08148 08149 /** 08150 * HFS+ attributes which may be attached to IsoNode objects as data parameter 08151 * of iso_node_add_xinfo(). As parameter proc use iso_hfsplus_xinfo_func(). 08152 * Create instances of this struct by iso_hfsplus_xinfo_new(). 08153 * 08154 * @since 1.2.4 08155 */ 08156 struct iso_hfsplus_xinfo_data { 08157 08158 /* Currently set to 0 by iso_hfsplus_xinfo_new() */ 08159 int version; 08160 08161 /* Attributes available with version 0. 08162 * See: http://en.wikipedia.org/wiki/Creator_code , .../Type_code 08163 * @since 1.2.4 08164 */ 08165 uint8_t creator_code[4]; 08166 uint8_t type_code[4]; 08167 }; 08168 08169 /** 08170 * The function that is used to mark struct iso_hfsplus_xinfo_data at IsoNodes 08171 * and finally disposes such structs when their IsoNodes get disposed. 08172 * Usually an application does not call this function, but only uses it as 08173 * parameter of xinfo calls like iso_node_add_xinfo() or iso_node_get_xinfo(). 08174 * 08175 * @since 1.2.4 08176 */ 08177 int iso_hfsplus_xinfo_func(void *data, int flag); 08178 08179 /** 08180 * Create an instance of struct iso_hfsplus_xinfo_new(). 08181 * 08182 * @param flag 08183 * Bitfield for control purposes. Unused yet. Submit 0. 08184 * @return 08185 * A pointer to the new object 08186 * NULL indicates failure to allocate memory 08187 * 08188 * @since 1.2.4 08189 */ 08190 struct iso_hfsplus_xinfo_data *iso_hfsplus_xinfo_new(int flag); 08191 08192 08193 /** 08194 * HFS+ blessings are relationships between HFS+ enhanced ISO images and 08195 * particular files in such images. Except for ISO_HFSPLUS_BLESS_INTEL_BOOTFILE 08196 * and ISO_HFSPLUS_BLESS_MAX, these files have to be directories. 08197 * No file may have more than one blessing. Each blessing can only be issued 08198 * to one file. 08199 * 08200 * @since 1.2.4 08201 */ 08202 enum IsoHfsplusBlessings { 08203 /* The blessing that is issued by mkisofs option -hfs-bless. */ 08204 ISO_HFSPLUS_BLESS_PPC_BOOTDIR, 08205 08206 /* To be applied to a data file */ 08207 ISO_HFSPLUS_BLESS_INTEL_BOOTFILE, 08208 08209 /* Further blessings for directories */ 08210 ISO_HFSPLUS_BLESS_SHOWFOLDER, 08211 ISO_HFSPLUS_BLESS_OS9_FOLDER, 08212 ISO_HFSPLUS_BLESS_OSX_FOLDER, 08213 08214 /* Not a blessing, but telling the number of blessings in this list */ 08215 ISO_HFSPLUS_BLESS_MAX 08216 }; 08217 08218 /** 08219 * Issue a blessing to a particular IsoNode. If the blessing is already issued 08220 * to some file, then it gets revoked from that one. 08221 * 08222 * @param img 08223 * The image to manipulate. 08224 * @param blessing 08225 * The kind of blessing to be issued. 08226 * @param node 08227 * The file that shall be blessed. It must actually be an IsoDir or 08228 * IsoFile as is appropriate for the kind of blessing. (See above enum.) 08229 * The node may not yet bear a blessing other than the desired one. 08230 * If node is NULL, then the blessing will be revoked from any node 08231 * which bears it. 08232 * @param flag 08233 * Bitfield for control purposes. 08234 * bit0= Revoke blessing if node != NULL bears it. 08235 * bit1= Revoke any blessing of the node, regardless of parameter 08236 * blessing. If node is NULL, then revoke all blessings in 08237 * the image. 08238 * @return 08239 * 1 means successful blessing or revokation of an existing blessing. 08240 * 0 means the node already bears another blessing, or is of wrong type, 08241 * or that the node was not blessed and revokation was desired. 08242 * <0 is one of the listed error codes. 08243 * 08244 * @since 1.2.4 08245 */ 08246 int iso_image_hfsplus_bless(IsoImage *img, enum IsoHfsplusBlessings blessing, 08247 IsoNode *node, int flag); 08248 08249 /** 08250 * Get the array of nodes which are currently blessed. 08251 * Array indice correspond to enum IsoHfsplusBlessings. 08252 * Array element value NULL means that no node bears that blessing. 08253 * 08254 * Several usage restrictions apply. See parameter blessed_nodes. 08255 * 08256 * @param img 08257 * The image to inquire. 08258 * @param blessed_nodes 08259 * Will return a pointer to an internal node array of image. 08260 * This pointer is valid only as long as image exists and only until 08261 * iso_image_hfsplus_bless() gets used to manipulate the blessings. 08262 * Do not free() this array. Do not alter the content of the array 08263 * directly, but rather use iso_image_hfsplus_bless() and re-inquire 08264 * by iso_image_hfsplus_get_blessed(). 08265 * This call does not impose an extra reference on the nodes in the 08266 * array. So do not iso_node_unref() them. 08267 * Nodes listed here are not necessarily grafted into the tree of 08268 * the IsoImage. 08269 * @param bless_max 08270 * Will return the number of elements in the array. 08271 * It is unlikely but not outruled that it will be larger than 08272 * ISO_HFSPLUS_BLESS_MAX in this libisofs.h file. 08273 * @param flag 08274 * Bitfield for control purposes. Submit 0. 08275 * @return 08276 * 1 means success, <0 means error 08277 * 08278 * @since 1.2.4 08279 */ 08280 int iso_image_hfsplus_get_blessed(IsoImage *img, IsoNode ***blessed_nodes, 08281 int *bless_max, int flag); 08282 08283 08284 /* ----------------------------- Character sets ---------------------------- */ 08285 08286 /** 08287 * Convert the characters in name from local charset to another charset or 08288 * convert name to the representation of a particular ISO image name space. 08289 * In the latter case it is assumed that the conversion result does not 08290 * collide with any other converted name in the same directory. 08291 * I.e. this function does not take into respect possible name changes 08292 * due to collision handling. 08293 * 08294 * @param opts 08295 * Defines output charset, UCS-2 versus UTF-16 for Joliet, 08296 * and naming restrictions. 08297 * @param name 08298 * The input text which shall be converted. 08299 * @param name_len 08300 * The number of bytes in input text. 08301 * @param result 08302 * Will return the conversion result in case of success. Terminated by 08303 * a trailing zero byte. 08304 * Use free() to dispose it when no longer needed. 08305 * @param result_len 08306 * Will return the number of bytes in result (excluding trailing zero) 08307 * @param flag 08308 * Bitfield for control purposes. 08309 * bit0-bit7= Name space 08310 * 0= generic (output charset is used, 08311 * no reserved characters, no length limits) 08312 * 1= Rock Ridge (output charset is used) 08313 * 2= Joliet (output charset gets overridden by UCS-2 or 08314 * UTF-16) 08315 * 3= ECMA-119 (output charset gets overridden by the 08316 * dull ISO 9660 subset of ASCII) 08317 * 4= HFS+ (output charset gets overridden by UTF-16BE) 08318 * bit8= Treat input text as directory name 08319 * (matters for Joliet and ECMA-119) 08320 * bit9= Do not issue error messages 08321 * bit15= Reverse operation (best to be done only with results of 08322 * previous conversions) 08323 * @return 08324 * 1 means success, <0 means error 08325 * 08326 * @since 1.3.6 08327 */ 08328 int iso_conv_name_chars(IsoWriteOpts *opts, char *name, size_t name_len, 08329 char **result, size_t *result_len, int flag); 08330 08331 08332 08333 /************ Error codes and return values for libisofs ********************/ 08334 08335 /** successfully execution */ 08336 #define ISO_SUCCESS 1 08337 08338 /** 08339 * special return value, it could be or not an error depending on the 08340 * context. 08341 */ 08342 #define ISO_NONE 0 08343 08344 /** Operation canceled (FAILURE,HIGH, -1) */ 08345 #define ISO_CANCELED 0xE830FFFF 08346 08347 /** Unknown or unexpected fatal error (FATAL,HIGH, -2) */ 08348 #define ISO_FATAL_ERROR 0xF030FFFE 08349 08350 /** Unknown or unexpected error (FAILURE,HIGH, -3) */ 08351 #define ISO_ERROR 0xE830FFFD 08352 08353 /** Internal programming error. Please report this bug (FATAL,HIGH, -4) */ 08354 #define ISO_ASSERT_FAILURE 0xF030FFFC 08355 08356 /** 08357 * NULL pointer as value for an arg. that doesn't allow NULL (FAILURE,HIGH, -5) 08358 */ 08359 #define ISO_NULL_POINTER 0xE830FFFB 08360 08361 /** Memory allocation error (FATAL,HIGH, -6) */ 08362 #define ISO_OUT_OF_MEM 0xF030FFFA 08363 08364 /** Interrupted by a signal (FATAL,HIGH, -7) */ 08365 #define ISO_INTERRUPTED 0xF030FFF9 08366 08367 /** Invalid parameter value (FAILURE,HIGH, -8) */ 08368 #define ISO_WRONG_ARG_VALUE 0xE830FFF8 08369 08370 /** Can't create a needed thread (FATAL,HIGH, -9) */ 08371 #define ISO_THREAD_ERROR 0xF030FFF7 08372 08373 /** Write error (FAILURE,HIGH, -10) */ 08374 #define ISO_WRITE_ERROR 0xE830FFF6 08375 08376 /** Buffer read error (FAILURE,HIGH, -11) */ 08377 #define ISO_BUF_READ_ERROR 0xE830FFF5 08378 08379 /** Trying to add to a dir a node already added to a dir (FAILURE,HIGH, -64) */ 08380 #define ISO_NODE_ALREADY_ADDED 0xE830FFC0 08381 08382 /** Node with same name already exists (FAILURE,HIGH, -65) */ 08383 #define ISO_NODE_NAME_NOT_UNIQUE 0xE830FFBF 08384 08385 /** Trying to remove a node that was not added to dir (FAILURE,HIGH, -65) */ 08386 #define ISO_NODE_NOT_ADDED_TO_DIR 0xE830FFBE 08387 08388 /** A requested node does not exist (FAILURE,HIGH, -66) */ 08389 #define ISO_NODE_DOESNT_EXIST 0xE830FFBD 08390 08391 /** 08392 * Try to set the boot image of an already bootable image (FAILURE,HIGH, -67) 08393 */ 08394 #define ISO_IMAGE_ALREADY_BOOTABLE 0xE830FFBC 08395 08396 /** Trying to use an invalid file as boot image (FAILURE,HIGH, -68) */ 08397 #define ISO_BOOT_IMAGE_NOT_VALID 0xE830FFBB 08398 08399 /** Too many boot images (FAILURE,HIGH, -69) */ 08400 #define ISO_BOOT_IMAGE_OVERFLOW 0xE830FFBA 08401 08402 /** No boot catalog created yet ((FAILURE,HIGH, -70) */ /* @since 0.6.34 */ 08403 #define ISO_BOOT_NO_CATALOG 0xE830FFB9 08404 08405 08406 /** 08407 * Error on file operation (FAILURE,HIGH, -128) 08408 * (take a look at more specified error codes below) 08409 */ 08410 #define ISO_FILE_ERROR 0xE830FF80 08411 08412 /** Trying to open an already opened file (FAILURE,HIGH, -129) */ 08413 #define ISO_FILE_ALREADY_OPENED 0xE830FF7F 08414 08415 /* @deprecated use ISO_FILE_ALREADY_OPENED instead */ 08416 #define ISO_FILE_ALREADY_OPENNED 0xE830FF7F 08417 08418 /** Access to file is not allowed (FAILURE,HIGH, -130) */ 08419 #define ISO_FILE_ACCESS_DENIED 0xE830FF7E 08420 08421 /** Incorrect path to file (FAILURE,HIGH, -131) */ 08422 #define ISO_FILE_BAD_PATH 0xE830FF7D 08423 08424 /** The file does not exist in the filesystem (FAILURE,HIGH, -132) */ 08425 #define ISO_FILE_DOESNT_EXIST 0xE830FF7C 08426 08427 /** Trying to read or close a file not openned (FAILURE,HIGH, -133) */ 08428 #define ISO_FILE_NOT_OPENED 0xE830FF7B 08429 08430 /* @deprecated use ISO_FILE_NOT_OPENED instead */ 08431 #define ISO_FILE_NOT_OPENNED ISO_FILE_NOT_OPENED 08432 08433 /** Directory used where no dir is expected (FAILURE,HIGH, -134) */ 08434 #define ISO_FILE_IS_DIR 0xE830FF7A 08435 08436 /** Read error (FAILURE,HIGH, -135) */ 08437 #define ISO_FILE_READ_ERROR 0xE830FF79 08438 08439 /** Not dir used where a dir is expected (FAILURE,HIGH, -136) */ 08440 #define ISO_FILE_IS_NOT_DIR 0xE830FF78 08441 08442 /** Not symlink used where a symlink is expected (FAILURE,HIGH, -137) */ 08443 #define ISO_FILE_IS_NOT_SYMLINK 0xE830FF77 08444 08445 /** Can't seek to specified location (FAILURE,HIGH, -138) */ 08446 #define ISO_FILE_SEEK_ERROR 0xE830FF76 08447 08448 /** File not supported in ECMA-119 tree and thus ignored (WARNING,MEDIUM, -139) */ 08449 #define ISO_FILE_IGNORED 0xD020FF75 08450 08451 /* A file is bigger than supported by used standard (FAILURE,HIGH, -140) */ 08452 #define ISO_FILE_TOO_BIG 0xE830FF74 08453 08454 /* File read error during image creation (MISHAP,HIGH, -141) */ 08455 #define ISO_FILE_CANT_WRITE 0xE430FF73 08456 08457 /* Can't convert filename to requested charset (WARNING,MEDIUM, -142) */ 08458 #define ISO_FILENAME_WRONG_CHARSET 0xD020FF72 08459 /* This was once a HINT. Deprecated now. */ 08460 #define ISO_FILENAME_WRONG_CHARSET_OLD 0xC020FF72 08461 08462 /* File can't be added to the tree (SORRY,HIGH, -143) */ 08463 #define ISO_FILE_CANT_ADD 0xE030FF71 08464 08465 /** 08466 * File path break specification constraints and will be ignored 08467 * (WARNING,MEDIUM, -144) 08468 */ 08469 #define ISO_FILE_IMGPATH_WRONG 0xD020FF70 08470 08471 /** 08472 * Offset greater than file size (FAILURE,HIGH, -150) 08473 * @since 0.6.4 08474 */ 08475 #define ISO_FILE_OFFSET_TOO_BIG 0xE830FF6A 08476 08477 08478 /** Charset conversion error (FAILURE,HIGH, -256) */ 08479 #define ISO_CHARSET_CONV_ERROR 0xE830FF00 08480 08481 /** 08482 * Too many files to mangle, i.e. we cannot guarantee unique file names 08483 * (FAILURE,HIGH, -257) 08484 */ 08485 #define ISO_MANGLE_TOO_MUCH_FILES 0xE830FEFF 08486 08487 /* image related errors */ 08488 08489 /** 08490 * Wrong or damaged Primary Volume Descriptor (FAILURE,HIGH, -320) 08491 * This could mean that the file is not a valid ISO image. 08492 */ 08493 #define ISO_WRONG_PVD 0xE830FEC0 08494 08495 /** Wrong or damaged RR entry (SORRY,HIGH, -321) */ 08496 #define ISO_WRONG_RR 0xE030FEBF 08497 08498 /** Unsupported RR feature (SORRY,HIGH, -322) */ 08499 #define ISO_UNSUPPORTED_RR 0xE030FEBE 08500 08501 /** Wrong or damaged ECMA-119 (FAILURE,HIGH, -323) */ 08502 #define ISO_WRONG_ECMA119 0xE830FEBD 08503 08504 /** Unsupported ECMA-119 feature (FAILURE,HIGH, -324) */ 08505 #define ISO_UNSUPPORTED_ECMA119 0xE830FEBC 08506 08507 /** Wrong or damaged El-Torito catalog (WARN,HIGH, -325) */ 08508 #define ISO_WRONG_EL_TORITO 0xD030FEBB 08509 08510 /** Unsupported El-Torito feature (WARN,HIGH, -326) */ 08511 #define ISO_UNSUPPORTED_EL_TORITO 0xD030FEBA 08512 08513 /** Can't patch an isolinux boot image (SORRY,HIGH, -327) */ 08514 #define ISO_ISOLINUX_CANT_PATCH 0xE030FEB9 08515 08516 /** Unsupported SUSP feature (SORRY,HIGH, -328) */ 08517 #define ISO_UNSUPPORTED_SUSP 0xE030FEB8 08518 08519 /** Error on a RR entry that can be ignored (WARNING,HIGH, -329) */ 08520 #define ISO_WRONG_RR_WARN 0xD030FEB7 08521 08522 /** Error on a RR entry that can be ignored (HINT,MEDIUM, -330) */ 08523 #define ISO_SUSP_UNHANDLED 0xC020FEB6 08524 08525 /** Multiple ER SUSP entries found (WARNING,HIGH, -331) */ 08526 #define ISO_SUSP_MULTIPLE_ER 0xD030FEB5 08527 08528 /** Unsupported volume descriptor found (HINT,MEDIUM, -332) */ 08529 #define ISO_UNSUPPORTED_VD 0xC020FEB4 08530 08531 /** El-Torito related warning (WARNING,HIGH, -333) */ 08532 #define ISO_EL_TORITO_WARN 0xD030FEB3 08533 08534 /** Image write cancelled (MISHAP,HIGH, -334) */ 08535 #define ISO_IMAGE_WRITE_CANCELED 0xE430FEB2 08536 08537 /** El-Torito image is hidden (WARNING,HIGH, -335) */ 08538 #define ISO_EL_TORITO_HIDDEN 0xD030FEB1 08539 08540 08541 /** AAIP info with ACL or xattr in ISO image will be ignored 08542 (NOTE, HIGH, -336) */ 08543 #define ISO_AAIP_IGNORED 0xB030FEB0 08544 08545 /** Error with decoding ACL from AAIP info (FAILURE, HIGH, -337) */ 08546 #define ISO_AAIP_BAD_ACL 0xE830FEAF 08547 08548 /** Error with encoding ACL for AAIP (FAILURE, HIGH, -338) */ 08549 #define ISO_AAIP_BAD_ACL_TEXT 0xE830FEAE 08550 08551 /** AAIP processing for ACL or xattr not enabled at compile time 08552 (FAILURE, HIGH, -339) */ 08553 #define ISO_AAIP_NOT_ENABLED 0xE830FEAD 08554 08555 /** Error with decoding AAIP info for ACL or xattr (FAILURE, HIGH, -340) */ 08556 #define ISO_AAIP_BAD_AASTRING 0xE830FEAC 08557 08558 /** Error with reading ACL or xattr from local file (FAILURE, HIGH, -341) */ 08559 #define ISO_AAIP_NO_GET_LOCAL 0xE830FEAB 08560 08561 /** Error with attaching ACL or xattr to local file (FAILURE, HIGH, -342) */ 08562 #define ISO_AAIP_NO_SET_LOCAL 0xE830FEAA 08563 08564 /** Unallowed attempt to set an xattr with non-userspace name 08565 (FAILURE, HIGH, -343) */ 08566 #define ISO_AAIP_NON_USER_NAME 0xE830FEA9 08567 08568 /** Too many references on a single IsoExternalFilterCommand 08569 (FAILURE, HIGH, -344) */ 08570 #define ISO_EXTF_TOO_OFTEN 0xE830FEA8 08571 08572 /** Use of zlib was not enabled at compile time (FAILURE, HIGH, -345) */ 08573 #define ISO_ZLIB_NOT_ENABLED 0xE830FEA7 08574 08575 /** Cannot apply zisofs filter to file >= 4 GiB (FAILURE, HIGH, -346) */ 08576 #define ISO_ZISOFS_TOO_LARGE 0xE830FEA6 08577 08578 /** Filter input differs from previous run (FAILURE, HIGH, -347) */ 08579 #define ISO_FILTER_WRONG_INPUT 0xE830FEA5 08580 08581 /** zlib compression/decompression error (FAILURE, HIGH, -348) */ 08582 #define ISO_ZLIB_COMPR_ERR 0xE830FEA4 08583 08584 /** Input stream is not in zisofs format (FAILURE, HIGH, -349) */ 08585 #define ISO_ZISOFS_WRONG_INPUT 0xE830FEA3 08586 08587 /** Cannot set global zisofs parameters while filters exist 08588 (FAILURE, HIGH, -350) */ 08589 #define ISO_ZISOFS_PARAM_LOCK 0xE830FEA2 08590 08591 /** Premature EOF of zlib input stream (FAILURE, HIGH, -351) */ 08592 #define ISO_ZLIB_EARLY_EOF 0xE830FEA1 08593 08594 /** 08595 * Checksum area or checksum tag appear corrupted (WARNING,HIGH, -352) 08596 * @since 0.6.22 08597 */ 08598 #define ISO_MD5_AREA_CORRUPTED 0xD030FEA0 08599 08600 /** 08601 * Checksum mismatch between checksum tag and data blocks 08602 * (FAILURE, HIGH, -353) 08603 * @since 0.6.22 08604 */ 08605 #define ISO_MD5_TAG_MISMATCH 0xE830FE9F 08606 08607 /** 08608 * Checksum mismatch in System Area, Volume Descriptors, or directory tree. 08609 * (FAILURE, HIGH, -354) 08610 * @since 0.6.22 08611 */ 08612 #define ISO_SB_TREE_CORRUPTED 0xE830FE9E 08613 08614 /** 08615 * Unexpected checksum tag type encountered. (WARNING, HIGH, -355) 08616 * @since 0.6.22 08617 */ 08618 #define ISO_MD5_TAG_UNEXPECTED 0xD030FE9D 08619 08620 /** 08621 * Misplaced checksum tag encountered. (WARNING, HIGH, -356) 08622 * @since 0.6.22 08623 */ 08624 #define ISO_MD5_TAG_MISPLACED 0xD030FE9C 08625 08626 /** 08627 * Checksum tag with unexpected address range encountered. 08628 * (WARNING, HIGH, -357) 08629 * @since 0.6.22 08630 */ 08631 #define ISO_MD5_TAG_OTHER_RANGE 0xD030FE9B 08632 08633 /** 08634 * Detected file content changes while it was written into the image. 08635 * (MISHAP, HIGH, -358) 08636 * @since 0.6.22 08637 */ 08638 #define ISO_MD5_STREAM_CHANGE 0xE430FE9A 08639 08640 /** 08641 * Session does not start at LBA 0. scdbackup checksum tag not written. 08642 * (WARNING, HIGH, -359) 08643 * @since 0.6.24 08644 */ 08645 #define ISO_SCDBACKUP_TAG_NOT_0 0xD030FE99 08646 08647 /** 08648 * The setting of iso_write_opts_set_ms_block() leaves not enough room 08649 * for the prescibed size of iso_write_opts_set_overwrite_buf(). 08650 * (FAILURE, HIGH, -360) 08651 * @since 0.6.36 08652 */ 08653 #define ISO_OVWRT_MS_TOO_SMALL 0xE830FE98 08654 08655 /** 08656 * The partition offset is not 0 and leaves not not enough room for 08657 * system area, volume descriptors, and checksum tags of the first tree. 08658 * (FAILURE, HIGH, -361) 08659 */ 08660 #define ISO_PART_OFFST_TOO_SMALL 0xE830FE97 08661 08662 /** 08663 * The ring buffer is smaller than 64 kB + partition offset. 08664 * (FAILURE, HIGH, -362) 08665 */ 08666 #define ISO_OVWRT_FIFO_TOO_SMALL 0xE830FE96 08667 08668 /** Use of libjte was not enabled at compile time (FAILURE, HIGH, -363) */ 08669 #define ISO_LIBJTE_NOT_ENABLED 0xE830FE95 08670 08671 /** Failed to start up Jigdo Template Extraction (FAILURE, HIGH, -364) */ 08672 #define ISO_LIBJTE_START_FAILED 0xE830FE94 08673 08674 /** Failed to finish Jigdo Template Extraction (FAILURE, HIGH, -365) */ 08675 #define ISO_LIBJTE_END_FAILED 0xE830FE93 08676 08677 /** Failed to process file for Jigdo Template Extraction 08678 (MISHAP, HIGH, -366) */ 08679 #define ISO_LIBJTE_FILE_FAILED 0xE430FE92 08680 08681 /** Too many MIPS Big Endian boot files given (max. 15) (FAILURE, HIGH, -367)*/ 08682 #define ISO_BOOT_TOO_MANY_MIPS 0xE830FE91 08683 08684 /** Boot file missing in image (MISHAP, HIGH, -368) */ 08685 #define ISO_BOOT_FILE_MISSING 0xE430FE90 08686 08687 /** Partition number out of range (FAILURE, HIGH, -369) */ 08688 #define ISO_BAD_PARTITION_NO 0xE830FE8F 08689 08690 /** Cannot open data file for appended partition (FAILURE, HIGH, -370) */ 08691 #define ISO_BAD_PARTITION_FILE 0xE830FE8E 08692 08693 /** May not combine MBR partition with non-MBR system area 08694 (FAILURE, HIGH, -371) */ 08695 #define ISO_NON_MBR_SYS_AREA 0xE830FE8D 08696 08697 /** Displacement offset leads outside 32 bit range (FAILURE, HIGH, -372) */ 08698 #define ISO_DISPLACE_ROLLOVER 0xE830FE8C 08699 08700 /** File name cannot be written into ECMA-119 untranslated 08701 (FAILURE, HIGH, -373) */ 08702 #define ISO_NAME_NEEDS_TRANSL 0xE830FE8B 08703 08704 /** Data file input stream object offers no cloning method 08705 (FAILURE, HIGH, -374) */ 08706 #define ISO_STREAM_NO_CLONE 0xE830FE8A 08707 08708 /** Extended information class offers no cloning method 08709 (FAILURE, HIGH, -375) */ 08710 #define ISO_XINFO_NO_CLONE 0xE830FE89 08711 08712 /** Found copied superblock checksum tag (WARNING, HIGH, -376) */ 08713 #define ISO_MD5_TAG_COPIED 0xD030FE88 08714 08715 /** Rock Ridge leaf name too long (FAILURE, HIGH, -377) */ 08716 #define ISO_RR_NAME_TOO_LONG 0xE830FE87 08717 08718 /** Reserved Rock Ridge leaf name (FAILURE, HIGH, -378) */ 08719 #define ISO_RR_NAME_RESERVED 0xE830FE86 08720 08721 /** Rock Ridge path too long (FAILURE, HIGH, -379) */ 08722 #define ISO_RR_PATH_TOO_LONG 0xE830FE85 08723 08724 /** Attribute name cannot be represented (FAILURE, HIGH, -380) */ 08725 #define ISO_AAIP_BAD_ATTR_NAME 0xE830FE84 08726 08727 /** ACL text contains multiple entries of user::, group::, other:: 08728 (FAILURE, HIGH, -381) */ 08729 #define ISO_AAIP_ACL_MULT_OBJ 0xE830FE83 08730 08731 /** File sections do not form consecutive array of blocks 08732 (FAILURE, HIGH, -382) */ 08733 #define ISO_SECT_SCATTERED 0xE830FE82 08734 08735 /** Too many Apple Partition Map entries requested (FAILURE, HIGH, -383) */ 08736 #define ISO_BOOT_TOO_MANY_APM 0xE830FE81 08737 08738 /** Overlapping Apple Partition Map entries requested (FAILURE, HIGH, -384) */ 08739 #define ISO_BOOT_APM_OVERLAP 0xE830FE80 08740 08741 /** Too many GPT entries requested (FAILURE, HIGH, -385) */ 08742 #define ISO_BOOT_TOO_MANY_GPT 0xE830FE7F 08743 08744 /** Overlapping GPT entries requested (FAILURE, HIGH, -386) */ 08745 #define ISO_BOOT_GPT_OVERLAP 0xE830FE7E 08746 08747 /** Too many MBR partition entries requested (FAILURE, HIGH, -387) */ 08748 #define ISO_BOOT_TOO_MANY_MBR 0xE830FE7D 08749 08750 /** Overlapping MBR partition entries requested (FAILURE, HIGH, -388) */ 08751 #define ISO_BOOT_MBR_OVERLAP 0xE830FE7C 08752 08753 /** Attempt to use an MBR partition entry twice (FAILURE, HIGH, -389) */ 08754 #define ISO_BOOT_MBR_COLLISION 0xE830FE7B 08755 08756 /** No suitable El Torito EFI boot image for exposure as GPT partition 08757 (FAILURE, HIGH, -390) */ 08758 #define ISO_BOOT_NO_EFI_ELTO 0xE830FE7A 08759 08760 /** Not a supported HFS+ or APM block size (FAILURE, HIGH, -391) */ 08761 #define ISO_BOOT_HFSP_BAD_BSIZE 0xE830FE79 08762 08763 /** APM block size prevents coexistence with GPT (FAILURE, HIGH, -392) */ 08764 #define ISO_BOOT_APM_GPT_BSIZE 0xE830FE78 08765 08766 /** Name collision in HFS+, mangling not possible (FAILURE, HIGH, -393) */ 08767 #define ISO_HFSP_NO_MANGLE 0xE830FE77 08768 08769 /** Symbolic link cannot be resolved (FAILURE, HIGH, -394) */ 08770 #define ISO_DEAD_SYMLINK 0xE830FE76 08771 08772 /** Too many chained symbolic links (FAILURE, HIGH, -395) */ 08773 #define ISO_DEEP_SYMLINK 0xE830FE75 08774 08775 /** Unrecognized file type in ISO image (FAILURE, HIGH, -396) */ 08776 #define ISO_BAD_ISO_FILETYPE 0xE830FE74 08777 08778 /** Filename not suitable for character set UCS-2 (WARNING, HIGH, -397) */ 08779 #define ISO_NAME_NOT_UCS2 0xD030FE73 08780 08781 /** File name collision during ISO image import (WARNING, HIGH, -398) */ 08782 #define ISO_IMPORT_COLLISION 0xD030FE72 08783 08784 /** Incomplete HP-PA PALO boot parameters (FAILURE, HIGH, -399) */ 08785 #define ISO_HPPA_PALO_INCOMPL 0xE830FE71 08786 08787 /** HP-PA PALO boot address exceeds 2 GB (FAILURE, HIGH, -400) */ 08788 #define ISO_HPPA_PALO_OFLOW 0xE830FE70 08789 08790 /** HP-PA PALO file is not a data file (FAILURE, HIGH, -401) */ 08791 #define ISO_HPPA_PALO_NOTREG 0xE830FE6F 08792 08793 /** HP-PA PALO command line too long (FAILURE, HIGH, -402) */ 08794 #define ISO_HPPA_PALO_CMDLEN 0xE830FE6E 08795 08796 /** Problems encountered during inspection of System Area (WARN, HIGH, -403) */ 08797 #define ISO_SYSAREA_PROBLEMS 0xD030FE6D 08798 08799 /** Unrecognized inquiry for system area property (FAILURE, HIGH, -404) */ 08800 #define ISO_INQ_SYSAREA_PROP 0xE830FE6C 08801 08802 /** DEC Alpha Boot Loader file is not a data file (FAILURE, HIGH, -405) */ 08803 #define ISO_ALPHA_BOOT_NOTREG 0xE830FE6B 08804 08805 /** No data source of imported ISO image available (WARNING, HIGH, -406) */ 08806 #define ISO_NO_KEPT_DATA_SRC 0xD030FE6A 08807 08808 /** Malformed description string for interval reader (FAILURE, HIGH, -407) */ 08809 #define ISO_MALFORMED_READ_INTVL 0xE830FE69 08810 08811 /** Unreadable file, premature EOF, or failure to seek for interval reader 08812 (WARNING, HIGH, -408) */ 08813 #define ISO_INTVL_READ_PROBLEM 0xD030FE68 08814 08815 /** Cannot arrange content of data files in surely reproducible way 08816 (NOTE, HIGH, -409) */ 08817 #define ISO_NOT_REPRODUCIBLE 0xB030FE67 08818 08819 /** May not write boot info into filtered stream of boot image 08820 (FAILURE, HIGH, -410) */ 08821 #define ISO_PATCH_FILTERED_BOOT 0xE830FE66 08822 08823 /** Boot image to large to buffer for writing boot info 08824 (FAILURE, HIGH, -411) */ 08825 #define ISO_PATCH_OVERSIZED_BOOT 0xE830FE65 08826 08827 /** File name had to be truncated and MD5 marked (WARNING, HIGH, -412) */ 08828 #define ISO_RR_NAME_TRUNCATED 0xD030FE64 08829 08830 /** File name truncation length changed by loaded image info 08831 (NOTE, HIGH, -413) */ 08832 #define ISO_TRUNCATE_ISOFSNT 0xB030FE63 08833 08834 /** General note (NOTE, HIGH, -414) */ 08835 #define ISO_GENERAL_NOTE 0xB030FE62 08836 08837 /** Unrecognized file type of IsoFileSrc object (SORRY, HIGH, -415) */ 08838 #define ISO_BAD_FSRC_FILETYPE 0xE030FE61 08839 08840 /** Cannot derive GPT GUID from undefined pseudo-UUID volume timestamp 08841 (FAILURE, HIGH, -416) */ 08842 #define ISO_GPT_NO_VOL_UUID 0xE830FE60 08843 08844 /** Unrecognized GPT disk GUID setup mode 08845 (FAILURE, HIGH, -417) */ 08846 #define ISO_BAD_GPT_GUID_MODE 0xE830FE5F 08847 08848 08849 /* Internal developer note: 08850 Place new error codes directly above this comment. 08851 Newly introduced errors must get a message entry in 08852 libisofs/messages.c, function iso_error_to_msg() 08853 */ 08854 08855 /* ! PLACE NEW ERROR CODES ABOVE. NOT AFTER THIS LINE ! */ 08856 08857 08858 /** Read error occurred with IsoDataSource (SORRY,HIGH, -513) */ 08859 #define ISO_DATA_SOURCE_SORRY 0xE030FCFF 08860 08861 /** Read error occurred with IsoDataSource (MISHAP,HIGH, -513) */ 08862 #define ISO_DATA_SOURCE_MISHAP 0xE430FCFF 08863 08864 /** Read error occurred with IsoDataSource (FAILURE,HIGH, -513) */ 08865 #define ISO_DATA_SOURCE_FAILURE 0xE830FCFF 08866 08867 /** Read error occurred with IsoDataSource (FATAL,HIGH, -513) */ 08868 #define ISO_DATA_SOURCE_FATAL 0xF030FCFF 08869 08870 08871 /* ! PLACE NEW ERROR CODES SEVERAL LINES ABOVE. NOT HERE ! */ 08872 08873 08874 /* ------------------------------------------------------------------------- */ 08875 08876 #ifdef LIBISOFS_WITHOUT_LIBBURN 08877 08878 /** 08879 This is a copy from the API of libburn-0.6.0 (under GPL). 08880 It is supposed to be as stable as any overall include of libburn.h. 08881 I.e. if this definition is out of sync then you cannot rely on any 08882 contract that was made with libburn.h. 08883 08884 Libisofs does not need to be linked with libburn at all. But if it is 08885 linked with libburn then it must be libburn-0.4.2 or later. 08886 08887 An application that provides own struct burn_source objects and does not 08888 include libburn/libburn.h has to define LIBISOFS_WITHOUT_LIBBURN before 08889 including libisofs/libisofs.h in order to make this copy available. 08890 */ 08891 08892 08893 /** Data source interface for tracks. 08894 This allows to use arbitrary program code as provider of track input data. 08895 08896 Objects compliant to this interface are either provided by the application 08897 or by API calls of libburn: burn_fd_source_new(), burn_file_source_new(), 08898 and burn_fifo_source_new(). 08899 08900 libisofs acts as "application" and implements an own class of burn_source. 08901 Instances of that class are handed out by iso_image_create_burn_source(). 08902 08903 */ 08904 struct burn_source { 08905 08906 /** Reference count for the data source. MUST be 1 when a new source 08907 is created and thus the first reference is handed out. Increment 08908 it to take more references for yourself. Use burn_source_free() 08909 to destroy your references to it. */ 08910 int refcount; 08911 08912 08913 /** Read data from the source. Semantics like with read(2), but MUST 08914 either deliver the full buffer as defined by size or MUST deliver 08915 EOF (return 0) or failure (return -1) at this call or at the 08916 next following call. I.e. the only incomplete buffer may be the 08917 last one from that source. 08918 libburn will read a single sector by each call to (*read). 08919 The size of a sector depends on BURN_MODE_*. The known range is 08920 2048 to 2352. 08921 08922 If this call is reading from a pipe then it will learn 08923 about the end of data only when that pipe gets closed on the 08924 feeder side. So if the track size is not fixed or if the pipe 08925 delivers less than the predicted amount or if the size is not 08926 block aligned, then burning will halt until the input process 08927 closes the pipe. 08928 08929 IMPORTANT: 08930 If this function pointer is NULL, then the struct burn_source is of 08931 version >= 1 and the job of .(*read)() is done by .(*read_xt)(). 08932 See below, member .version. 08933 */ 08934 int (*read)(struct burn_source *, unsigned char *buffer, int size); 08935 08936 08937 /** Read subchannel data from the source (NULL if lib generated) 08938 WARNING: This is an obscure feature with CD raw write modes. 08939 Unless you checked the libburn code for correctness in that aspect 08940 you should not rely on raw writing with own subchannels. 08941 ADVICE: Set this pointer to NULL. 08942 */ 08943 int (*read_sub)(struct burn_source *, unsigned char *buffer, int size); 08944 08945 08946 /** Get the size of the source's data. Return 0 means unpredictable 08947 size. If application provided (*get_size) allows return 0, then 08948 the application MUST provide a fully functional (*set_size). 08949 */ 08950 off_t (*get_size)(struct burn_source *); 08951 08952 08953 /* @since 0.3.2 */ 08954 /** Program the reply of (*get_size) to a fixed value. It is advised 08955 to implement this by a attribute off_t fixed_size; in *data . 08956 The read() function does not have to take into respect this fake 08957 setting. It is rather a note of libburn to itself. Eventually 08958 necessary truncation or padding is done in libburn. Truncation 08959 is usually considered a misburn. Padding is considered ok. 08960 08961 libburn is supposed to work even if (*get_size) ignores the 08962 setting by (*set_size). But your application will not be able to 08963 enforce fixed track sizes by burn_track_set_size() and possibly 08964 even padding might be left out. 08965 */ 08966 int (*set_size)(struct burn_source *source, off_t size); 08967 08968 08969 /** Clean up the source specific data. This function will be called 08970 once by burn_source_free() when the last referer disposes the 08971 source. 08972 */ 08973 void (*free_data)(struct burn_source *); 08974 08975 08976 /** Next source, for when a source runs dry and padding is disabled 08977 WARNING: This is an obscure feature. Set to NULL at creation and 08978 from then on leave untouched and uninterpreted. 08979 */ 08980 struct burn_source *next; 08981 08982 08983 /** Source specific data. Here the various source classes express their 08984 specific properties and the instance objects store their individual 08985 management data. 08986 E.g. data could point to a struct like this: 08987 struct app_burn_source 08988 { 08989 struct my_app *app_handle; 08990 ... other individual source parameters ... 08991 off_t fixed_size; 08992 }; 08993 08994 Function (*free_data) has to be prepared to clean up and free 08995 the struct. 08996 */ 08997 void *data; 08998 08999 09000 /* @since 0.4.2 */ 09001 /** Valid only if above member .(*read)() is NULL. This indicates a 09002 version of struct burn_source younger than 0. 09003 From then on, member .version tells which further members exist 09004 in the memory layout of struct burn_source. libburn will only touch 09005 those announced extensions. 09006 09007 Versions: 09008 0 has .(*read)() != NULL, not even .version is present. 09009 1 has .version, .(*read_xt)(), .(*cancel)() 09010 */ 09011 int version; 09012 09013 /** This substitutes for (*read)() in versions above 0. */ 09014 int (*read_xt)(struct burn_source *, unsigned char *buffer, int size); 09015 09016 /** Informs the burn_source that the consumer of data prematurely 09017 ended reading. This call may or may not be issued by libburn 09018 before (*free_data)() is called. 09019 */ 09020 int (*cancel)(struct burn_source *source); 09021 }; 09022 09023 #endif /* LIBISOFS_WITHOUT_LIBBURN */ 09024 09025 /* ----------------------------- Bug Fixes ----------------------------- */ 09026 09027 /* currently none being tested */ 09028 09029 09030 /* ---------------------------- Improvements --------------------------- */ 09031 09032 /* currently none being tested */ 09033 09034 09035 /* ---------------------------- Experiments ---------------------------- */ 09036 09037 09038 /* Experiment: Write obsolete RR entries with Rock Ridge. 09039 I suspect Solaris wants to see them. 09040 DID NOT HELP: Solaris knows only RRIP_1991A. 09041 09042 #define Libisofs_with_rrip_rR yes 09043 */ 09044 09045 #ifdef __cplusplus 09046 } /* extern "C" */ 09047 #endif 09048 09049 #endif /*LIBISO_LIBISOFS_H_*/