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