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