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