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