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