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