libisofs 1.5.8
libisofs.h
Go to the documentation of this file.
1
2#ifndef LIBISO_LIBISOFS_H_
3#define LIBISO_LIBISOFS_H_
4
5/*
6 * Copyright (c) 2007-2008 Vreixo Formoso, Mario Danic
7 * Copyright (c) 2009-2026 Thomas Schmitt
8 *
9 * This file is part of the libisofs project; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License version 2
11 * or later as published by the Free Software Foundation.
12 * See COPYING file for details.
13 */
14
15/* Important: If you add a public API function then add its name to file
16 libisofs/libisofs.ver
17 in the node LIBISOFS6_Major.Minor.Micro with the numbers of
18 the next release version.
19*/
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25/*
26 *
27 * Applications must use 64 bit off_t.
28 * E.g. on 32-bit GNU/Linux by defining
29 * #define _LARGEFILE_SOURCE
30 * #define _FILE_OFFSET_BITS 64
31 * The minimum requirement is to interface with the library by 64 bit signed
32 * integers where libisofs.h or libisoburn.h prescribe off_t.
33 * Failure to do so may result in surprising malfunction or memory faults.
34 *
35 * Application files which include libisofs/libisofs.h must provide
36 * definitions for uint32_t and uint8_t.
37 * This can be achieved either:
38 * - by using autotools which will define HAVE_STDINT_H or HAVE_INTTYPES_H
39 * according to its ./configure tests,
40 * - or by defining the macros HAVE_STDINT_H or HAVE_INTTYPES_H according
41 * to the local situation,
42 * - or by appropriately defining uint32_t and uint8_t by other means,
43 * e.g. by including inttypes.h before including libisofs.h
44 */
45#ifdef HAVE_STDINT_H
46#include <stdint.h>
47#else
48#ifdef HAVE_INTTYPES_H
49#include <inttypes.h>
50#endif
51#endif
52
53
54/*
55 * Normally this API is operated via public functions and opaque object
56 * handles. But it also exposes several C structures which may be used to
57 * provide custom functionality for the objects of the API. The same
58 * structures are used for internal objects of libisofs, too.
59 * You are not supposed to manipulate the entrails of such objects if they
60 * are not your own custom extensions.
61 *
62 * See for an example IsoStream = struct iso_stream below.
63 */
64
65
66#include <sys/stat.h>
67
68#include <stdlib.h>
69
70/* Because AIX defines "open" as "open64".
71 There are struct members named "open" in libisofs.h which get affected.
72 So all includers of libisofs.h must get included fcntl.h to see the same.
73*/
74#include <fcntl.h>
75
76
77/**
78 * The following two functions and three macros are utilities to help ensuring
79 * version match of application, compile time header, and runtime library.
80 */
81/**
82 * These three release version numbers tell the revision of this header file
83 * and of the API it describes. They are memorized by applications at
84 * compile time.
85 * They must show the same values as these symbols in ./configure.ac
86 * LIBISOFS_MAJOR_VERSION=...
87 * LIBISOFS_MINOR_VERSION=...
88 * LIBISOFS_MICRO_VERSION=...
89 * Note to anybody who does own work inside libisofs:
90 * Any change of configure.ac or libisofs.h has to keep up this equality !
91 *
92 * Before usage of these macros on your code, please read the usage discussion
93 * below.
94 *
95 * @since 0.6.2
96 */
97#define iso_lib_header_version_major 1
98#define iso_lib_header_version_minor 5
99#define iso_lib_header_version_micro 8
100
101/**
102 * Get version of the libisofs library at runtime.
103 * NOTE: This function may be called before iso_init().
104 *
105 * @since 0.6.2
106 */
107void iso_lib_version(int *major, int *minor, int *micro);
108
109/**
110 * Check at runtime if the library is ABI compatible with the given version.
111 * NOTE: This function may be called before iso_init().
112 *
113 * @return
114 * 1 lib is compatible, 0 is not.
115 *
116 * @since 0.6.2
117 */
118int iso_lib_is_compatible(int major, int minor, int micro);
119
120/**
121 * Usage discussion:
122 *
123 * Some developers of the libburnia project have differing opinions how to
124 * ensure the compatibility of libraries and applications.
125 *
126 * It is about whether to use at compile time and at runtime the version
127 * numbers provided here. Thomas Schmitt advises to use them. Vreixo Formoso
128 * advises to use other means.
129 *
130 * At compile time:
131 *
132 * Vreixo Formoso advises to leave proper version matching to properly
133 * programmed checks in the the application's build system, which will
134 * refuse compilation in case of mismatch.
135 *
136 * Thomas Schmitt advises to use the macros defined here for comparison with
137 * the application's requirements of library revisions and to break compilation
138 * in case of mismatch.
139 *
140 * Both advises are combinable. I.e. be master of your build system and have
141 * #if checks in the source code of your application, nevertheless.
142 *
143 * At runtime (via iso_lib_is_compatible()):
144 *
145 * Vreixo Formoso advises to compare the application's requirements of
146 * library revisions with the runtime library. This is to allow runtime
147 * libraries which are young enough for the application but too old for
148 * the lib*.h files seen at compile time.
149 *
150 * Thomas Schmitt advises to compare the header revisions defined here with
151 * the runtime library. This is to enforce a strictly monotonous chain of
152 * revisions from app to header to library, at the cost of excluding some older
153 * libraries.
154 *
155 * These two advises are mutually exclusive.
156 */
157
158struct burn_source;
159
160/**
161 * Context for image creation. It holds the files that will be added to image,
162 * and several options to control libisofs behavior.
163 *
164 * @since 0.6.2
165 */
166typedef struct Iso_Image IsoImage;
167
168/*
169 * A node in the iso tree, i.e. a file that will be written to image.
170 *
171 * It can represent any kind of files. When needed, you can get the type with
172 * iso_node_get_type() and cast it to the appropriate subtype. Useful macros
173 * are provided, see below.
174 *
175 * @since 0.6.2
176 */
177typedef struct Iso_Node IsoNode;
178
179/**
180 * A directory in the iso tree. It is an special type of IsoNode and can be
181 * casted to it in any case.
182 *
183 * @since 0.6.2
184 */
185typedef struct Iso_Dir IsoDir;
186
187/**
188 * A symbolic link in the iso tree. It is an special type of IsoNode and can be
189 * casted to it in any case.
190 *
191 * @since 0.6.2
192 */
193typedef struct Iso_Symlink IsoSymlink;
194
195/**
196 * A regular file in the iso tree. It is an special type of IsoNode and can be
197 * casted to it in any case.
198 *
199 * @since 0.6.2
200 */
201typedef struct Iso_File IsoFile;
202
203/**
204 * An special file in the iso tree. This is used to represent any POSIX file
205 * other that regular files, directories or symlinks, i.e.: socket, block and
206 * character devices, and fifos.
207 * It is an special type of IsoNode and can be casted to it in any case.
208 *
209 * @since 0.6.2
210 */
211typedef struct Iso_Special IsoSpecial;
212
213/**
214 * The type of an IsoNode.
215 *
216 * When an user gets an IsoNode from an image, (s)he can use
217 * iso_node_get_type() to get the current type of the node, and then
218 * cast to the appropriate subtype. For example:
219 *
220 * ...
221 * IsoNode *node;
222 * res = iso_dir_iter_next(iter, &node);
223 * if (res == 1 && iso_node_get_type(node) == LIBISO_DIR) {
224 * IsoDir *dir = (IsoDir *)node;
225 * ...
226 * }
227 *
228 * @since 0.6.2
229 */
237
238/* macros to check node type */
239#define ISO_NODE_IS_DIR(n) (iso_node_get_type(n) == LIBISO_DIR)
240#define ISO_NODE_IS_FILE(n) (iso_node_get_type(n) == LIBISO_FILE)
241#define ISO_NODE_IS_SYMLINK(n) (iso_node_get_type(n) == LIBISO_SYMLINK)
242#define ISO_NODE_IS_SPECIAL(n) (iso_node_get_type(n) == LIBISO_SPECIAL)
243#define ISO_NODE_IS_BOOTCAT(n) (iso_node_get_type(n) == LIBISO_BOOT)
244
245/* macros for safe downcasting */
246#define ISO_DIR(n) ((IsoDir*)(ISO_NODE_IS_DIR(n) ? n : NULL))
247#define ISO_FILE(n) ((IsoFile*)(ISO_NODE_IS_FILE(n) ? n : NULL))
248#define ISO_SYMLINK(n) ((IsoSymlink*)(ISO_NODE_IS_SYMLINK(n) ? n : NULL))
249#define ISO_SPECIAL(n) ((IsoSpecial*)(ISO_NODE_IS_SPECIAL(n) ? n : NULL))
250
251#define ISO_NODE(n) ((IsoNode*)n)
252
253/**
254 * File section in an imported or emerging image.
255 *
256 * @since 0.6.8
257 */
259{
260 uint32_t block;
261 uint32_t size;
262};
263
264/* If you get here because of a compilation error like
265
266 /usr/include/libisofs/libisofs.h:166: error:
267 expected specifier-qualifier-list before 'uint32_t'
268
269 then see the paragraph above about the definition of uint32_t.
270*/
271
272
273/**
274 * Context for iterate on directory children.
275 * @see iso_dir_get_children()
276 *
277 * @since 0.6.2
278 */
279typedef struct Iso_Dir_Iter IsoDirIter;
280
281/**
282 * It represents an El-Torito boot image.
283 *
284 * @since 0.6.2
285 */
286typedef struct el_torito_boot_image ElToritoBootImage;
287
288/**
289 * An special type of IsoNode that acts as a placeholder for an El-Torito
290 * boot catalog. Once written, it will appear as a regular file.
291 *
292 * @since 0.6.2
293 */
294typedef struct Iso_Boot IsoBoot;
295
296/**
297 * Flag used to hide a file in the RR/ISO or Joliet tree.
298 *
299 * @see iso_node_set_hidden
300 * @since 0.6.2
301 */
303 /** Hide the node in the ECMA-119 / RR tree */
305 /** Hide the node in the Joliet tree, if Joliet extension are enabled */
307 /** Hide the node in the tree of an Enhanced Volume Descriptor
308 (aka ISO 9660:1999) as of ECMA-119 4th Edition, if that format is
309 enabled
310 */
312
313 /** Hide the node in the HFS+ tree, if that format is enabled.
314 @since 1.2.4
315 */
317
318 /** Hide the node in the FAT tree, if that format is enabled.
319 @since 1.2.4
320 */
322
323 /** With IsoNode and IsoBoot: Write data content even if the node is
324 * not visible in any tree.
325 * With directory nodes : Write data content of IsoNode and IsoBoot
326 * in the directory's tree unless they are
327 * explicitly marked LIBISO_HIDE_ON_RR
328 * without LIBISO_HIDE_BUT_WRITE.
329 * @since 0.6.34
330 */
332};
333
334/**
335 * El-Torito bootable image type.
336 *
337 * @since 0.6.2
338 */
344
345/**
346 * Replace mode used when adding a node to a directory.
347 * This controls how libisofs will act when you tried to add to a dir a file
348 * with the same name that an existing file.
349 *
350 * @since 0.6.2
351 */
353 /**
354 * Never replace an existing node, and instead fail with
355 * ISO_NODE_NAME_NOT_UNIQUE.
356 */
358 /**
359 * Always replace the old node with the new.
360 */
362 /**
363 * Replace with the new node if it is the same file type
364 */
366 /**
367 * Replace with the new node if it is the same file type and its ctime
368 * is newer than the old one.
369 */
371 /**
372 * Replace with the new node if its ctime is newer than the old one.
373 */
375 /*
376 * TODO #00006 define more values
377 * -if both are dirs, add contents (and what to do with conflicts?)
378 */
379};
380
381/**
382 * Options for image writing.
383 * @see iso_write_opts_new()
384 * @since 0.6.2
385 */
386typedef struct iso_write_opts IsoWriteOpts;
387
388/**
389 * Options for image reading or import.
390 * @see iso_read_opts_new()
391 * @since 0.6.2
392 */
393typedef struct iso_read_opts IsoReadOpts;
394
395/**
396 * Source for image reading.
397 *
398 * @see struct iso_data_source
399 * @since 0.6.2
400 */
402
403/**
404 * Data source used by libisofs for reading an existing image.
405 *
406 * It offers homogeneous read access to arbitrary blocks to different sources
407 * for images, such as .iso files, CD/DVD drives, etc...
408 *
409 * To create a multisession image, libisofs needs a IsoDataSource, that the
410 * user must provide. The function iso_data_source_new_from_file() constructs
411 * an IsoDataSource that uses POSIX I/O functions to access data. You can use
412 * it with regular .iso images, and also with block devices that represent a
413 * drive.
414 *
415 * @since 0.6.2
416 */
418{
419
420 /* reserved for future usage, set to 0 */
422
423 /**
424 * Reference count for the data source. Should be 1 when a new source
425 * is created. Don't access it directly, but with iso_data_source_ref()
426 * and iso_data_source_unref() functions.
427 */
428 unsigned int refcount;
429
430 /**
431 * Opens the given source. You must open() the source before any attempt
432 * to read data from it. The open is the right place for grabbing the
433 * underlying resources.
434 *
435 * @return
436 * 1 if success, < 0 on error (has to be a valid libisofs error code)
437 */
438 int (*open)(IsoDataSource *src);
439
440 /**
441 * Close a given source, freeing all system resources previously grabbed in
442 * open().
443 *
444 * @return
445 * 1 if success, < 0 on error (has to be a valid libisofs error code)
446 */
447 int (*close)(IsoDataSource *src);
448
449 /**
450 * Read an arbitrary block (2048 bytes) of data from the source.
451 *
452 * @param lba
453 * Block to be read.
454 * @param buffer
455 * Buffer where the data will be written. It should have at least
456 * 2048 bytes.
457 * @return
458 * 1 if success,
459 * < 0 if error. This function has to emit a valid libisofs error code.
460 * Predefined (but not mandatory) for this purpose are:
461 * ISO_DATA_SOURCE_SORRY , ISO_DATA_SOURCE_MISHAP,
462 * ISO_DATA_SOURCE_FAILURE , ISO_DATA_SOURCE_FATAL
463 */
464 int (*read_block)(IsoDataSource *src, uint32_t lba, uint8_t *buffer);
465
466 /**
467 * Clean up the source specific data. Never call this directly, it is
468 * automatically called by iso_data_source_unref() when refcount reach
469 * 0.
470 */
472
473 /** Source specific data */
474 void *data;
475};
476
477/**
478 * Return information for image. This is optionally allocated by libisofs,
479 * as a way to inform user about the features of an existing image, such as
480 * extensions present, size, ...
481 *
482 * @see iso_image_import()
483 * @since 0.6.2
484 */
485typedef struct iso_read_image_features IsoReadImageFeatures;
486
487/**
488 * POSIX abstraction for source files.
489 *
490 * @see struct iso_file_source
491 * @since 0.6.2
492 */
494
495/**
496 * Abstract for source filesystems.
497 *
498 * @see struct iso_filesystem
499 * @since 0.6.2
500 */
502
503/**
504 * Interface that defines the operations (methods) available for an
505 * IsoFileSource.
506 *
507 * @see struct IsoFileSource_Iface
508 * @since 0.6.2
509 */
511
512/**
513 * IsoFilesystem implementation to deal with ISO images, and to offer a way to
514 * access specific information of the image, such as several volume attributes,
515 * extensions being used, El-Torito artifacts...
516 *
517 * @since 0.6.2
518 */
520
521/**
522 * See IsoFilesystem->get_id() for info about this.
523 * @since 0.6.2
524 */
525extern unsigned int iso_fs_global_id;
526
527/**
528 * An IsoFilesystem is a handler for a source of files, or a "filesystem".
529 * That is defined as a set of files that are organized in a hierarchical
530 * structure.
531 *
532 * A filesystem allows libisofs to access files from several sources in
533 * an homogeneous way, thus abstracting the underlying operations needed to
534 * access and read file contents. Note that this doesn't need to be tied
535 * to the disc filesystem used in the partition being accessed. For example,
536 * we have an IsoFilesystem implementation to access any mounted filesystem,
537 * using standard POSIX functions. It is also legal, of course, to implement
538 * an IsoFilesystem to deal with a specific filesystem over raw partitions.
539 * That is what we do, for example, to access an ISO Image.
540 *
541 * Each file inside an IsoFilesystem is represented as an IsoFileSource object,
542 * that defines POSIX-like interface for accessing files.
543 *
544 * @since 0.6.2
545 */
547{
548 /**
549 * Type of filesystem.
550 * "file" -> local filesystem
551 * "iso " -> iso image filesystem
552 */
553 char type[4];
554
555 /* reserved for future usage, set to 0 */
557
558 /**
559 * Get the root of a filesystem.
560 *
561 * @return
562 * 1 on success, < 0 on error (has to be a valid libisofs error code)
563 */
565
566 /**
567 * Retrieve a file from its absolute path inside the filesystem.
568 * @param file
569 * Returns a pointer to a IsoFileSource object representing the
570 * file. It has to be disposed by iso_file_source_unref() when
571 * no longer needed.
572 * @return
573 * 1 success, < 0 error (has to be a valid libisofs error code)
574 * Error codes:
575 * ISO_FILE_ACCESS_DENIED
576 * ISO_FILE_BAD_PATH
577 * ISO_FILE_DOESNT_EXIST
578 * ISO_OUT_OF_MEM
579 * ISO_FILE_ERROR
580 * ISO_NULL_POINTER
581 */
582 int (*get_by_path)(IsoFilesystem *fs, const char *path,
583 IsoFileSource **file);
584
585 /**
586 * Get filesystem identifier.
587 *
588 * If the filesystem is able to generate correct values of the st_dev
589 * and st_ino fields for the struct stat of each file, this should
590 * return an unique number, greater than 0.
591 *
592 * To get a identifier for your filesystem implementation you should
593 * use iso_fs_global_id, incrementing it by one each time.
594 *
595 * Otherwise, if you can't ensure values in the struct stat are valid,
596 * this should return 0.
597 */
598 unsigned int (*get_id)(IsoFilesystem *fs);
599
600 /**
601 * Opens the filesystem for several read operations. Calling this function
602 * is not needed at all, each time that the underlying system resource
603 * needs to be accessed, it is opened property.
604 * However, if you plan to execute several operations on the filesystem,
605 * it is a good idea to open it previously, to prevent several open/close
606 * operations to occur.
607 *
608 * @return 1 on success, < 0 on error (has to be a valid libisofs error code)
609 */
610 int (*open)(IsoFilesystem *fs);
611
612 /**
613 * Close the filesystem, thus freeing all system resources. You should
614 * call this function if you have previously open() it.
615 * Note that you can open()/close() a filesystem several times.
616 *
617 * @return 1 on success, < 0 on error (has to be a valid libisofs error code)
618 */
619 int (*close)(IsoFilesystem *fs);
620
621 /**
622 * Free implementation specific data. Should never be called by user.
623 * Use iso_filesystem_unref() instead.
624 */
625 void (*free)(IsoFilesystem *fs);
626
627 /* internal usage, do never access them directly */
628 unsigned int refcount;
629 void *data;
630};
631
632/**
633 * Interface definition for an IsoFileSource. Defines the POSIX-like function
634 * to access files and abstract underlying source.
635 *
636 * @since 0.6.2
637 */
639{
640 /**
641 * Tells the version of the interface:
642 * Version 0 provides functions up to (*lseek)().
643 * @since 0.6.2
644 * Version 1 additionally provides function *(get_aa_string)().
645 * @since 0.6.14
646 * Version 2 additionally provides function *(clone_src)().
647 * @since 1.0.2
648 */
650
651 /**
652 * Get the absolute path in the filesystem this file source belongs to.
653 *
654 * @return
655 * the path of the FileSource inside the filesystem, it should be
656 * freed when no more needed.
657 */
658 char* (*get_path)(IsoFileSource *src);
659
660 /**
661 * Get the name of the file, with the dir component of the path.
662 *
663 * @return
664 * the name of the file, it should be freed when no more needed.
665 */
666 char* (*get_name)(IsoFileSource *src);
667
668 /**
669 * Get information about the file. It is equivalent to lstat(2).
670 *
671 * @return
672 * 1 success, < 0 error (has to be a valid libisofs error code)
673 * Error codes:
674 * ISO_FILE_ACCESS_DENIED
675 * ISO_FILE_BAD_PATH
676 * ISO_FILE_DOESNT_EXIST
677 * ISO_OUT_OF_MEM
678 * ISO_FILE_ERROR
679 * ISO_NULL_POINTER
680 */
681 int (*lstat)(IsoFileSource *src, struct stat *info);
682
683 /**
684 * Get information about the file. If the file is a symlink, the info
685 * returned refers to the destination. It is equivalent to stat(2).
686 *
687 * @return
688 * 1 success, < 0 error
689 * Error codes:
690 * ISO_FILE_ACCESS_DENIED
691 * ISO_FILE_BAD_PATH
692 * ISO_FILE_DOESNT_EXIST
693 * ISO_OUT_OF_MEM
694 * ISO_FILE_ERROR
695 * ISO_NULL_POINTER
696 */
697 int (*stat)(IsoFileSource *src, struct stat *info);
698
699 /**
700 * Check if the process has access to read file contents. Note that this
701 * is not necessarily related with (l)stat functions. For example, in a
702 * filesystem implementation to deal with an ISO image, if the user has
703 * read access to the image it will be able to read all files inside it,
704 * despite of the particular permission of each file in the RR tree, that
705 * are what the above functions return.
706 *
707 * @return
708 * 1 if process has read access, < 0 on error (has to be a valid
709 * libisofs error code)
710 * Error codes:
711 * ISO_FILE_ACCESS_DENIED
712 * ISO_FILE_BAD_PATH
713 * ISO_FILE_DOESNT_EXIST
714 * ISO_OUT_OF_MEM
715 * ISO_FILE_ERROR
716 * ISO_NULL_POINTER
717 */
718 int (*access)(IsoFileSource *src);
719
720 /**
721 * Opens the source.
722 * @return 1 on success, < 0 on error (has to be a valid libisofs error code)
723 * Error codes:
724 * ISO_FILE_ALREADY_OPENED
725 * ISO_FILE_ACCESS_DENIED
726 * ISO_FILE_BAD_PATH
727 * ISO_FILE_DOESNT_EXIST
728 * ISO_OUT_OF_MEM
729 * ISO_FILE_ERROR
730 * ISO_NULL_POINTER
731 */
732 int (*open)(IsoFileSource *src);
733
734 /**
735 * Close a previously opened file
736 * @return 1 on success, < 0 on error
737 * Error codes:
738 * ISO_FILE_ERROR
739 * ISO_NULL_POINTER
740 * ISO_FILE_NOT_OPENED
741 */
742 int (*close)(IsoFileSource *src);
743
744 /**
745 * Attempts to read up to count bytes from the given source into
746 * the buffer starting at buf.
747 *
748 * The file src must be open() before calling this, and close() when no
749 * more needed. Not valid for dirs. On symlinks it reads the destination
750 * file.
751 *
752 * @return
753 * number of bytes read, 0 if EOF, < 0 on error (has to be a valid
754 * libisofs error code)
755 * Error codes:
756 * ISO_FILE_ERROR
757 * ISO_NULL_POINTER
758 * ISO_FILE_NOT_OPENED
759 * ISO_WRONG_ARG_VALUE -> if count == 0
760 * ISO_FILE_IS_DIR
761 * ISO_OUT_OF_MEM
762 * ISO_INTERRUPTED
763 */
764 int (*read)(IsoFileSource *src, void *buf, size_t count);
765
766 /**
767 * Read a directory.
768 *
769 * Each call to this function will return a new children, until we reach
770 * the end of file (i.e, no more children), in that case it returns 0.
771 *
772 * The dir must be open() before calling this, and close() when no more
773 * needed. Only valid for dirs.
774 *
775 * Note that "." and ".." children MUST NOT BE returned.
776 *
777 * @param child
778 * pointer to be filled with the given child. Undefined on error or OEF
779 * @return
780 * 1 on success, 0 if EOF (no more children), < 0 on error (has to be
781 * a valid libisofs error code)
782 * Error codes:
783 * ISO_FILE_ERROR
784 * ISO_NULL_POINTER
785 * ISO_FILE_NOT_OPENED
786 * ISO_FILE_IS_NOT_DIR
787 * ISO_OUT_OF_MEM
788 */
789 int (*readdir)(IsoFileSource *src, IsoFileSource **child);
790
791 /**
792 * Read the destination of a symlink. You don't need to open the file
793 * to call this.
794 *
795 * @param buf
796 * allocated buffer of at least bufsiz bytes.
797 * The dest. will be copied there, and it will be NULL-terminated
798 * @param bufsiz
799 * characters to be copied. Destination link will be truncated if
800 * it is larger than given size. This include the 0x0 character.
801 * @return
802 * 1 on success, < 0 on error (has to be a valid libisofs error code)
803 * Error codes:
804 * ISO_FILE_ERROR
805 * ISO_NULL_POINTER
806 * ISO_WRONG_ARG_VALUE -> if bufsiz <= 0
807 * ISO_FILE_IS_NOT_SYMLINK
808 * ISO_OUT_OF_MEM
809 * ISO_FILE_BAD_PATH
810 * ISO_FILE_DOESNT_EXIST
811 *
812 */
813 int (*readlink)(IsoFileSource *src, char *buf, size_t bufsiz);
814
815 /**
816 * Get the filesystem for this source. No extra ref is added, so you
817 * must not unref the IsoFilesystem.
818 *
819 * @return
820 * The filesystem, NULL on error
821 */
822 IsoFilesystem* (*get_filesystem)(IsoFileSource *src);
823
824 /**
825 * Free implementation specific data. Should never be called by user.
826 * Use iso_file_source_unref() instead.
827 */
828 void (*free)(IsoFileSource *src);
829
830 /**
831 * Repositions the offset of the IsoFileSource (must be opened) to the
832 * given offset according to the value of flag.
833 *
834 * @param offset
835 * in bytes
836 * @param flag
837 * 0 The offset is set to offset bytes (SEEK_SET)
838 * 1 The offset is set to its current location plus offset bytes
839 * (SEEK_CUR)
840 * 2 The offset is set to the size of the file plus offset bytes
841 * (SEEK_END).
842 * @return
843 * Absolute offset position of the file, or < 0 on error. Cast the
844 * returning value to int to get a valid libisofs error.
845 *
846 * @since 0.6.4
847 */
848 off_t (*lseek)(IsoFileSource *src, off_t offset, int flag);
849
850 /* Add-ons of .version 1 begin here */
851
852 /**
853 * Valid only if .version is > 0. See above.
854 * Get the AAIP string with encoded ACL and xattr.
855 * (Not to be confused with ECMA-119 Extended Attributes).
856 *
857 * bit1 and bit2 of flag should be implemented so that freshly fetched
858 * info does not include the undesired ACL or xattr. Nevertheless if the
859 * aa_string is cached, then it is permissible that ACL and xattr are still
860 * delivered.
861 *
862 * @param flag Bitfield for control purposes
863 * bit0= Transfer ownership of AAIP string data.
864 * src will free the possibly cached data and might
865 * not be able to produce it again.
866 * bit1= No need to get ACL (no guarantee of exclusion)
867 * bit2= No need to get xattr (no guarantee of exclusion)
868 * bit3= if not bit2: import all xattr namespaces from
869 * local filesystem, not only "user."
870 * bit4= Try to get Linux-like file attribute flags
871 * (chattr) as "isofs.fa"
872 * @since 1.5.8
873 * bit5= With bit4: Ignore non-settable Linux-like file
874 * attribute flags and do not record "isofs.fa"
875 * if the other flags are all zero
876 * @since 1.5.8
877 * bit6= Try to get XFS-style project id as "isofs.pi"
878 * @since 1.5.8
879 * @param aa_string Returns a pointer to the AAIP string data. If no AAIP
880 * string is available, *aa_string becomes NULL.
881 * (See doc/susp_aaip_*_*.txt for the meaning of AAIP and
882 * libisofs/aaip_0_2.h for encoding and decoding.)
883 * The caller is responsible for finally calling free()
884 * on non-NULL results.
885 * @return 1 means success (*aa_string == NULL is possible)
886 * 2 means success, but it is possible that attributes
887 * exist in non-user namespaces which could not be
888 * explored due to lack of permission.
889 * @since 1.5.0
890 * <0 means failure and must b a valid libisofs error code
891 * (e.g. ISO_FILE_ERROR if no better one can be found).
892 * @since 0.6.14
893 */
895 unsigned char **aa_string, int flag);
896
897 /**
898 * Produce a copy of a source. It must be possible to operate both source
899 * objects concurrently.
900 *
901 * @param old_src
902 * The existing source object to be copied
903 * @param new_stream
904 * Will return a pointer to the copy
905 * @param flag
906 * Bitfield for control purposes. Submit 0 for now.
907 * The function shall return ISO_STREAM_NO_CLONE on unknown flag bits.
908 *
909 * @since 1.0.2
910 * Present if .version is 2 or higher.
911 */
912 int (*clone_src)(IsoFileSource *old_src, IsoFileSource **new_src,
913 int flag);
914
915 /*
916 * TODO #00004 Add a get_mime_type() function.
917 * This can be useful for GUI apps, to choose the icon of the file
918 */
919};
920
921#ifndef __cplusplus
922#ifndef Libisofs_h_as_cpluspluS
923
924/**
925 * An IsoFile Source is a POSIX abstraction of a file.
926 *
927 * @since 0.6.2
928 */
930{
931 const IsoFileSourceIface *class;
933 void *data;
934};
935
936#endif /* ! Libisofs_h_as_cpluspluS */
937#endif /* ! __cplusplus */
938
939
940/* A class of IsoStream is implemented by a class description
941 * IsoStreamIface = struct IsoStream_Iface
942 * and a structure of data storage for each instance of IsoStream.
943 * This structure shall be known to the functions of the IsoStreamIface.
944 * To create a custom IsoStream class:
945 * - Define the structure of the custom instance data.
946 * - Implement the methods which are described by the definition of
947 * struct IsoStream_Iface (see below),
948 * - Create a static instance of IsoStreamIface which lists the methods as
949 * C function pointers. (Example in libisofs/stream.c : fsrc_stream_class)
950 * To create an instance of that class:
951 * - Allocate sizeof(IsoStream) bytes of memory and initialize it as
952 * struct iso_stream :
953 * - Point to the custom IsoStreamIface by member .class .
954 * - Set member .refcount to 1.
955 * - Let member .data point to the custom instance data.
956 *
957 * Regrettably the choice of the structure member name "class" makes it
958 * impossible to implement this generic interface in C++ language directly.
959 * If C++ is absolutely necessary then you will have to make own copies
960 * of the public API structures. Use other names but take care to maintain
961 * the same memory layout.
962 */
963
964/**
965 * Representation of file contents. It is an stream of bytes, functionally
966 * like a pipe.
967 *
968 * @since 0.6.4
969 */
970typedef struct iso_stream IsoStream;
971
972/**
973 * Interface that defines the operations (methods) available for an
974 * IsoStream.
975 *
976 * @see struct IsoStream_Iface
977 * @since 0.6.4
978 */
980
981/**
982 * Serial number to be used when you can't get a valid id for a Stream by other
983 * means. If you use this, both fs_id and dev_id should be set to 0.
984 * This must be incremented each time you get a reference to it.
985 *
986 * @see IsoStreamIface->get_id()
987 * @since 0.6.4
988 */
989extern ino_t serial_id;
990
991/**
992 * Interface definition for IsoStream methods. It is public to allow
993 * implementation of own stream types.
994 * The methods defined here typically make use of stream.data which points
995 * to the individual state data of stream instances.
996 *
997 * @since 0.6.4
998 */
999
1001{
1002 /*
1003 * Current version of the interface.
1004 * Version 0 (since 0.6.4)
1005 * deprecated but still valid.
1006 * Version 1 (since 0.6.8)
1007 * update_size() added.
1008 * Version 2 (since 0.6.18)
1009 * get_input_stream() added.
1010 * A filter stream must have version 2 at least.
1011 * Version 3 (since 0.6.20)
1012 * cmp_ino() added.
1013 * A filter stream should have version 3 at least.
1014 * Version 4 (since 1.0.2)
1015 * clone_stream() added.
1016 */
1018
1019 /**
1020 * Type of Stream.
1021 * "fsrc" -> Read from file source
1022 * "cout" -> Cut out interval from disk file
1023 * "mem " -> Read from memory
1024 * "boot" -> Boot catalog
1025 * "extf" -> External filter program
1026 * "ziso" -> zisofs compression
1027 * "osiz" -> zisofs uncompression
1028 * "gzip" -> gzip compression
1029 * "pizg" -> gzip uncompression (gunzip)
1030 * "user" -> User supplied stream
1031 */
1032 char type[4];
1033
1034 /**
1035 * Opens the stream.
1036 *
1037 * @return
1038 * 1 on success, 2 file greater than expected, 3 file smaller than
1039 * expected, < 0 on error (has to be a valid libisofs error code)
1040 */
1041 int (*open)(IsoStream *stream);
1042
1043 /**
1044 * Close the Stream.
1045 * @return
1046 * 1 on success, < 0 on error (has to be a valid libisofs error code)
1047 */
1048 int (*close)(IsoStream *stream);
1049
1050 /**
1051 * Get the size (in bytes) of the stream. This function should always
1052 * return the same size, even if the underlying source size changes,
1053 * unless you call update_size() method.
1054 */
1055 off_t (*get_size)(IsoStream *stream);
1056
1057 /**
1058 * Attempt to read up to count bytes from the given stream into
1059 * the buffer starting at buf. The implementation has to make sure that
1060 * either the full desired count of bytes is delivered or that the
1061 * next call to this function will return EOF or error.
1062 * I.e. only the last read block may be shorter than parameter count.
1063 *
1064 * The stream must be open() before calling this, and close() when no
1065 * more needed.
1066 *
1067 * @return
1068 * number of bytes read, 0 if EOF, < 0 on error (has to be a valid
1069 * libisofs error code)
1070 */
1071 int (*read)(IsoStream *stream, void *buf, size_t count);
1072
1073 /**
1074 * Tell whether this IsoStream can be read several times, with the same
1075 * results. For example, a regular file is repeatable, you can read it
1076 * as many times as you want. However, a pipe is not.
1077 *
1078 * @return
1079 * 1 if stream is repeatable, 0 if not,
1080 * < 0 on error (has to be a valid libisofs error code)
1081 */
1082 int (*is_repeatable)(IsoStream *stream);
1083
1084 /**
1085 * Get an unique identifier for the IsoStream.
1086 */
1087 void (*get_id)(IsoStream *stream, unsigned int *fs_id, dev_t *dev_id,
1088 ino_t *ino_id);
1089
1090 /**
1091 * Free implementation specific data. Should never be called by user.
1092 * Use iso_stream_unref() instead.
1093 */
1094 void (*free)(IsoStream *stream);
1095
1096 /**
1097 * Update the size of the IsoStream with the current size of the underlying
1098 * source, if the source is prone to size changes. After calling this,
1099 * get_size() shall return the new size.
1100 * This will never be called after iso_image_create_burn_source() was
1101 * called and before the image was completely written.
1102 * (The API call to update the size of all files in the image is
1103 * iso_image_update_sizes()).
1104 *
1105 * @return
1106 * 1 if ok, < 0 on error (has to be a valid libisofs error code)
1107 *
1108 * @since 0.6.8
1109 * Present if .version is 1 or higher.
1110 */
1111 int (*update_size)(IsoStream *stream);
1112
1113 /**
1114 * Retrieve the input stream of a filter stream.
1115 *
1116 * @param stream
1117 * The filter stream to be inquired.
1118 * @param flag
1119 * Bitfield for control purposes. 0 means normal behavior.
1120 * @return
1121 * The input stream, if one exists. Elsewise NULL.
1122 * No extra reference to the stream shall be taken by this call.
1123 *
1124 * @since 0.6.18
1125 * Present if .version is 2 or higher.
1126 */
1127 IsoStream *(*get_input_stream)(IsoStream *stream, int flag);
1128
1129 /**
1130 * Compare two streams whether they are based on the same input and will
1131 * produce the same output. If in any doubt, then this comparison should
1132 * indicate no match. A match might allow hardlinking of IsoFile objects.
1133 *
1134 * A pointer value of NULL is permissible. In this case, function
1135 * iso_stream_cmp_ino() will decide on its own.
1136 *
1137 * If not NULL, this function .cmp_ino() will be called by
1138 * iso_stream_cmp_ino() if both compared streams point to it, and if not
1139 * flag bit0 of iso_stream_cmp_ino() prevents it.
1140 * So a .cmp_ino() function must be able to compare any pair of streams
1141 * which name it as their .cmp_ino(). A fallback to iso_stream_cmp_ino(,,1)
1142 * would endanger transitivity of iso_stream_cmp_ino(,,0).
1143 *
1144 * With filter streams, the decision whether the underlying chains of
1145 * streams match, should be delegated to
1146 * iso_stream_cmp_ino(iso_stream_get_input_stream(s1, 0),
1147 * iso_stream_get_input_stream(s2, 0), 0);
1148 *
1149 * The stream.cmp_ino() function has to establish an equivalence and order
1150 * relation:
1151 * cmp_ino(A,A) == 0
1152 * cmp_ino(A,B) == -cmp_ino(B,A)
1153 * if cmp_ino(A,B) == 0 && cmp_ino(B,C) == 0 then cmp_ino(A,C) == 0
1154 * Most tricky is the demand for transitivity:
1155 * if cmp_ino(A,B) < 0 && cmp_ino(B,C) < 0 then cmp_ino(A,C) < 0
1156 *
1157 * @param s1
1158 * The first stream to compare. Expect foreign stream types.
1159 * @param s2
1160 * The second stream to compare. Expect foreign stream types.
1161 * @return
1162 * -1 if s1 is smaller s2 , 0 if s1 matches s2 , 1 if s1 is larger s2
1163 *
1164 * @since 0.6.20
1165 * Present if .version is 3 or higher.
1166 */
1167 int (*cmp_ino)(IsoStream *s1, IsoStream *s2);
1168
1169 /**
1170 * Produce a copy of a stream. It must be possible to operate both stream
1171 * objects concurrently.
1172 *
1173 * @param old_stream
1174 * The existing stream object to be copied
1175 * @param new_stream
1176 * Will return a pointer to the copy
1177 * @param flag
1178 * Bitfield for control purposes. 0 means normal behavior.
1179 * The function shall return ISO_STREAM_NO_CLONE on unknown flag bits.
1180 * @return
1181 * 1 in case of success, or an error code < 0
1182 *
1183 * @since 1.0.2
1184 * Present if .version is 4 or higher.
1185 */
1186 int (*clone_stream)(IsoStream *old_stream, IsoStream **new_stream,
1187 int flag);
1188
1189};
1190
1191#ifndef __cplusplus
1192#ifndef Libisofs_h_as_cpluspluS
1193
1194/**
1195 * Representation of file contents as a stream of bytes.
1196 *
1197 * @since 0.6.4
1198 */
1200{
1203 void *data;
1204};
1205
1206#endif /* ! Libisofs_h_as_cpluspluS */
1207#endif /* ! __cplusplus */
1208
1209
1210/**
1211 * Initialize libisofs. Before any usage of the library you must either call
1212 * this function or iso_init_with_flag().
1213 * Only exception from this rule: iso_lib_version(), iso_lib_is_compatible().
1214 * @return 1 on success, < 0 on error
1215 *
1216 * @since 0.6.2
1217 */
1219
1220/**
1221 * Initialize libisofs. Before any usage of the library you must either call
1222 * this function or iso_init() which is equivalent to iso_init_with_flag(0).
1223 * Only exception from this rule: iso_lib_version(), iso_lib_is_compatible().
1224 * @param flag
1225 * Bitfield for control purposes
1226 * bit0= do not set up locale by LC_* environment variables
1227 * @return 1 on success, < 0 on error
1228 *
1229 * @since 0.6.18
1230 */
1232
1233/**
1234 * Finalize libisofs.
1235 *
1236 * @since 0.6.2
1237 */
1239
1240/**
1241 * Override the reply of libc function nl_langinfo(CODESET) which may or may
1242 * not give the name of the character set which is in effect for your
1243 * environment. So this call can compensate for inconsistent terminal setups.
1244 * Another use case is to choose UTF-8 as intermediate character set for a
1245 * conversion from an exotic input character set to an exotic output set.
1246 *
1247 * @param name
1248 * Name of the character set to be assumed as "local" one.
1249 * @param flag
1250 * Unused yet. Submit 0.
1251 * @return
1252 * 1 indicates success, <=0 failure
1253 *
1254 * @since 0.6.12
1255 */
1256int iso_set_local_charset(char *name, int flag);
1257
1258/**
1259 * Obtain the local charset as currently assumed by libisofs.
1260 * The result points to internal memory. It is volatile and must not be
1261 * altered.
1262 *
1263 * @param flag
1264 * Unused yet. Submit 0.
1265 *
1266 * @since 0.6.12
1267 */
1269
1270/**
1271 * Inquire and maybe define the time which is considered to be "now" and
1272 * used for timestamps of freshly created ISO nodes and as default of
1273 * image timestamps.
1274 * If ever, this should normally be enabled and defined before iso_image_new().
1275 * If it is disabled, time(NULL) is considered to be "now".
1276 *
1277 * @param now
1278 * Returns the "now" value and maybe submits it as definition.
1279 * @param flag
1280 * Bitfield for control purposes
1281 * bit0= *now contains the time to be set as nowtime override.
1282 Enable the override if not bit1 is set, too.
1283 * bit1= Disable the nowtime override
1284 * @return 1= *now is not overridden , 2= *now is overridden
1285 *
1286 * @since 1.5.2
1287 */
1288int iso_nowtime(time_t *now, int flag);
1289
1290
1291/**
1292 * Create a new image, empty.
1293 *
1294 * The image will be owned by you and should be unref() when no more needed.
1295 *
1296 * @param name
1297 * Name of the image. This will be used as volset_id and volume_id.
1298 * @param image
1299 * Location where the image pointer will be stored.
1300 * @return
1301 * 1 success, < 0 error
1302 *
1303 * @since 0.6.2
1304 */
1305int iso_image_new(const char *name, IsoImage **image);
1306
1307
1308/**
1309 * Control whether ACL and xattr will be imported from external filesystems
1310 * (typically the local POSIX filesystem) when new nodes get inserted. If
1311 * enabled by iso_write_opts_set_aaip() they will later be written into the
1312 * image as AAIP extension fields.
1313 *
1314 * A change of this setting does neither affect existing IsoNode objects
1315 * nor the way how ACL and xattr are handled when loading an ISO image.
1316 * The latter is controlled by iso_read_opts_set_no_aaip().
1317 *
1318 * @param image
1319 * The image of which the behavior is to be controlled
1320 * @param what
1321 * A bit field which sets the behavior:
1322 * bit0= ignore ACLs if the external file object bears some
1323 * bit1= ignore xattr if the external file object bears some
1324 * bit2= read Linux-like file attribute flags (chattr)
1325 * if the external file object bears some.
1326 * (I.e. a do-not-ignore, because ignoring was default before)
1327 * @since 1.5.8
1328 * bit3= if not bit1: import all xattr namespaces, not only "user."
1329 * @since 1.5.0
1330 * bit5= with bit2: Ignore non-settable Linux-like file attribute flags
1331 * and do not record "isofs.fa" if the other flags are all zero
1332 * @since 1.5.8
1333 * bit6= read XFS-style project from the file object id and record
1334 * "isofs.pi" if it is not 0.
1335 * (I.e. a do-not-ignore, because ignoring was default before)
1336 * @since 1.5.8
1337 * all other bits are reserved
1338 *
1339 * @since 0.6.14
1340 */
1342
1343
1344/**
1345 * Obtain the current setting of iso_image_set_ignore_aclea().
1346 *
1347 * @param image
1348 * The image to be inquired
1349 * @return
1350 * The currently set value.
1351 *
1352 * @since 1.5.0
1353 */
1355
1356
1357/**
1358 * Creates an IsoWriteOpts for writing an image. You should set the options
1359 * desired with the correspondent setters.
1360 *
1361 * Options by default are determined by the selected profile. Fifo size is set
1362 * by default to 2 MB.
1363 *
1364 * @param opts
1365 * Pointer to the location where the newly created IsoWriteOpts will be
1366 * stored. You should free it with iso_write_opts_free() when no more
1367 * needed.
1368 * @param profile
1369 * Default profile for image creation. For now the following values are
1370 * defined:
1371 * ---> 0 [BASIC]
1372 * No extensions are enabled, and ISO level is set to 1. Only suitable
1373 * for usage for very old and limited systems (like MS-DOS), or by a
1374 * start point from which to set your custom options.
1375 * ---> 1 [BACKUP]
1376 * POSIX compatibility for backup. Simple settings, ISO level is set to
1377 * 3 and RR extensions are enabled. Useful for backup purposes.
1378 * Note that ACL and xattr are not enabled by default.
1379 * If you enable them, expect them not to show up in the mounted image.
1380 * They will have to be retrieved by libisofs applications like xorriso.
1381 * ---> 2 [DISTRIBUTION]
1382 * Setting for information distribution. Both RR and Joliet are enabled
1383 * to maximize compatibility with most systems. Permissions are set to
1384 * default values, and timestamps to the time of recording.
1385 * @return
1386 * 1 success, < 0 error
1387 *
1388 * @since 0.6.2
1389 */
1390int iso_write_opts_new(IsoWriteOpts **opts, int profile);
1391
1392/**
1393 * Free an IsoWriteOpts previously allocated with iso_write_opts_new().
1394 *
1395 * @since 0.6.2
1396 */
1398
1399/**
1400 * Announce that only the image size is desired, that the struct burn_source
1401 * which is set to consume the image output stream will stay inactive,
1402 * and that the write thread will be cancelled anyway by the .cancel() method
1403 * of the struct burn_source.
1404 * This avoids to create a write thread which would begin production of the
1405 * image stream and would generate a MISHAP event when burn_source.cancel()
1406 * gets into effect.
1407 *
1408 * @param opts
1409 * The option set to be manipulated.
1410 * @param will_cancel
1411 * 0= normal image generation
1412 * 1= prepare for being canceled before image stream output is completed
1413 * @return
1414 * 1 success, < 0 error
1415 *
1416 * @since 0.6.40
1417 */
1419
1420/**
1421 * Set the ISO-9960 level to write at.
1422 *
1423 * @param opts
1424 * The option set to be manipulated.
1425 * @param level
1426 * -> 1 for higher compatibility with old systems. With this level
1427 * filenames are restricted to 8.3 characters.
1428 * -> 2 to allow up to 31 filename characters.
1429 * -> 3 to allow files greater than 4GB
1430 * @return
1431 * 1 success, < 0 error
1432 *
1433 * @since 0.6.2
1434 */
1436
1437/**
1438 * Whether to use or not Rock Ridge extensions.
1439 *
1440 * This are standard extensions to ECMA-119, intended to add POSIX filesystem
1441 * features to ECMA-119 images. Thus, usage of this flag is highly recommended
1442 * for images used on GNU/Linux systems. With the usage of RR extension, the
1443 * resulting image will have long filenames (up to 255 characters), deeper
1444 * directory structure, POSIX permissions and owner info on files and
1445 * directories, support for symbolic links or special files... All that
1446 * attributes can be modified/set with the appropriate function.
1447 *
1448 * @param opts
1449 * The option set to be manipulated.
1450 * @param enable
1451 * 1 to enable RR extension, 0 to not add them
1452 * @return
1453 * 1 success, < 0 error
1454 *
1455 * @since 0.6.2
1456 */
1458
1459/**
1460 * Whether to add the non-standard Joliet extension to the image.
1461 *
1462 * This extensions are heavily used in Microsoft Windows systems, so if you
1463 * plan to use your disc on such a system you should add this extension.
1464 * Usage of Joliet supplies longer filesystem length (up to 64 unicode
1465 * characters), and deeper directory structure.
1466 *
1467 * @param opts
1468 * The option set to be manipulated.
1469 * @param enable
1470 * 1 to enable Joliet extension, 0 to not add them
1471 * @return
1472 * 1 success, < 0 error
1473 *
1474 * @since 0.6.2
1475 */
1477
1478/**
1479 * Whether to add a HFS+ filesystem to the image which points to the same
1480 * file content as the other directory trees.
1481 * It will get marked by an Apple Partition Map in the System Area of the ISO
1482 * image. This may collide with data submitted by
1483 * iso_write_opts_set_system_area()
1484 * and with settings made by
1485 * el_torito_set_isolinux_options()
1486 * The first 8 bytes of the System Area get overwritten by
1487 * {0x45, 0x52, 0x08 0x00, 0xeb, 0x02, 0xff, 0xff}
1488 * which can be executed as x86 machine code without negative effects.
1489 * So if an MBR gets combined with this feature, then its first 8 bytes
1490 * should contain no essential commands.
1491 * The next blocks of 2 KiB in the System Area will be occupied by APM entries.
1492 * The first one covers the part of the ISO image before the HFS+ filesystem
1493 * metadata. The second one marks the range from HFS+ metadata to the end
1494 * of file content data. If more ISO image data follow, then a third partition
1495 * entry gets produced. Other features of libisofs might cause the need for
1496 * more APM entries.
1497 *
1498 * @param opts
1499 * The option set to be manipulated.
1500 * @param enable
1501 * 1 to enable HFS+ extension, 0 to not add HFS+ metadata and APM
1502 * @return
1503 * 1 success, < 0 error
1504 *
1505 * @since 1.2.4
1506 */
1508
1509/**
1510 * >>> Production of FAT32 is not implemented yet.
1511 * >>> This call exists only as preparation for implementation.
1512 *
1513 * Whether to add a FAT32 filesystem to the image which points to the same
1514 * file content as the other directory trees.
1515 *
1516 * >>> FAT32 is planned to get implemented in co-existence with HFS+
1517 * >>> Describe impact on MBR
1518 *
1519 * @param opts
1520 * The option set to be manipulated.
1521 * @param enable
1522 * 1 to enable FAT32 extension, 0 to not add FAT metadata
1523 * @return
1524 * 1 success, < 0 error
1525 *
1526 * @since 1.2.4
1527 */
1529
1530/**
1531 * Supply a serial number for the HFS+ extension of the emerging image.
1532 *
1533 * @param opts
1534 * The option set to be manipulated.
1535 * @param serial_number
1536 * 8 bytes which should be unique to the image.
1537 * If all bytes are 0, then the serial number will be generated as
1538 * random number by libisofs. This is the default setting.
1539 * @return
1540 * 1 success, < 0 error
1541 *
1542 * @since 1.2.4
1543 */
1545 uint8_t serial_number[8]);
1546
1547/**
1548 * Set the block size for Apple Partition Map and for HFS+.
1549 *
1550 * @param opts
1551 * The option set to be manipulated.
1552 * @param hfsp_block_size
1553 * The allocation block size to be used by the HFS+ filesystem.
1554 * 0, 512, or 2048
1555 * @param apm_block_size
1556 * The block size to be used for and within the Apple Partition Map.
1557 * 0, 512, or 2048.
1558 * Size 512 is not compatible with options which produce GPT.
1559 * @return
1560 * 1 success, < 0 error
1561 *
1562 * @since 1.2.4
1563 */
1565 int hfsp_block_size, int apm_block_size);
1566
1567
1568/**
1569 * Whether to create an additional tree starting at Enhanced Volume Descriptor
1570 * (aka ISO 9660:1999) as of ECMA-119 4th Edition.
1571 *
1572 * This allows longer filenames and has less restrictions than ECMA-119 2nd
1573 * Edition aka ISO-9660:1988. However, nobody is using it. So there are
1574 * not many reasons to enable this.
1575 *
1576 * @since 0.6.2
1577 */
1579
1580/**
1581 * Control generation of non-unique inode numbers for the emerging image.
1582 * Inode numbers get written as "file serial number" with PX entries as of
1583 * RRIP-1.12. They may mark families of hardlinks.
1584 * RRIP-1.10 prescribes a PX entry without file serial number.If not overridden
1585 * by iso_write_opts_set_rrip_1_10_px_ino() there will be no file serial number
1586 * written into RRIP-1.10 images.
1587 *
1588 * Inode number generation does not affect IsoNode objects which imported their
1589 * inode numbers from the old ISO image (see iso_read_opts_set_new_inos())
1590 * and which have not been altered since import. It rather applies to IsoNode
1591 * objects which were newly added to the image, or to IsoNode which brought no
1592 * inode number from the old image, or to IsoNode where certain properties
1593 * have been altered since image import.
1594 *
1595 * If two IsoNode are found with same imported inode number but differing
1596 * properties, then one of them will get assigned a new unique inode number.
1597 * I.e. the hardlink relation between both IsoNode objects ends.
1598 *
1599 * @param opts
1600 * The option set to be manipulated.
1601 * @param enable
1602 * 1 = Collect IsoNode objects which have identical data sources and
1603 * properties.
1604 * 0 = Generate unique inode numbers for all IsoNode objects which do not
1605 * have a valid inode number from an imported ISO image.
1606 * All other values are reserved.
1607 *
1608 * @since 0.6.20
1609 */
1611
1612/**
1613 * Control writing of AAIP information for ACL and xattr.
1614 * For importing ACL and xattr when inserting nodes from external filesystems
1615 * (e.g. the local POSIX filesystem) see iso_image_set_ignore_aclea().
1616 * For loading of this information from images see iso_read_opts_set_no_aaip().
1617 *
1618 * @param opts
1619 * The option set to be manipulated.
1620 * @param enable
1621 * 1 = write AAIP information from nodes into the image
1622 * 0 = do not write AAIP information into the image
1623 * All other values are reserved.
1624 *
1625 * @since 0.6.14
1626 */
1628
1629/**
1630 * Use this only if you need to reproduce a suboptimal behavior of older
1631 * versions of libisofs. They used address 0 for links and device files,
1632 * and the address of the Volume Descriptor Set Terminator for empty data
1633 * files.
1634 * New versions let symbolic links, device files, and empty data files point
1635 * to a dedicated block of zero-bytes after the end of the directory trees.
1636 * (Single-pass reader libarchive needs to see all directory info before
1637 * processing any data files.)
1638 *
1639 * @param opts
1640 * The option set to be manipulated.
1641 * @param enable
1642 * 1 = use the suboptimal block addresses in the range of 0 to 115.
1643 * 0 = use the address of a block after the directory tree. (Default)
1644 *
1645 * @since 1.0.2
1646 */
1648
1649/**
1650 * Caution: This option breaks any assumptions about names that
1651 * are supported by ECMA-119 specifications.
1652 * Try to omit any translation which would make a file name compliant to the
1653 * ECMA-119 rules. This includes and exceeds omit_version_numbers,
1654 * max_37_char_filenames, no_force_dots bit0, allow_full_ascii. Further it
1655 * prevents the conversion from local character set to ASCII.
1656 * The maximum name length is given by this call. If a filename exceeds
1657 * this length or cannot be recorded untranslated for other reasons, then
1658 * image production is aborted with ISO_NAME_NEEDS_TRANSL.
1659 * Currently the length limit is 96 characters, because an ECMA-119 directory
1660 * record may at most have 254 bytes and up to 158 other bytes must fit into
1661 * the record. Probably 96 more bytes can be made free for the name in future.
1662 * @param opts
1663 * The option set to be manipulated.
1664 * @param len
1665 * 0 = disable this feature and perform name translation according to
1666 * other settings.
1667 * >0 = Omit any translation. Abort image production if a name is longer
1668 * than the given value.
1669 * -1 = Like >0. Allow maximum possible length (currently 96)
1670 * @return >=0 success, <0 failure
1671 * In case of >=0 the return value tells the effectively set len.
1672 * E.g. 96 after using len == -1.
1673 * @since 1.0.0
1674 */
1676
1677/**
1678 * Convert directory names for ECMA-119 similar to other file names, but do
1679 * not force a dot or add a version number.
1680 * This violates ECMA-119 by allowing one "." and especially ISO level 1
1681 * by allowing DOS style 8.3 names rather than only 8 characters.
1682 * (mkisofs and its clones seem to do this violation.)
1683 * @param opts
1684 * The option set to be manipulated.
1685 * @param allow
1686 * 1= allow dots , 0= disallow dots and convert them
1687 * @return
1688 * 1 success, < 0 error
1689 * @since 1.0.0
1690 */
1692
1693/**
1694 * Omit the version number (";1") at the end of the ISO-9660 identifiers.
1695 * This breaks ECMA-119 specification, but version numbers are usually not
1696 * used, so it should work on most systems. Use with caution.
1697 * @param opts
1698 * The option set to be manipulated.
1699 * @param omit
1700 * bit0= omit version number with ECMA-119 and Joliet
1701 * bit1= omit version number with Joliet alone (@since 0.6.30)
1702 * @since 0.6.2
1703 */
1705
1706/**
1707 * Allow ISO-9660 directory hierarchy to be deeper than 8 levels.
1708 * This breaks ECMA-119 specification. Use with caution.
1709 *
1710 * @since 0.6.2
1711 */
1713
1714/**
1715 * This call describes the directory where to store Rock Ridge relocated
1716 * directories.
1717 * If not iso_write_opts_set_allow_deep_paths(,1) is in effect, then it may
1718 * become necessary to relocate directories so that no ECMA-119 file path
1719 * has more than 8 components. These directories are grafted into either
1720 * the root directory of the ISO image or into a dedicated relocation
1721 * directory.
1722 * For Rock Ridge, the relocated directories are linked forth and back to
1723 * placeholders at their original positions in path level 8. Directories
1724 * marked by Rock Ridge entry RE are to be considered artefacts of relocation
1725 * and shall not be read into a Rock Ridge tree. Instead they are to be read
1726 * via their placeholders and their links.
1727 * For plain ECMA-119, the relocation directory and the relocated directories
1728 * are just normal directories which contain normal files and directories.
1729 * @param opts
1730 * The option set to be manipulated.
1731 * @param name
1732 * The name of the relocation directory in the root directory. Do not
1733 * prepend "/". An empty name or NULL will direct relocated directories
1734 * into the root directory. This is the default.
1735 * If the given name does not exist in the root directory when
1736 * iso_image_create_burn_source() is called, and if there are directories
1737 * at path level 8, then directory /name will be created automatically.
1738 * The name given by this call will be compared with iso_node_get_name()
1739 * of the directories in the root directory, not with the final ECMA-119
1740 * names of those directories.
1741 * @param flags
1742 * Bitfield for control purposes.
1743 * bit0= Mark the relocation directory by a Rock Ridge RE entry, if it
1744 * gets created during iso_image_create_burn_source(). This will
1745 * make it invisible for most Rock Ridge readers.
1746 * bit1= not settable via API (used internally)
1747 * @return
1748 * 1 success, < 0 error
1749 * @since 1.2.2
1750*/
1751int iso_write_opts_set_rr_reloc(IsoWriteOpts *opts, char *name, int flags);
1752
1753/**
1754 * Allow path in the ISO-9660 tree to have more than 255 characters.
1755 * This breaks ECMA-119 specification. Use with caution.
1756 *
1757 * @since 0.6.2
1758 */
1760
1761/**
1762 * Allow a single file or directory identifier to have up to 37 characters.
1763 * This is larger than the 31 characters allowed by ISO level 2, and the
1764 * extra space is taken from the version number, so this also forces
1765 * omit_version_numbers.
1766 * This breaks ECMA-119 specification and could lead to buffer overflow
1767 * problems on old systems. Use with caution.
1768 *
1769 * @since 0.6.2
1770 */
1772
1773/**
1774 * ISO-9660 forces filenames to have a ".", that separates file name from
1775 * extension. libisofs adds it if original filename doesn't has one. Set
1776 * this to 1 to prevent this behavior.
1777 * This breaks ECMA-119 specification. Use with caution.
1778 *
1779 * @param opts
1780 * The option set to be manipulated.
1781 * @param no
1782 * bit0= no forced dot with ECMA-119
1783 * bit1= no forced dot with Joliet (@since 0.6.30)
1784 *
1785 * @since 0.6.2
1786 */
1788
1789/**
1790 * Allow lowercase characters in ISO-9660 filenames. By default, only
1791 * uppercase characters, numbers and a few other characters are allowed.
1792 * This breaks ECMA-119 specification. Use with caution.
1793 * If lowercase is not allowed then those letters get mapped to uppercase
1794 * letters.
1795 *
1796 * @since 0.6.2
1797 */
1799
1800/**
1801 * Allow all 8-bit characters to appear on an ISO-9660 filename. Note
1802 * that "/" and 0x0 characters are never allowed, even in RR names.
1803 * This breaks ECMA-119 specification. Use with caution.
1804 *
1805 * @since 0.6.2
1806 */
1808
1809/**
1810 * If not iso_write_opts_set_allow_full_ascii() is set to 1:
1811 * Allow all 7-bit characters that would be allowed by allow_full_ascii, but
1812 * map lowercase to uppercase if iso_write_opts_set_allow_lowercase()
1813 * is not set to 1.
1814 * @param opts
1815 * The option set to be manipulated.
1816 * @param allow
1817 * If not zero, then allow what is described above.
1818 *
1819 * @since 1.2.2
1820 */
1822
1823/**
1824 * Allow all characters to be part of Volume and Volset identifiers on
1825 * the Primary Volume Descriptor which can be set by:
1826 * iso_image_set_volset_id()
1827 * iso_image_set_volume_id()
1828 * iso_image_set_volume_id_v2()
1829 * This breaks ISO-9660 constraints, but should work on modern systems.
1830 * Allowed by the specs are characters out of [0-9A-Z_] ("d-characters").
1831 *
1832 * @since 0.6.2
1833 */
1835
1836/**
1837 * Like iso_write_opts_set_relaxed_vol_atts() but for all other text
1838 * attributes in the Primary Volume Descriptor which can be set by:
1839 * iso_image_set_publisher_id()
1840 * iso_image_set_data_preparer_id()
1841 * iso_image_set_system_id()
1842 * iso_image_set_application_id()
1843 * iso_image_set_copyright_file_id()
1844 * iso_image_set_abstract_file_id()
1845 * iso_image_set_biblio_file_id()
1846 * This breaks ISO-9660 constraints.
1847 * Allowed for copyright_file_id, abstract_file_id, and biblio_file_id
1848 * are [0-9A-Z_] plus at most one '.' and at most one ';' which must not
1849 * come before the dot. Allowed for the others are additionally ' ', '!', '"',
1850 * and the ASCII characters between '%' and '?' ("a-characters"), without
1851 * restriction on number and position of '.' or ';'.
1852 *
1853 * @param opts
1854 * The option set to be manipulated.
1855 * @param allow
1856 * 0= Strictly obey the the specs in regard to allowed characters.
1857 * Non-compliant characters get mapped to allowed ones.
1858 * 1= Allow all characters which can be expressed in the output
1859 * character set.
1860 * @return
1861 * ISO_SUCCESS or ISO_NULL_POINTER if opts is NULL.
1862 *
1863 * @since 1.5.8
1864 */
1866
1867
1868/**
1869 * Allow paths in the Joliet tree to have more than 240 characters.
1870 * This breaks Joliet specification. Use with caution.
1871 *
1872 * @since 0.6.2
1873 */
1875
1876/**
1877 * Allow leaf names in the Joliet tree to have up to 103 characters.
1878 * Normal limit is 64.
1879 * This breaks Joliet specification. Use with caution.
1880 *
1881 * @since 1.0.6
1882 */
1884
1885/**
1886 * Use character set UTF-16BE with Joliet, which is a superset of the
1887 * actually prescribed character set UCS-2.
1888 * This breaks Joliet specification with exotic characters which would
1889 * elsewise be mapped to underscore '_'. Use with caution.
1890 *
1891 * @since 1.3.6
1892 */
1894
1895/**
1896 * Write Rock Ridge info as of specification RRIP-1.10 rather than RRIP-1.12:
1897 * signature "RRIP_1991A" rather than "IEEE_1282", field PX without file
1898 * serial number.
1899 *
1900 * @since 0.6.12
1901 */
1903
1904/**
1905 * Write field PX with file serial number (i.e. inode number) even if
1906 * iso_write_opts_set_rrip_version_1_10(,1) is in effect.
1907 * This clearly violates the RRIP-1.10 specs. But it is done by mkisofs since
1908 * a while and no widespread protest is visible in the web.
1909 * If this option is not enabled, then iso_write_opts_set_hardlinks() will
1910 * only have an effect with iso_write_opts_set_rrip_version_1_10(,0).
1911 *
1912 * @since 0.6.20
1913 */
1915
1916/**
1917 * Force writing of RRIP field TF with LONG FORM timestamps of 17 bytes
1918 * instead of 7-byte timestamps. Without this call or with enable==0, the
1919 * long form is used only with IsoNode objects which bear a timestamp after
1920 * 01 Jan 2150 UTC.
1921 * (Future programmers may widen ISO_RR_SHORT_FORM_TIME_LIMIT in rockridge.h
1922 * to the end of year 2155. The six years inbetween shall serve as chance
1923 * to fix problems.)
1924 *
1925 * @since 1.5.8
1926 */
1928
1929/**
1930 * Enable curbing of of time values before year 1900 AD in RRIP field TF.
1931 * This call with enable==1 will default years before 1900 AD to Jan 1 1900 UTC
1932 * because Linux up to at least version 6.16 misrepresents times
1933 * before year 1900 as Jan 1 1970 00:00:00 UTC.
1934 * If the curb is disabled, then dates down to the begin of year 0 (= 1 BC)
1935 * can be written into the Rock Ridge data.
1936 *
1937 * @since 1.5.8
1938 */
1940
1941/**
1942 * Write AAIP as extension according to SUSP 1.10 rather than SUSP 1.12.
1943 * I.e. without announcing it by an ER field and thus without the need
1944 * to precede the RRIP fields and the AAIP field by ES fields.
1945 * This saves 5 to 10 bytes per file and might avoid problems with readers
1946 * which dislike ER fields other than the ones for RRIP.
1947 * On the other hand, SUSP 1.12 frowns on such unannounced extensions
1948 * and prescribes ER and ES. It does this since the year 1994.
1949 *
1950 * In effect only if above iso_write_opts_set_aaip() enables writing of AAIP.
1951 *
1952 * @since 0.6.14
1953 */
1955
1956/**
1957 * Store as ECMA-119 Directory Record timestamp the mtime of the source node
1958 * rather than the image creation time.
1959 * If storing of mtime is enabled, then the settings of
1960 * iso_write_opts_set_replace_timestamps() apply. (replace==1 will revoke,
1961 * replace==2 will override mtime by iso_write_opts_set_default_timestamp().
1962 *
1963 * Since version 1.2.0 this may apply also to Joliet and an Enhanced Volume
1964 * Descriptor tree (aka ISO 9660:1999) as of ECMA-119 4th Edition.
1965 * To reduce the probability of unwanted behavior changes between pre-1.2.0 and
1966 * post-1.2.0, the bits for Joliet and ISO 9660:1999 also enable ECMA-119.
1967 * The hopefully unlikely bit14 may then be used to disable mtime for ECMA-119.
1968 *
1969 * To enable mtime for all three directory trees, submit 7.
1970 * To disable this feature completely, submit 0.
1971 *
1972 * @param opts
1973 * The option set to be manipulated.
1974 * @param allow
1975 * If this parameter is negative, then mtime is enabled only for ECMA-119.
1976 * With positive numbers, the parameter is interpreted as bit field :
1977 * bit0= enable mtime for ECMA-119
1978 * bit1= enable mtime for Joliet and ECMA-119
1979 * bit2= enable mtime for ISO 9660:1999 and ECMA-119
1980 * bit14= disable mtime for ECMA-119 although some of the other bits
1981 * would enable it
1982 * @since 1.2.0
1983 * Before version 1.2.0 this applied only to ECMA-119 :
1984 * 0 stored image creation time in ECMA-119 tree.
1985 * Any other value caused storing of mtime.
1986 * Joliet and ISO 9660:1999 always stored the image creation time.
1987 * @since 0.6.12
1988 */
1990
1991/**
1992 * Whether to sort files based on their weight.
1993 *
1994 * @see iso_node_set_sort_weight
1995 * @since 0.6.2
1996 */
1998
1999/**
2000 * Whether to compute and record MD5 checksums for the whole session and/or
2001 * for each single IsoFile object. The checksums represent the data as they
2002 * were written into the image output stream, not necessarily as they were
2003 * on hard disk at any point of time.
2004 * See also calls iso_image_get_session_md5() and iso_file_get_md5().
2005 * @param opts
2006 * The option set to be manipulated.
2007 * @param session
2008 * If bit0 set: Compute session checksum
2009 * @param files
2010 * If bit0 set: Compute a checksum for each single IsoFile object which
2011 * gets its data content written into the session. Copy
2012 * checksums from files which keep their data in older
2013 * sessions.
2014 * If bit1 set: Check content stability (only with bit0). I.e. before
2015 * writing the file content into to image stream, read it
2016 * once and compute a MD5. Do a second reading for writing
2017 * into the image stream. Afterwards compare both MD5 and
2018 * issue a MISHAP event ISO_MD5_STREAM_CHANGE if they do not
2019 * match.
2020 * Such a mismatch indicates content changes between the
2021 * time point when the first MD5 reading started and the
2022 * time point when the last block was read for writing.
2023 * So there is high risk that the image stream was fed from
2024 * changing and possibly inconsistent file content.
2025 *
2026 * @since 0.6.22
2027 */
2028int iso_write_opts_set_record_md5(IsoWriteOpts *opts, int session, int files);
2029
2030/**
2031 * Set the parameters "name" and "timestamp" for a scdbackup checksum tag.
2032 * It will be appended to the libisofs session tag if the image starts at
2033 * LBA 0 (see iso_write_opts_set_ms_block()). The scdbackup tag can be used
2034 * to verify the image by command scdbackup_verify device -auto_end.
2035 * See scdbackup/README appendix VERIFY for its inner details.
2036 *
2037 * @param opts
2038 * The option set to be manipulated.
2039 * @param name
2040 * A word of up to 80 characters. Typically volno_totalno telling
2041 * that this is volume volno of a total of totalno volumes.
2042 * @param timestamp
2043 * A string of 13 characters YYMMDD.hhmmss (e.g. A90831.190324).
2044 * A9 = 2009, B0 = 2010, B1 = 2011, ... C0 = 2020, ...
2045 * @param tag_written
2046 * Either NULL or the address of an array with at least 512 characters.
2047 * In the latter case the possibly produced scdbackup tag will be
2048 * copied to this array when the image gets written. This call sets
2049 * scdbackup_tag_written[0] = 0 to mark its preliminary invalidity.
2050 * @return
2051 * 1 indicates success, <0 is error
2052 *
2053 * @since 0.6.24
2054 */
2056 char *name, char *timestamp,
2057 char *tag_written);
2058
2059/**
2060 * Whether to set default values for files and directory permissions, gid and
2061 * uid. All these take one of three values: 0, 1 or 2.
2062 *
2063 * If 0, the corresponding attribute will be kept as set in the IsoNode.
2064 * Unless you have changed it, it corresponds to the value on disc, so it
2065 * is suitable for backup purposes. If set to 1, the corresponding attrib.
2066 * will be changed by a default suitable value. Finally, if you set it to
2067 * 2, the attrib. will be changed with the value specified by the functioins
2068 * below. Note that for mode attributes, only the permissions are set, the
2069 * file type remains unchanged.
2070 *
2071 * @see iso_write_opts_set_default_dir_mode
2072 * @see iso_write_opts_set_default_file_mode
2073 * @see iso_write_opts_set_default_uid
2074 * @see iso_write_opts_set_default_gid
2075 * @since 0.6.2
2076 */
2078 int file_mode, int uid, int gid);
2079
2080/**
2081 * Set the mode to use on dirs when you set the replace_mode of dirs to 2.
2082 *
2083 * @see iso_write_opts_set_replace_mode
2084 * @since 0.6.2
2085 */
2087
2088/**
2089 * Set the mode to use on files when you set the replace_mode of files to 2.
2090 *
2091 * @see iso_write_opts_set_replace_mode
2092 * @since 0.6.2
2093 */
2095
2096/**
2097 * Set the uid to use when you set the replace_uid to 2.
2098 *
2099 * @see iso_write_opts_set_replace_mode
2100 * @since 0.6.2
2101 */
2103
2104/**
2105 * Set the gid to use when you set the replace_gid to 2.
2106 *
2107 * @see iso_write_opts_set_replace_mode
2108 * @since 0.6.2
2109 */
2111
2112/**
2113 * 0 to use IsoNode timestamps, 1 to use recording time, 2 to use
2114 * values from timestamp field. This applies to the timestamps of Rock Ridge
2115 * and if the use of mtime is enabled by iso_write_opts_set_dir_rec_mtime().
2116 * In the latter case, value 1 will revoke the recording of mtime, value
2117 * 2 will override mtime by iso_write_opts_set_default_timestamp().
2118 *
2119 * @see iso_write_opts_set_default_timestamp
2120 * @since 0.6.2
2121 */
2123
2124/**
2125 * Set the timestamp to use when you set the replace_timestamps to 2.
2126 *
2127 * @see iso_write_opts_set_replace_timestamps
2128 * @since 0.6.2
2129 */
2131
2132/**
2133 * Whether to always record timestamps in GMT.
2134 *
2135 * By default, libisofs stores local time information on image. You can set
2136 * this to always store timestamps converted to GMT. This prevents any
2137 * discrimination of the timezone of the image preparer by the image reader.
2138 *
2139 * It is useful if you want to hide your timezone, or you live in a timezone
2140 * that can't be represented in ECMA-119. These are timezones with an offset
2141 * from GMT greater than +13 hours, lower than -12 hours, or not a multiple
2142 * of 15 minutes.
2143 * Negative timezones (west of GMT) can trigger bugs in some operating systems
2144 * which typically appear in mounted ISO images as if the timezone shift from
2145 * GMT was applied twice (e.g. in New York 22:36 becomes 17:36).
2146 *
2147 * @since 0.6.2
2148 */
2150
2151/**
2152 * Set the charset to use for the RR names of the files that will be created
2153 * on the image.
2154 * NULL to use default charset, that is the locale charset.
2155 * You can obtain the list of charsets supported on your system executing
2156 * "iconv -l" in a shell.
2157 *
2158 * @since 0.6.2
2159 */
2160int iso_write_opts_set_output_charset(IsoWriteOpts *opts, const char *charset);
2161
2162/**
2163 * Set the type of image creation in case there was already an existing
2164 * image imported. Libisofs supports two types of creation:
2165 * stand-alone and appended.
2166 *
2167 * A stand-alone image is an image that does not need the old image any more
2168 * for being mounted by the operating system or imported by libisofs. It may
2169 * be written beginning with byte 0 of optical media or disk file objects.
2170 * There will be no distinction between files from the old image and those
2171 * which have been added by the new image generation.
2172 *
2173 * On the other side, an appended image is not self contained. It may refer
2174 * to files that stay stored in the imported existing image.
2175 * This usage model is inspired by CD multi-session. It demands that the
2176 * appended image is finally written to the same media or disk file
2177 * as the imported image at an address behind the end of that imported image.
2178 * The exact address may depend on media peculiarities and thus has to be
2179 * announced by the application via iso_write_opts_set_ms_block().
2180 * The real address where the data will be written is under control of the
2181 * consumer of the struct burn_source which takes the output of libisofs
2182 * image generation. It may be the one announced to libisofs or an intermediate
2183 * one. Nevertheless, the image will be readable only at the announced address.
2184 *
2185 * If you have not imported a previous image by iso_image_import(), then the
2186 * image will always be a stand-alone image, as there is no previous data to
2187 * refer to.
2188 *
2189 * @param opts
2190 * The option set to be manipulated.
2191 * @param append
2192 * 1 to create an appended image, 0 for an stand-alone one.
2193 *
2194 * @since 0.6.2
2195 */
2197
2198/**
2199 * Set the start block of the image. It is supposed to be the lba where the
2200 * first block of the image will be written on disc. All references inside the
2201 * ISO image will take this into account, thus providing a mountable image.
2202 *
2203 * For appendable images, that are written to a new session, you should
2204 * pass here the lba of the next writable address on disc.
2205 *
2206 * In stand alone images this is usually 0. However, you may want to
2207 * provide a different ms_block if you don't plan to burn the image in the
2208 * first session on disc, such as in some CD-Extra disc whether the data
2209 * image is written in a new session after some audio tracks.
2210 *
2211 * @since 0.6.2
2212 */
2213int iso_write_opts_set_ms_block(IsoWriteOpts *opts, uint32_t ms_block);
2214
2215/**
2216 * Sets the buffer where to store the descriptors which shall be written
2217 * at the beginning of an overwritable media to point to the newly written
2218 * image.
2219 * This is needed if the write start address of the image is not 0.
2220 * In this case the first 64 KiB of the media have to be overwritten
2221 * by the buffer content after the session was written and the buffer
2222 * was updated by libisofs. Otherwise the new session would not be
2223 * found by operating system function mount() or by libisoburn.
2224 * (One could still mount that session if its start address is known.)
2225 *
2226 * If you do not need this information, for example because you are creating a
2227 * new image for LBA 0 or because you will create an image for a true
2228 * multisession media, just do not use this call or set buffer to NULL.
2229 *
2230 * Use cases:
2231 *
2232 * - Together with iso_write_opts_set_appendable(opts, 1) the buffer serves
2233 * for the growing of an image as done in growisofs by Andy Polyakov.
2234 * This allows appending of a new session to non-multisession media, such
2235 * as DVD+RW. The new session will refer to the data of previous sessions
2236 * on the same media.
2237 * libisoburn emulates multisession appendability on overwritable media
2238 * and disk files by performing this use case.
2239 *
2240 * - Together with iso_write_opts_set_appendable(opts, 0) the buffer allows
2241 * to write the first session on overwritable media to start addresses
2242 * other than 0.
2243 * This address must not be smaller than 32 blocks plus the possible
2244 * partition offset as defined by iso_write_opts_set_part_offset().
2245 * libisoburn in most cases writes the first session on overwritable media
2246 * and disk files to LBA (32 + partition_offset) in order to preserve its
2247 * descriptors from the subsequent overwriting by the descriptor buffer of
2248 * later sessions.
2249 *
2250 * @param opts
2251 * The option set to be manipulated.
2252 * @param overwrite
2253 * When not NULL, it should point to at least 64KiB of memory, where
2254 * libisofs will install the contents that shall be written at the
2255 * beginning of overwritable media.
2256 * You should initialize the buffer either with 0s, or with the contents
2257 * of the first 32 blocks of the image you are growing. In most cases,
2258 * 0 is good enough.
2259 * IMPORTANT: If you use iso_write_opts_set_part_offset() then the
2260 * overwrite buffer must be larger by the offset defined there.
2261 *
2262 * @since 0.6.2
2263 */
2264int iso_write_opts_set_overwrite_buf(IsoWriteOpts *opts, uint8_t *overwrite);
2265
2266/**
2267 * Set the size, in number of blocks, of the ring buffer used between the
2268 * writer thread and the burn_source. You have to provide at least a 32
2269 * blocks buffer. Default value is set to 2MB, if that is ok for you, you
2270 * don't need to call this function.
2271 *
2272 * @since 0.6.2
2273 */
2274int iso_write_opts_set_fifo_size(IsoWriteOpts *opts, size_t fifo_size);
2275
2276/*
2277 * Attach 32 kB of binary data which shall get written to the first 32 kB
2278 * of the ISO image, the ECMA-119 System Area. This space is intended for
2279 * system dependent boot software, e.g. a Master Boot Record which allows to
2280 * boot from USB sticks or hard disks. ECMA-119 makes no own assumptions or
2281 * prescriptions about the byte content.
2282 *
2283 * If system area data are given or options bit0 is set, then bit1 of
2284 * el_torito_set_isolinux_options() is automatically disabled.
2285 *
2286 * @param opts
2287 * The option set to be manipulated.
2288 * @param data
2289 * Either NULL or 32768 bytes of data. Do not submit less bytes !
2290 * NULL means that the possibly imported System Area content of the
2291 * possibly imported ISO image is to be re-used unchanged.
2292 * Submit 32 KiB of 0-bytes to surely get an empty System Area written.
2293 * @param options
2294 * Can cause manipulations of submitted data before they get written:
2295 * bit0= Only with System area type 0 = MBR
2296 * Apply a --protective-msdos-label as of grub-mkisofs.
2297 * This means to patch bytes 446 to 512 of the system area so
2298 * that one partition is defined which begins at the second
2299 * 512-byte block of the image and ends where the image ends.
2300 * This works with and without system_area_data.
2301 * Modern GRUB2 system areas get also treated by bit14. See below.
2302 * bit1= Only with System area type 0 = MBR
2303 * Apply isohybrid MBR patching to the system area.
2304 * This works only with system area data from SYSLINUX plus an
2305 * ISOLINUX boot image as first submitted boot image
2306 * (see iso_image_set_boot_image()) and only if not bit0 is set.
2307 * bit2-7= System area type
2308 * 0= with bit0 or bit1: MBR
2309 * else: type depends on bits bit10-13: System area sub type
2310 * 1= MIPS Big Endian Volume Header
2311 * @since 0.6.38
2312 * Submit up to 15 MIPS Big Endian boot files by
2313 * iso_image_add_mips_boot_file().
2314 * This will overwrite the first 512 bytes of the submitted
2315 * data.
2316 * 2= DEC Boot Block for MIPS Little Endian
2317 * @since 0.6.38
2318 * The first boot file submitted by
2319 * iso_image_add_mips_boot_file() will be activated.
2320 * This will overwrite the first 512 bytes of the submitted
2321 * data.
2322 * 3= SUN Disk Label for SUN SPARC
2323 * @since 0.6.40
2324 * Submit up to 7 SPARC boot images by
2325 * iso_write_opts_set_partition_img() for partition numbers 2
2326 * to 8.
2327 * This will overwrite the first 512 bytes of the submitted
2328 * data.
2329 * 4= HP-PA PALO boot sector version 4 for HP PA-RISC
2330 * @since 1.3.8
2331 * Suitable for older PALO of e.g. Debian 4 and 5.
2332 * Submit all five parameters of iso_image_set_hppa_palo():
2333 * cmdline, bootloader, kernel_32, kernel_64, ramdisk
2334 * 5= HP-PA PALO boot sector version 5 for HP PA-RISC
2335 * @since 1.3.8
2336 * Suitable for newer PALO, where PALOHDRVERSION in
2337 * lib/common.h is defined as 5.
2338 * Submit all five parameters of iso_image_set_hppa_palo():
2339 * cmdline, bootloader, kernel_32, kernel_64, ramdisk
2340 * 6= DEC Alpha SRM boot sector
2341 * @since 1.4.0
2342 * Submit bootloader path in ISO by iso_image_set_alpha_boot().
2343 * bit8-9= Only with System area type 0 = MBR
2344 * @since 1.0.4
2345 * Cylinder alignment mode pads the image to make it end at a
2346 * cylinder boundary.
2347 * 0 = auto (align if bit1)
2348 * 1 = always align to cylinder boundary
2349 * 2 = never align to cylinder boundary
2350 * 3 = always align, additionally pad up and align partitions
2351 * which were appended by iso_write_opts_set_partition_img()
2352 * @since 1.2.6
2353 * bit10-13= System area sub type
2354 * @since 1.2.4
2355 * With type 0:
2356 * if options bit0 ... MBR with partition start at block 1
2357 * if options bit1 ... ISOLINUX isohybrid MBR
2358 * else:
2359 * 0 = no particular sub type, use unaltered
2360 * 1 = CHRP: A single MBR partition of type 0x96 covers the
2361 * ISO image. Not compatible with any other feature
2362 * which needs to have own MBR partition entries.
2363 * 2 = generic MBR @since 1.3.8
2364 * bit14= Only with System area type 0 = MBR
2365 * GRUB2 boot provisions:
2366 * @since 1.3.0
2367 * Patch system area at byte 0x1b0 to 0x1b7 with
2368 * (512-block address + 4) of the first boot image file.
2369 * Little-endian 8-byte.
2370 * Is normally combined with options bit0.
2371 * Will not be in effect if options bit1 is set.
2372 * bit15= Only with System area type MBR but not with CHRP
2373 * @since 1.4.4
2374 * Enforce MBR "bootable/active" flag. In worst case by dummy
2375 * partition of type 0x00 which occupies block 0.
2376 * bit16= "Legacy BIOS bootable" in GPT
2377 * @since 1.5.6
2378 * If this bit is set and a GPT partition for the ISO 9660
2379 * filesystem gets written, then set the GPT partition flags bit 2
2380 * "Legacy BIOS bootable".
2381 * bit17= ISO not read-only
2382 * @since 1.5.6
2383 * Do not set GPT partition flag bit 60 "read-only" for the
2384 * ISO 9660 filesystem partition, if such a partition gets
2385 * written.
2386 * @param flag
2387 * bit0 = invalidate any attached system area data. Same as data == NULL
2388 * (This re-activates possibly loaded image System Area data.
2389 * To erase those, submit 32 kB of zeros without flag bit0.)
2390 * bit1 = keep data unaltered
2391 * bit2 = keep options unaltered
2392 * @return
2393 * ISO_SUCCESS or error
2394 * @since 0.6.30
2395 */
2397 int options, int flag);
2398
2399/**
2400 * Set a name for the system area. This setting is ignored unless system area
2401 * type 3 "SUN Disk Label" is in effect by iso_write_opts_set_system_area().
2402 * In this case it will replace the default text at the start of the image:
2403 * "CD-ROM Disc with Sun sparc boot created by libisofs"
2404 *
2405 * @param opts
2406 * The option set to be manipulated.
2407 * @param label
2408 * A text of up to 128 characters.
2409 * @return
2410 * ISO_SUCCESS or error
2411 * @since 0.6.40
2412*/
2414
2415/**
2416 * Explicitly set the four timestamps of the emerging Primary Volume
2417 * Descriptor, in the volume descriptor of Joliet, and in the Enhanced Volume
2418 * Descriptor (aka ISO 9660:1999) as of ECMA-119 4th Edition, if those are
2419 * to be generated.
2420 * Default with all parameters is 0.
2421 *
2422 * ECMA-119 defines them as:
2423 * @param opts
2424 * The option set to be manipulated.
2425 * @param vol_creation_time
2426 * When "the information in the volume was created."
2427 * A value of 0 means that the timepoint of write start is to be used.
2428 * @param vol_modification_time
2429 * When "the information in the volume was last modified."
2430 * A value of 0 means that the timepoint of write start is to be used.
2431 * @param vol_expiration_time
2432 * When "the information in the volume may be regarded as obsolete."
2433 * A value of 0 means that the information never shall expire.
2434 * @param vol_effective_time
2435 * When "the information in the volume may be used."
2436 * A value of 0 means that not such retention is intended.
2437 * @param vol_uuid
2438 * If this text is not empty, then it overrides vol_creation_time and
2439 * vol_modification_time by copying the first 16 decimal digits from
2440 * uuid, possibly padding up with decimal '1', and writing a NUL-byte
2441 * as timezone.
2442 * Other than with vol_*_time the resulting string in the ISO image
2443 * is fully predictable and free of timezone pitfalls.
2444 * It should express a reasonable time in form YYYYMMDDhhmmsscc.
2445 * The timezone will always be recorded as GMT.
2446 * E.g.: "2010040711405800" = 7 Apr 2010 11:40:58 (+0 centiseconds)
2447 * @return
2448 * ISO_SUCCESS or error
2449 *
2450 * @since 0.6.30
2451 */
2453 time_t vol_creation_time, time_t vol_modification_time,
2454 time_t vol_expiration_time, time_t vol_effective_time,
2455 char *vol_uuid);
2456
2457
2458/*
2459 * Control production of a second set of volume descriptors (superblock)
2460 * and directory trees, together with a partition table in the MBR where the
2461 * first partition has non-zero start address and the others are zeroed.
2462 * The first partition stretches to the end of the whole ISO image.
2463 * The additional volume descriptor set and trees will allow to mount the
2464 * ISO image at the start of the first partition, while it is still possible
2465 * to mount it via the normal first volume descriptor set and tree at the
2466 * start of the image or storage device.
2467 * This makes few sense on optical media. But on USB sticks it creates a
2468 * conventional partition table which makes it mountable on e.g. Linux via
2469 * /dev/sdb and /dev/sdb1 alike.
2470 * IMPORTANT: When submitting memory by iso_write_opts_set_overwrite_buf()
2471 * then its size must be at least 64 KiB + partition offset.
2472 *
2473 * @param opts
2474 * The option set to be manipulated.
2475 * @param block_offset_2k
2476 * The offset of the partition start relative to device start.
2477 * This is counted in 2 kB blocks. The partition table will show the
2478 * according number of 512 byte sectors.
2479 * Default is 0 which causes no special partition table preparations.
2480 * If it is not 0 then it must not be smaller than 16.
2481 * @param secs_512_per_head
2482 * Number of 512 byte sectors per head. 1 to 63. 0=automatic.
2483 * @param heads_per_cyl
2484 * Number of heads per cylinder. 1 to 255. 0=automatic.
2485 * @return
2486 * ISO_SUCCESS or error
2487 *
2488 * @since 0.6.36
2489 */
2491 uint32_t block_offset_2k,
2492 int secs_512_per_head, int heads_per_cyl);
2493
2494
2495/** The minimum version of libjte to be used with this version of libisofs
2496 at compile time. The use of libjte is optional and depends on configure
2497 tests. It can be prevented by ./configure option --disable-libjte .
2498 @since 0.6.38
2499*/
2500#define iso_libjte_req_major 2
2501#define iso_libjte_req_minor 0
2502#define iso_libjte_req_micro 0
2503
2504/**
2505 * Associate a libjte environment object to the upcoming write run.
2506 * libjte implements Jigdo Template Extraction as of Steve McIntyre and
2507 * Richard Atterer.
2508 * The call will fail if no libjte support was enabled at compile time.
2509 * @param opts
2510 * The option set to be manipulated.
2511 * @param libjte_handle
2512 * Pointer to a struct libjte_env e.g. created by libjte_new().
2513 * It must stay existent from the start of image generation by
2514 * iso_image_create_burn_source() until the write thread has ended.
2515 * This can be inquired by iso_image_generator_is_running().
2516 * In order to keep the libisofs API identical with and without
2517 * libjte support the parameter type is (void *).
2518 * @return
2519 * ISO_SUCCESS or error
2520 *
2521 * @since 0.6.38
2522*/
2523int iso_write_opts_attach_jte(IsoWriteOpts *opts, void *libjte_handle);
2524
2525/**
2526 * Remove association to a libjte environment handle.
2527 * The call will fail if no libjte support was enabled at compile time.
2528 * @param opts
2529 * The option set to be manipulated.
2530 * @param libjte_handle
2531 * If not submitted as NULL, this will return the previously set
2532 * libjte handle.
2533 * @return
2534 * ISO_SUCCESS or error
2535 *
2536 * @since 0.6.38
2537*/
2538int iso_write_opts_detach_jte(IsoWriteOpts *opts, void **libjte_handle);
2539
2540
2541/**
2542 * Cause a number of blocks with zero bytes to be written after the payload
2543 * data, but before the possible checksum data. Unlike libburn tail padding,
2544 * these blocks are counted as part of the image and covered by image
2545 * checksums.
2546 * A reason for such padding can be the wish to prevent the Linux read-ahead
2547 * bug by sacrificial data which still belong to image and Jigdo template.
2548 * Normally such padding would be the job of the burn program which should know
2549 * that it is needed with CD write type TAO if Linux read(2) shall be able
2550 * to read all payload blocks.
2551 * 150 blocks = 300 kB is the traditional sacrifice to the Linux kernel.
2552 * @param opts
2553 * The option set to be manipulated.
2554 * @param num_blocks
2555 * Number of extra 2 kB blocks to be written.
2556 * @return
2557 * ISO_SUCCESS or error
2558 *
2559 * @since 0.6.38
2560 */
2561int iso_write_opts_set_tail_blocks(IsoWriteOpts *opts, uint32_t num_blocks);
2562
2563
2564/**
2565 * The libisofs interval reader is used internally and offered by libisofs API:
2566 * @since 1.4.0
2567 * The functions iso_write_opts_set_prep_img(), iso_write_opts_set_efi_bootp(),
2568 * and iso_write_opts_set_partition_img() accept with their flag bit0 an
2569 * interval reader description string instead of a disk path.
2570 * The API calls are iso_interval_reader_new(), iso_interval_reader_read(),
2571 * and iso_interval_reader_destroy().
2572 * The data may be cut out and optionally partly zeroized.
2573 *
2574 * An interval reader description string has the form:
2575 * $flags:$interval:$zeroizers:$source
2576 * The component $flags modifies the further interpretation:
2577 * "local_fs" ....... demands to read from a file depicted by the path in
2578 * $source.
2579 * "imported_iso" ... demands to read from the IsoDataSource object that was
2580 * used with iso_image_import() when
2581 * iso_read_opts_keep_import_src() was enabled.
2582 * The text in $source is ignored.
2583 * The application has to ensure that reading from the
2584 * import source does not disturb production of the new
2585 * ISO session. Especially this would be the case if the
2586 * import source is the same libburn drive with a
2587 * sequential optical medium to which the new session shall
2588 * get burned.
2589 * The component $interval consists of two byte address numbers separated
2590 * by a "-" character. E.g. "0-429" means to read bytes 0 to 429.
2591 * The component $zeroizers consists of zero or more comma separated strings.
2592 * They define which part of the read data to zeroize. Byte number 0 means
2593 * the byte read from the $interval start address.
2594 * Each string may be either
2595 * "zero_mbrpt" ..... demands to zeroize bytes 446 to 509 of the read data if
2596 * bytes 510 and 511 bear the MBR signature 0x55 0xaa.
2597 * "zero_gpt" ....... demands to check for a GPT header in bytes 512 to 1023,
2598 * to zeroize it and its partition table blocks.
2599 * "zero_apm" ....... demands to check for an APM block 0 and to zeroize
2600 * its partition table blocks. But not the block 0 itself,
2601 * because it could be actually MBR x86 machine code.
2602 * $zero_start"-"$zero_end ... demands to zeroize the read-in bytes beginning
2603 * with number $zero_start and ending after $zero_end.
2604 * The component $source is the file path with "local_fs", and ignored with
2605 * "imported_iso".
2606 * Byte numbers may be scaled by a suffix out of {k,m,g,t,s,d} meaning
2607 * multiplication by {1024, 1024k, 1024m, 1024g, 2048, 512}. A scaled value
2608 * as end number depicts the last byte of the scaled range.
2609 * E.g. "0d-0d" is "0-511".
2610 * Examples:
2611 * "local_fs:0-32767:zero_mbrpt,zero_gpt,440-443:/tmp/template.iso"
2612 * "imported_iso:45056d-47103d::"
2613 */
2614struct iso_interval_reader;
2615
2616/**
2617 * Create an interval reader object.
2618 *
2619 * @param img
2620 * The IsoImage object which can provide the "imported_iso" data source.
2621 * @param path
2622 * The interval reader description string. See above.
2623 * @param ivr
2624 * Returns in case of success a pointer to the created object.
2625 * Dispose it by iso_interval_reader_destroy() when no longer needed.
2626 * @param byte_count
2627 * Returns in case of success the number of bytes in the interval.
2628 * @param flag
2629 * bit0= tolerate (src == NULL) with "imported_iso".
2630 * (Will immediately cause eof of interval input.)
2631 * @return
2632 * ISO_SUCCESS or error (which is < 0)
2633 *
2634 * @since 1.4.0
2635 */
2637 struct iso_interval_reader **ivr,
2638 off_t *byte_count, int flag);
2639
2640/**
2641 * Dispose an interval reader object.
2642 *
2643 * @param ivr
2644 * The reader object to be disposed. *ivr will be set to NULL.
2645 * @param flag
2646 * Unused yet. Submit 0.
2647 * @return
2648 * ISO_SUCCESS or error (which is < 0)
2649 *
2650 * @since 1.4.0
2651 */
2652int iso_interval_reader_destroy(struct iso_interval_reader **ivr, int flag);
2653
2654/**
2655 * Read the next block of 2048 bytes from an interval reader object.
2656 * If end-of-input happens, the interval will get filled up with 0 bytes.
2657 *
2658 * @param ivr
2659 * The object to read from.
2660 * @param buf
2661 * Pointer to memory for filling in at least 2048 bytes.
2662 * @param buf_fill
2663 * Will in case of success return the number of valid bytes.
2664 * If this is smaller than 2048, then end-of-interval has occurred.
2665 * @param flag
2666 * Unused yet. Submit 0.
2667 * @return
2668 * ISO_SUCCESS if data were read, 0 if not, < 0 if error
2669 *
2670 * @since 1.4.0
2671 */
2672int iso_interval_reader_read(struct iso_interval_reader *ivr, uint8_t *buf,
2673 int *buf_fill, int flag);
2674
2675
2676/**
2677 * Copy a data file from the local filesystem into the emerging ISO image.
2678 * Mark it by an MBR partition entry as PreP partition and also cause
2679 * protective MBR partition entries before and after this partition.
2680 * Vladimir Serbinenko stated aboy PreP = PowerPC Reference Platform :
2681 * "PreP [...] refers mainly to IBM hardware. PreP boot is a partition
2682 * containing only raw ELF and having type 0x41."
2683 *
2684 * This feature is only combinable with system area type 0
2685 * and currently not combinable with ISOLINUX isohybrid production.
2686 * It overrides --protective-msdos-label. See iso_write_opts_set_system_area().
2687 * Only partition 4 stays available for iso_write_opts_set_partition_img().
2688 * It is compatible with HFS+/FAT production by storing the PreP partition
2689 * before the start of the HFS+/FAT partition.
2690 *
2691 * @param opts
2692 * The option set to be manipulated.
2693 * @param image_path
2694 * File address in the local file system or instructions for interval
2695 * reader. See flag bit0.
2696 * NULL revokes production of the PreP partition.
2697 * @param flag
2698 * bit0= The path contains instructions for the interval reader.
2699 * See above.
2700 * @since 1.4.0
2701 * All other bits are reserved for future usage. Set them to 0.
2702 * @return
2703 * ISO_SUCCESS or error
2704 *
2705 * @since 1.2.4
2706 */
2707int iso_write_opts_set_prep_img(IsoWriteOpts *opts, char *image_path,
2708 int flag);
2709
2710/**
2711 * Copy a data file from the local filesystem into the emerging ISO image.
2712 * Mark it by an GPT partition entry as EFI System partition, and also cause
2713 * protective GPT partition entries before and after the partition.
2714 * GPT = Globally Unique Identifier Partition Table
2715 *
2716 * This feature may collide with data submitted by
2717 * iso_write_opts_set_system_area()
2718 * and with settings made by
2719 * el_torito_set_isolinux_options()
2720 * It is compatible with HFS+/FAT production by storing the EFI partition
2721 * before the start of the HFS+/FAT partition.
2722 * The GPT overwrites byte 0x0200 to 0x03ff of the system area and all
2723 * further bytes above 0x0800 which are not used by an Apple Partition Map.
2724 *
2725 * @param opts
2726 * The option set to be manipulated.
2727 * @param image_path
2728 * File address in the local file system or instructions for interval
2729 * reader. See flag bit0.
2730 * NULL revokes production of the EFI boot partition.
2731 * @param flag
2732 * bit0= The path contains instructions for the interval reader
2733 * See above.
2734 * @since 1.4.0
2735 * All other bits are reserved for future usage. Set them to 0.
2736 * @return
2737 * ISO_SUCCESS or error
2738 *
2739 * @since 1.2.4
2740 */
2741int iso_write_opts_set_efi_bootp(IsoWriteOpts *opts, char *image_path,
2742 int flag);
2743
2744/**
2745 * Control whether the emerging GPT gets a pseudo-randomly generated disk GUID
2746 * or whether it gets a user supplied GUID.
2747 * The partition GUIDs will be generated in a reproducible way by exoring the
2748 * little-endian 32 bit partition number with the disk GUID beginning at byte
2749 * offset 9.
2750 *
2751 * @param opts
2752 * The option set to be manipulated.
2753 * @param guid
2754 * 16 bytes of user supplied GUID. Readily byte-swapped from the text
2755 * form as prescribed by UEFI specs:
2756 * 4 byte, 2 byte, 2 byte as little-endian.
2757 * 2 byte, 6 byte as big-endian.
2758 * The upper 4 bit of guid[7] should bear the value 4 to express the
2759 * RFC 4122 version 4. Bit 7 of byte[8] should be set to 1 and bit 6
2760 * be set to 0, in order to express the RFC 4122 variant of UUID,
2761 * where version 4 means "pseudo-random uuid".
2762 * @param mode
2763 * 0 = ignore parameter guid and produce the GPT disk GUID by a
2764 * pseudo-random algorithm. This is the default setting.
2765 * 1 = use parameter guid as GPT disk GUID
2766 * 2 = ignore parameter guid and derive the GPT disk GUID from
2767 * parameter vol_uuid of iso_write_opts_set_pvd_times().
2768 * The 16 bytes of vol_uuid get copied and bytes 7, 8 get their
2769 * upper bits changed to comply to RFC 4122 and UEFI.
2770 * Error ISO_GPT_NO_VOL_UUID will occur if image production begins
2771 * before vol_uuid was set.
2772 *
2773 * @return
2774 * ISO_SUCCESS or ISO_BAD_GPT_GUID_MODE
2775 *
2776 * @since 1.4.6
2777 */
2778int iso_write_opts_set_gpt_guid(IsoWriteOpts *opts, uint8_t guid[16],
2779 int mode);
2780
2781/**
2782 * Set the maximum number of SUSP CE entries and thus continuation areas.
2783 * Each continuation area can hold at most 2048 bytes of SUSP data (Rock Ridge
2784 * or AAIP). The first area can be smaller. There might be some waste at the
2785 * end of each area.
2786 * When the maximum number is exceeded during ISO filesystem production
2787 * then possibly xattr and ACL get removed or error ISO_TOO_MANY_CE gets
2788 * reported and filesystem production is prevented.
2789 *
2790 * Files with 32 or more CE entries do not show up in mounted filesystems on
2791 * Linux. So the default setting is 31 with drop mode 2. If a higher limit is
2792 * chosen and 31 gets surpassed, then a warning message gets reported.
2793 *
2794 * @param opts
2795 * The option set to be manipulated.
2796 * @param num
2797 * The maximum number of CE entries per file.
2798 * Not more than 100000 may be set here.
2799 * 0 gets silently mapped to 1, because the root directory needs one CE.
2800 * @param flag
2801 * bit0-bit3 = Drop mode: What to do with AAIP data on too many CE:
2802 * 0 = throw ISO_TOO_MANY_CE, without dropping anything
2803 * 1 = permanently drop non-isofs fattr from IsoNode and
2804 * retry filesystem production
2805 * 2 = drop ACL if dropping non-isofs fattr does not suffice
2806 * @return
2807 * ISO_SUCCESS or ISO_TOO_MANY_CE
2808 *
2809 * @since 1.5.6
2810*/
2812 int flag);
2813
2814/**
2815 * Generate a pseudo-random GUID suitable for iso_write_opts_set_gpt_guid().
2816 *
2817 * @param guid
2818 * Will be filled by 16 bytes of generated GUID.
2819 *
2820 * @since 1.4.6
2821 */
2822void iso_generate_gpt_guid(uint8_t guid[16]);
2823
2824/**
2825 * Cause an arbitrary data file to be appended to the ISO image and to be
2826 * described by a partition table entry in an MBR or SUN Disk Label at the
2827 * start of the ISO image.
2828 * The partition entry will bear the size of the image file rounded up to
2829 * the next multiple of 2048 bytes.
2830 * MBR or SUN Disk Label are selected by iso_write_opts_set_system_area()
2831 * system area type: 0 selects MBR partition table. 3 selects a SUN partition
2832 * table with 320 kB start alignment.
2833 *
2834 * @param opts
2835 * The option set to be manipulated.
2836 * @param partition_number
2837 * Depicts the partition table entry which shall describe the
2838 * appended image.
2839 * Range with MBR: 1 to 4. 1 will cause the whole ISO image to be
2840 * unclaimable space before partition 1.
2841 * Range with SUN Disk Label: 2 to 8.
2842 * @param partition_type
2843 * The MBR partition type. E.g. FAT12 = 0x01 , FAT16 = 0x06,
2844 * Linux Native Partition = 0x83. See fdisk command L.
2845 * This parameter is ignored with SUN Disk Label.
2846 * @param image_path
2847 * File address in the local file system or instructions for interval
2848 * reader. See flag bit0.
2849 * With SUN Disk Label: an empty name causes the partition to become
2850 * a copy of the next lower partition.
2851 * @param flag
2852 * bit0= The path contains instructions for the interval reader
2853 * See above.
2854 * @since 1.4.0
2855 * All other bits are reserved for future usage. Set them to 0.
2856 * @return
2857 * ISO_SUCCESS or error
2858 *
2859 * @since 0.6.38
2860 */
2861int iso_write_opts_set_partition_img(IsoWriteOpts *opts, int partition_number,
2862 uint8_t partition_type, char *image_path, int flag);
2863
2864/**
2865 * Control whether partitions created by iso_write_opts_set_partition_img()
2866 * are to be represented in MBR or as GPT partitions.
2867 *
2868 * @param opts
2869 * The option set to be manipulated.
2870 * @param gpt
2871 * 0= represent as MBR partition; as GPT only if other GPT partitions
2872 * are present
2873 * 1= represent as GPT partition and cause protective MBR with a single
2874 * partition which covers the whole output data.
2875 * This may fail if other settings demand MBR partitions.
2876 * @return
2877 * ISO_SUCCESS or error
2878 *
2879 * @since 1.4.0
2880 */
2882
2883/**
2884 * Set the GPT Type GUID for a partition defined by
2885 * iso_write_opts_set_partition_img().
2886 *
2887 * @param opts
2888 * The option set to be manipulated.
2889 * @param partition_number
2890 * Depicts the partition table entry which shall get the Type GUID.
2891 * @param guid
2892 * 16 bytes of user supplied GUID. Readily byte-swapped from the text
2893 * form as prescribed by UEFI specs:
2894 * 4 byte, 2 byte, 2 byte as little-endian.
2895 * 2 byte, 6 byte as big-endian.
2896 * @param valid
2897 * Set to 1 to make this Type GUID valid.
2898 * Set to 0 in order to invalidate a previously made setting. In this
2899 * case MBR type 0xEF will become the EFI Type GUID. All others will
2900 * become the Basic Data Partition Type GUID.
2901 * @return
2902 * ISO_SUCCESS or error
2903 *
2904 * @since 1.5.2
2905 */
2906int iso_write_opts_set_part_type_guid(IsoWriteOpts *opts, int partition_number,
2907 uint8_t guid[16], int valid);
2908
2909/**
2910 * Control whether the GPT partition table is allowed to leave some parts of
2911 * the emerging ISO image uncovered, whether the partition entries in the
2912 * GPT get sorted by their start block addresses, and whether partition 1
2913 * gets created to represent the ISO 9660 filesystem.
2914 * Default is that the partition entries get sorted and all gaps get filled
2915 * by additional GPT partition entries. Partition 1 is by default created for
2916 * the ISO filesystem if partition offset is 16, no partition 1 was created for
2917 * other reasons, and no other partition overlaps with the range from LBA 16 to
2918 * the end of the ISO 9660 filesystem.
2919 *
2920 * Note that GPT for ISOLINUX isohybrid does not get gaps filled, anyways.
2921 *
2922 * @param opts
2923 * The option set to be manipulated.
2924 * @param with_gaps
2925 * If 0, fill gaps.
2926 * If 1, do not fill gaps.
2927 * @param with_gaps_no_sort
2928 * In case that with_gaps is 1:
2929 * If 0, sort partitions by start block addresses.
2930 * If 1, do not sort partitions.
2931 * @param with_gaps_no_iso
2932 * In case that with_gaps is 1:
2933 * If 0, create partition 1 for the ISO filesystem if possible.
2934 * If 1, do not create partition for the ISO filesystem if not already
2935 * created for other reasons.
2936 * @return
2937 * ISO_SUCCESS or error
2938 *
2939 * @since 1.5.8
2940 */
2942 int with_gaps_no_sort, int with_gaps_no_iso);
2943
2944/**
2945 * Control whether partitions created by iso_write_opts_set_partition_img()
2946 * are to be represented in Apple Partition Map.
2947 *
2948 * @param opts
2949 * The option set to be manipulated.
2950 * @param apm
2951 * 0= do not represent appended partitions in APM
2952 * 1= represent in APM, even if not
2953 * iso_write_opts_set_part_like_isohybrid() enables it and no
2954 * other APM partitions emerge.
2955 * @return
2956 * ISO_SUCCESS or error
2957 *
2958 * @since 1.4.4
2959 */
2961
2962/**
2963 * Control whether bits 2 to 8 of el_torito_set_isolinux_options()
2964 * shall apply even if not isohybrid MBR patching is enabled (bit1 of
2965 * parameter options of iso_write_opts_set_system_area()):
2966 * - Mentioning of El Torito boot images in GPT.
2967 * - Mentioning of El Torito boot images in APM.
2968 *
2969 * In this case some other behavior from isohybrid processing will apply too:
2970 * - No MBR partition of type 0xee emerges, even if GPT gets produced.
2971 * - Gaps between GPT and APM partitions will not be filled by more partitions.
2972 *
2973 * An extra feature towards isohybrid is enabled:
2974 * - Appended partitions get mentioned in APM if other APM partitions emerge.
2975 *
2976 * @param opts
2977 * The option set to be manipulated.
2978 * @param alike
2979 * 0= Apply the described behavior only with ISOLINUX isohybrid.
2980 * Do not mention appended partitions in APM unless
2981 * iso_write_opts_set_appended_as_apm() is enabled.
2982 * 1= Apply the described behavior even without ISOLINUX isohybrid.
2983 *
2984 * @return
2985 * ISO_SUCCESS or error
2986 *
2987 * @since 1.4.4
2988 */
2990
2991/**
2992 * Set the partition type of the MBR partition which represents the ISO
2993 * filesystem or at least protects it.
2994 * This is without effect if no such partition emerges by other settings or
2995 * if the partition type is prescribed mandatorily like 0xee for GPT protective
2996 * MBR or 0x96 for CHRP.
2997 * @param opts
2998 * The option set to be manipulated.
2999 * @param part_type
3000 * 0x00 to 0xff as desired partition type.
3001 * Any other value (e.g. -1) enables the default types of the various
3002 * occasions.
3003 * @return
3004 * ISO_SUCCESS or error
3005 * @since 1.4.8
3006 */
3008
3009/**
3010 * Set the GPT Type GUID for the partition which represents the ISO 9660
3011 * filesystem, if such a partition emerges in GPT.
3012 * @param opts
3013 * The option set to be manipulated.
3014 * @param guid
3015 * 16 bytes of user supplied GUID. Readily byte-swapped from the text
3016 * form as prescribed by UEFI specs:
3017 * 4 byte, 2 byte, 2 byte as little-endian.
3018 * 2 byte, 6 byte as big-endian.
3019 * @param valid
3020 * Set to 1 to make this Type GUID valid.
3021 * Set to 0 in order to invalidate a previously made setting. In this
3022 * case the setting of iso_write_opts_set_iso_mbr_part_type() or its
3023 * default will get into effect.
3024 * @return
3025 * ISO_SUCCESS or error
3026 *
3027 * @since 1.5.2
3028 */
3030 int valid);
3031
3032/**
3033 * Inquire the start address of the file data blocks after having used
3034 * IsoWriteOpts with iso_image_create_burn_source().
3035 * @param opts
3036 * The option set that was used when starting image creation
3037 * @param data_start
3038 * Returns the logical block address if it is already valid
3039 * @param flag
3040 * Reserved for future usage, set to 0.
3041 * @return
3042 * 1 indicates valid data_start, <0 indicates invalid data_start
3043 *
3044 * @since 0.6.16
3045 */
3046int iso_write_opts_get_data_start(IsoWriteOpts *opts, uint32_t *data_start,
3047 int flag);
3048
3049/**
3050 * Update the sizes of all files added to image.
3051 *
3052 * This may be called just before iso_image_create_burn_source() to force
3053 * libisofs to check the file sizes again (they're already checked when added
3054 * to IsoImage). It is useful if you have changed some files after adding then
3055 * to the image.
3056 *
3057 * @return
3058 * 1 on success, < 0 on error
3059 * @since 0.6.8
3060 */
3062
3063/**
3064 * Create a burn_source and a thread which immediately begins to generate
3065 * the image. That burn_source can be used with libburn as a data source
3066 * for a track. A copy of its public declaration in libburn.h can be found
3067 * further below in this text.
3068 *
3069 * If image generation shall be aborted by the application program, then
3070 * the .cancel() method of the burn_source must be called to end the
3071 * generation thread: burn_src->cancel(burn_src);
3072 *
3073 * @param image
3074 * The image to write.
3075 * @param opts
3076 * The options for image generation. All needed data will be copied, so
3077 * you can free the given struct once this function returns.
3078 * @param burn_src
3079 * Location where the pointer to the burn_source will be stored
3080 * @return
3081 * 1 on success, < 0 on error
3082 *
3083 * @since 0.6.2
3084 */
3086 struct burn_source **burn_src);
3087
3088/**
3089 * Inquire whether the image generator thread is still at work. As soon as the
3090 * reply is 0, the caller of iso_image_create_burn_source() may assume that
3091 * the image generation has ended.
3092 * Nevertheless there may still be readily formatted output data pending in
3093 * the burn_source or its consumers. So the final delivery of the image has
3094 * also to be checked at the data consumer side,e.g. by burn_drive_get_status()
3095 * in case of libburn as consumer.
3096 * @param image
3097 * The image to inquire.
3098 * @return
3099 * 1 generating of image stream is still in progress
3100 * 0 generating of image stream has ended meanwhile
3101 *
3102 * @since 0.6.38
3103 */
3105
3106/**
3107 * Creates an IsoReadOpts for reading an existent image. You should set the
3108 * options desired with the correspondent setters. Note that you may want to
3109 * set the start block value.
3110 *
3111 * Options by default are determined by the selected profile.
3112 *
3113 * @param opts
3114 * Pointer to the location where the newly created IsoReadOpts will be
3115 * stored. You should free it with iso_read_opts_free() when no more
3116 * needed.
3117 * @param profile
3118 * Default profile for image reading. For now the following values are
3119 * defined:
3120 * ---> 0 [STANDARD]
3121 * Suitable for most situations. Most extension are read. When both
3122 * Joliet and RR extension are present, RR is used.
3123 * AAIP for ACL and xattr is not enabled by default.
3124 * @return
3125 * 1 success, < 0 error
3126 *
3127 * @since 0.6.2
3128 */
3129int iso_read_opts_new(IsoReadOpts **opts, int profile);
3130
3131/**
3132 * Free an IsoReadOpts previously allocated with iso_read_opts_new().
3133 *
3134 * @since 0.6.2
3135 */
3137
3138/**
3139 * Set the block where the image begins. It is usually 0, but may be different
3140 * on a multisession disc.
3141 *
3142 * @since 0.6.2
3143 */
3145
3146/**
3147 * Do not read Rock Ridge extensions.
3148 * In most cases you don't want to use this. It could be useful if RR info
3149 * is damaged, or if you want to use the Joliet tree.
3150 *
3151 * @since 0.6.2
3152 */
3154
3155/**
3156 * Do not read Joliet extensions.
3157 *
3158 * @since 0.6.2
3159 */
3161
3162/**
3163 * Do not read the tree of an Enhanced Volume Descriptor (aka ISO 9660:1999)
3164 * as of ECMA-119 4th Edition.
3165 *
3166 * @since 0.6.2
3167 */
3169
3170/**
3171 * Control reading of AAIP information about ACL and xattr when loading
3172 * existing images.
3173 * For importing ACL and xattr when inserting nodes from external filesystems
3174 * (e.g. the local POSIX filesystem) see iso_image_set_ignore_aclea().
3175 * For writing of this information see iso_write_opts_set_aaip().
3176 *
3177 * @param opts
3178 * The option set to be manipulated
3179 * @param noaaip
3180 * 1 = Do not read AAIP information
3181 * 0 = Read AAIP information if available
3182 * All other values are reserved.
3183 * @since 0.6.14
3184 */
3186
3187/**
3188 * Control reading of an array of MD5 checksums which is possibly stored
3189 * at the end of a session. See also iso_write_opts_set_record_md5().
3190 * Important: Loading of the MD5 array will only work if AAIP is enabled
3191 * because its position and layout is recorded in xattr "isofs.ca".
3192 *
3193 * @param opts
3194 * The option set to be manipulated
3195 * @param no_md5
3196 * 0 = Read MD5 array if available, refuse on non-matching MD5 tags
3197 * 1 = Do not read MD5 checksum array
3198 * 2 = Read MD5 array, but do not check MD5 tags
3199 * @since 1.0.4
3200 * All other values are reserved.
3201 *
3202 * @since 0.6.22
3203 */
3205
3206
3207/**
3208 * Control discarding of inode numbers from existing images.
3209 * Such numbers may come from RRIP 1.12 entries PX. If not discarded they
3210 * get written unchanged when the file object gets written into an ISO image.
3211 * If this inode number is missing with a file in the imported image,
3212 * or if it has been discarded during image reading, then a unique inode number
3213 * will be generated at some time before the file gets written into an ISO
3214 * image.
3215 * Two image nodes which have the same inode number represent two hardlinks
3216 * of the same file object. So discarding the numbers splits hardlinks.
3217 *
3218 * @param opts
3219 * The option set to be manipulated
3220 * @param new_inos
3221 * 1 = Discard imported inode numbers and finally hand out a unique new
3222 * one to each single file before it gets written into an ISO image.
3223 * 0 = Keep imported inode numbers from PX entries.
3224 * All other values are reserved.
3225 * @since 0.6.20
3226 */
3228
3229/**
3230 * Whether to prefer Joliet over RR. libisofs usually prefers RR over
3231 * Joliet, as it give us much more info about files. So, if both extensions
3232 * are present, RR is used. You can set this if you prefer Joliet, but
3233 * note that this is not very recommended. This doesn't mean than RR
3234 * extensions are not read: if no Joliet is present, libisofs will read
3235 * RR tree.
3236 *
3237 * @since 0.6.2
3238 */
3239int iso_read_opts_set_preferjoliet(IsoReadOpts *opts, int preferjoliet);
3240
3241/**
3242 * How to convert file names if neither Rock Ridge nor Joliet names
3243 * are present and acceptable.
3244 *
3245 * @param opts
3246 * The option set to be manipulated
3247 * @param ecma119_map
3248 * The conversion mode to apply:
3249 * 0 = unmapped: Take name as recorded in ECMA-119 directory record
3250 * (not suitable for writing it to a new ISO filesystem)
3251 * 1 = stripped: Like unmapped, but strip off trailing ";1" or ".;1"
3252 * 2 = uppercase: Like stripped, but map {a-z} to {A-Z}
3253 * 3 = lowercase: Like stripped, but map {A-Z} to {a-z}
3254 * @return
3255 * ISO_SUCCESS if ecma119_map was accepted
3256 * 0 if the value was out of range
3257 * < 0 if other error
3258 *
3259 * @since 1.4.2
3260 */
3261int iso_read_opts_set_ecma119_map(IsoReadOpts *opts, int ecma119_map);
3262
3263/**
3264 * How to convert Joliet file names.
3265 *
3266 * @param opts
3267 * The option set to be manipulated
3268 * @param ecma119_map
3269 * The conversion mode to apply:
3270 * 0 = unmapped: Take name as recorded in Joliet directory record
3271 * (not suitable for writing it to a new ISO filesystem)
3272 * 1 = stripped: Strip off trailing ";1" or ".;1"
3273 * @return
3274 * ISO_SUCCESS if joliet_map was accepted
3275 * 0 if the value was out of range
3276 * < 0 if other error
3277 *
3278 * @since 1.5.4
3279 */
3281
3282/**
3283 * Set default uid for files when RR extensions are not present.
3284 *
3285 * @since 0.6.2
3286 */
3288
3289/**
3290 * Set default gid for files when RR extensions are not present.
3291 *
3292 * @since 0.6.2
3293 */
3295
3296/**
3297 * Set default permissions for files when RR extensions are not present.
3298 *
3299 * @param opts
3300 * The option set to be manipulated
3301 * @param file_perm
3302 * Permissions for files.
3303 * @param dir_perm
3304 * Permissions for directories.
3305 *
3306 * @since 0.6.2
3307 */
3309 mode_t dir_perm);
3310
3311/**
3312 * Set the input charset of the file names on the image. NULL to use locale
3313 * charset. You have to specify a charset if the image filenames are encoded
3314 * in a charset different that the local one. This could happen, for example,
3315 * if the image was created on a system with different charset.
3316 *
3317 * @param opts
3318 * The option set to be manipulated
3319 * @param charset
3320 * The charset to use as input charset. You can obtain the list of
3321 * charsets supported on your system executing "iconv -l" in a shell.
3322 *
3323 * @since 0.6.2
3324 */
3325int iso_read_opts_set_input_charset(IsoReadOpts *opts, const char *charset);
3326
3327/**
3328 * Enable or disable methods to automatically choose an input charset.
3329 * This overrides the name set via iso_read_opts_set_input_charset()
3330 *
3331 * @param opts
3332 * The option set to be manipulated
3333 * @param mode
3334 * Bitfield for control purposes:
3335 * bit0= Allow to use the input character set name which is possibly
3336 * stored in attribute "isofs.cs" of the root directory.
3337 * Applications may attach this xattr by iso_node_set_attrs() to
3338 * the root node, call iso_write_opts_set_output_charset() with the
3339 * same name, and enable iso_write_opts_set_aaip() when writing
3340 * an image.
3341 * Submit any other bits with value 0.
3342 *
3343 * @since 0.6.18
3344 *
3345 */
3347
3348/**
3349 * Enable or disable loading of the first 32768 bytes of the session.
3350 *
3351 * @param opts
3352 * The option set to be manipulated
3353 * @param mode
3354 * Bitfield for control purposes:
3355 * bit0= Load System Area data and attach them to the image so that they
3356 * get written by the next session, if not overridden by
3357 * iso_write_opts_set_system_area().
3358 * Submit any other bits with value 0.
3359 *
3360 * @since 0.6.30
3361 *
3362 */
3364
3365/**
3366 * Control whether to keep a reference to the IsoDataSource object which
3367 * allows access to the blocks of the imported ISO 9660 filesystem.
3368 * This is needed if the interval reader shall read from "imported_iso".
3369 *
3370 * @param opts
3371 * The option set to be manipulated
3372 * @param mode
3373 * Bitfield for control purposes:
3374 * bit0= Keep a reference to the IsoDataSource until the IsoImage object
3375 * gets disposed by its final iso_image_unref().
3376 * Submit any other bits with value 0.
3377 *
3378 * @since 1.4.0
3379 *
3380 */
3382
3383/**
3384 * Import a previous session or image, for growing or modify.
3385 *
3386 * @param image
3387 * The image context to which old image will be imported. Note that all
3388 * files added to image, and image attributes, will be replaced with the
3389 * contents of the old image.
3390 * TODO #00025 support for merging old image files
3391 * @param src
3392 * Data Source from which old image will be read. A extra reference is
3393 * added, so you still need to iso_data_source_unref() yours.
3394 * @param opts
3395 * Options for image import. All needed data will be copied, so you
3396 * can free the given struct once this function returns.
3397 * @param features
3398 * If not NULL, a new IsoReadImageFeatures will be allocated and filled
3399 * with the features of the old image. It should be freed with
3400 * iso_read_image_features_destroy() when no more needed. You can pass
3401 * NULL if you're not interested on them.
3402 * @return
3403 * 1 on success, < 0 on error
3404 *
3405 * @since 0.6.2
3406 */
3408 IsoReadImageFeatures **features);
3409
3410/**
3411 * Assess features of the importable directory trees of src and an estimation
3412 * of the write options which would cause the recognized features.
3413 * This goes deeper than the feature assessment of iso_image_import(), e.g. by
3414 * inspecting file names.
3415 *
3416 * For the parameters "src", "opts", and "features" see also the description of
3417 * iso_image_import().
3418 *
3419 * @param src
3420 * Data Source from which old image will be read.
3421 * @param opts
3422 * Options for image import. Settings about tree choice will be ignored.
3423 * @param features
3424 * Returns the pointer to a newly allocated and filled IsoReadImageFeatures
3425 * object. NULL is not allowed, other than with iso_image_import().
3426 * If *features is returned as non-NULL, then it should be freed with
3427 * iso_read_image_features_destroy() when no more needed.
3428 * @param write_opts
3429 * Returns the pointer to a newly allocated and filled IsoWriteOpts object.
3430 * If *write_opts is returned as non-NULL, then it should be freed with
3431 * iso_write_opts_free() when no more needed.
3432 *
3433 * @return
3434 * 1 on success, < 0 on error
3435 *
3436 * @since 1.5.6
3437 */
3439 IsoReadImageFeatures **features,
3440 IsoWriteOpts **write_opts);
3441
3442/**
3443 * Destroy an IsoReadImageFeatures object obtained with iso_image_import() or
3444 * iso_assess_written_features().
3445 *
3446 * @since 0.6.2
3447 */
3449
3450/**
3451 * Get the size (in 2048 byte block) of the image, as reported in the PVM.
3452 *
3453 * @since 0.6.2
3454 */
3456
3457/**
3458 * Whether RockRidge extensions are present in the image imported.
3459 *
3460 * @since 0.6.2
3461 */
3463
3464/**
3465 * Whether Joliet extensions are present in the image imported.
3466 *
3467 * @since 0.6.2
3468 */
3470
3471/**
3472 * Whether the image is recorded with an Enhanced Volume Descriptor
3473 * (aka ISO 9660:1999) as of ECMA-119 4th Edition.
3474 *
3475 * @since 0.6.2
3476 */
3478
3479/**
3480 * Whether El-Torito boot record is present present in the image imported.
3481 *
3482 * @since 0.6.2
3483 */
3485
3486/**
3487 * Tells what directory tree was loaded:
3488 * 0 = ISO 9660 , 1 = Joliet ,
3489 * 2 = Enhanced Volume Descriptor tree as of ECMA-119 4th Edition
3490 * (aka ISO 9660:1999)
3491 *
3492 * @since 1.5.4
3493 */
3495
3496/**
3497 * Tells whether Rock Ridge information was used while loading the tree:
3498 * 1= yes, 0= no
3499 *
3500 * @since 1.5.4
3501 */
3503
3504/**
3505 * Get a named feature as text, num_value, or pt_value depending on its type.
3506 * The set of named features includes the features which can be inquired by
3507 * own iso_read_image_features_*() functions:
3508 * size See iso_read_image_features_get_size()
3509 * rockridge See iso_read_image_features_has_rockridge()
3510 * iso_write_opts_set_rockridge()
3511 * joliet See iso_read_image_features_has_joliet()
3512 * iso_write_opts_set_joliet()
3513 * iso1999 See iso_read_image_features_has_iso1999()
3514 * iso_write_opts_set_iso1999()
3515 * eltorito See iso_read_image_features_has_eltorito()
3516 * tree_loaded See iso_read_image_features_tree_loaded()
3517 * rr_loaded See iso_read_image_features_rr_loaded()
3518 * Other named features are:
3519 * tree_loaded_text Text form of "tree_loaded":
3520 * 0="ISO9660", 1="Joliet", 2="ISO9660:1999"
3521 * aaip 1=AAIP information was seen, 0= no AAIP seen
3522 * Detected traces of potential write option settings:
3523 * iso_level See iso_write_opts_set_iso_level()
3524 * untranslated_name_len See iso_write_opts_set_untranslated_name_len()
3525 * allow_dir_id_ext See iso_write_opts_set_allow_dir_id_ext()
3526 * omit_version_numbers See iso_write_opts_set_omit_version_numbers()
3527 * allow_deep_paths See iso_write_opts_set_allow_deep_paths()
3528 * allow_longer_paths See iso_write_opts_set_allow_longer_paths()
3529 * max_37_char_filenames See iso_write_opts_set_max_37_char_filenames()
3530 * no_force_dots See iso_write_opts_set_no_force_dots()
3531 * allow_lowercase See iso_write_opts_set_allow_lowercase()
3532 * allow_full_ascii See iso_write_opts_set_allow_full_ascii()
3533 * relaxed_vol_atts bit0 see iso_write_opts_set_relaxed_vol_atts()
3534 * bit1 see iso_write_opts_set_relaxed_nonvol_atts()
3535 * joliet_longer_paths See iso_write_opts_set_joliet_longer_paths()
3536 * joliet_long_names See iso_write_opts_set_joliet_long_names()
3537 * joliet_utf16 See iso_write_opts_set_joliet_utf16()
3538 * rrip_version_1_10 See iso_write_opts_set_rrip_version_1_10()
3539 * rrip_1_10_px_ino See iso_write_opts_set_rrip_1_10_px_ino()
3540 * aaip_susp_1_10 See iso_write_opts_set_aaip_susp_1_10()
3541 * record_md5_session See iso_write_opts_set_record_md5() param session
3542 * record_md5_files See iso_write_opts_set_record_md5() param files
3543 *
3544 * @param f
3545 * A features object returned by iso_image_import() or
3546 * iso_assess_written_features().
3547 * @param name
3548 * The name of the feature to be inquired.
3549 * @param text
3550 * If text is not NULL, *text returns a textual representation of the
3551 * reply. Dispose *text by free(2) when no longer needed.
3552 * @param type
3553 * Returns which of num_value or pt_value is valid:
3554 * 0= *num_value is valid
3555 * 1= *pt_value is valid
3556 * @param num_value
3557 * Returns the numerical value of the feature if type == 0.
3558 * @param pt_value
3559 * Returns a pointer to a memory area inside the features object if type
3560 * is 1. The area is not necessarily 0-terminated.
3561 * Do _not_ dispose *pt_value and do not use it after f was disposed.
3562 * @param pt_size
3563 * Returns the size of the pt_value memory area if type is 1.
3564 * This counting includes a terminating 0-byte if it is present.
3565 * @return
3566 * 0 = Feature was not yet examined. Reply is not valid.
3567 * 1 = Reply is valid
3568 * ISO_UNDEF_READ_FEATURE = Given name is not known
3569 * <0 = other error
3570 *
3571 * @since 1.5.6
3572 */
3574 char **text, int *type,
3575 int64_t *num_value, void **pt_value,
3576 size_t *pt_size);
3577
3578/**
3579 * Get all validly assessed named features as one single 0-terminated string
3580 * consisting of single lines for each feature.
3581 *
3582 * @param f
3583 * A features object returned by iso_image_import() or
3584 * iso_assess_written_features().
3585 * @param with_values
3586 * If set to 1: return lines of form name=value\n
3587 * If set to 0: return lines of form name\n
3588 * @param feature_text
3589 * Returns the result string. Dispose by free(2) when no longer needed.
3590 * @return
3591 * 1 = result is valid, <0 indicates error
3592 *
3593 * @since 1.5.6
3594 */
3596 char **feature_text);
3597
3598/**
3599 * Increments the reference counting of the given image.
3600 *
3601 * @since 0.6.2
3602 */
3604
3605/**
3606 * Decrements the reference counting of the given image.
3607 * If it reaches 0, the image is free, together with its tree nodes (whether
3608 * their refcount reach 0 too, of course).
3609 *
3610 * @since 0.6.2
3611 */
3613
3614/**
3615 * Attach user defined data to the image. Use this if your application needs
3616 * to store addition info together with the IsoImage. If the image already
3617 * has data attached, the old data will be freed.
3618 *
3619 * @param image
3620 * The image to which data shall be attached.
3621 * @param data
3622 * Pointer to application defined data that will be attached to the
3623 * image. You can pass NULL to remove any already attached data.
3624 * @param give_up
3625 * Function that will be called when the image does not need the data
3626 * any more. It receives the data pointer as an argument, and should free
3627 * allocated data if needed. give_up may be NULL if not needed.
3628 * @return
3629 * 1 on success, < 0 on error
3630 *
3631 * @since 0.6.2
3632 */
3633int iso_image_attach_data(IsoImage *image, void *data, void (*give_up)(void*));
3634
3635/**
3636 * The the data previously attached with iso_image_attach_data()
3637 *
3638 * @since 0.6.2
3639 */
3641
3642/**
3643 * Set the name truncation mode and the maximum name length for nodes from
3644 * image importing, creation of new IsoNode objects, and name changing image
3645 * manipulations.
3646 *
3647 * Truncated names are supposed to be nearly unique because they end by the MD5
3648 * of the first 4095 characters of the untruncated name. One should treat them
3649 * as if they were the untruncated original names.
3650 *
3651 * For proper processing of truncated names it is necessary to use
3652 * iso_image_set_node_name() instead of iso_node_set_name()
3653 * iso_image_add_new_dir() iso_tree_add_new_dir()
3654 * iso_image_add_new_file() iso_tree_add_new_file()
3655 * iso_image_add_new_special() iso_tree_add_new_special()
3656 * iso_image_add_new_symlink() iso_tree_add_new_symlink()
3657 * iso_image_tree_clone() iso_tree_clone()
3658 * iso_image_dir_get_node() iso_dir_get_node()
3659 * iso_image_path_to_node() iso_tree_path_to_node()
3660 *
3661 * Beware of ambiguities if both, the full name and the truncated name,
3662 * exist in the same directory. Best is to only set truncation parameters
3663 * once with an ISO filesystem and to never change them later.
3664 *
3665 * If writing of AAIP is enabled, then the mode and length are recorded in
3666 * xattr "isofs.nt" of the root node.
3667 * If reading of AAIP is enabled and "isofs.nt" is found, then it gets into
3668 * effect if both, the truncate mode value from "isofs.nt" and the current
3669 * truncate mode of the IsoImage are 1, and the length is between 64 and 255.
3670 *
3671 * @param img
3672 * The image which shall be manipulated.
3673 * @param mode
3674 * 0= Do not truncate but throw error ISO_RR_NAME_TOO_LONG if a file name
3675 * is longer than parameter length.
3676 * 1= Truncate to length and overwrite the last 33 bytes of that length
3677 * by a colon ':' and the hex representation of the MD5 of the first
3678 * 4095 bytes of the whole oversized name.
3679 * Potential incomplete UTF-8 characters will get their leading bytes
3680 * replaced by '_'.
3681 * Mode 1 is the default.
3682 * @param length
3683 * Maximum byte count of a file name. Permissible values are 64 to 255.
3684 * Default is 255.
3685 * @return
3686 * ISO_SUCCESS or ISO_WRONG_ARG_VALUE
3687 *
3688 * @since 1.4.2
3689 */
3690int iso_image_set_truncate_mode(IsoImage *img, int mode, int length);
3691
3692/**
3693 * Inquire the current setting of iso_image_set_truncate_mode().
3694 *
3695 * @param img
3696 * The image which shall be inquired.
3697 * @param mode
3698 * Returns the mode value.
3699 * @param length
3700 * Returns the length value.
3701 * @return
3702 * ISO_SUCCESS or <0 = error
3703 *
3704 * @since 1.4.2
3705 */
3706int iso_image_get_truncate_mode(IsoImage *img, int *mode, int *length);
3707
3708/**
3709 * Immediately apply the given truncate mode and length to the given string.
3710 *
3711 * @param mode
3712 * See iso_image_set_truncate_mode()
3713 * @param length
3714 * See iso_image_set_truncate_mode()
3715 * @param name
3716 * The string to be inspected and truncated if mode says so.
3717 * @param flag
3718 * Bitfield for control purposes. Unused yet. Submit 0.
3719 * @return
3720 * ISO_SUCCESS, ISO_WRONG_ARG_VALUE, ISO_RR_NAME_TOO_LONG
3721 *
3722 * @since 1.4.2
3723 */
3724int iso_truncate_leaf_name(int mode, int length, char *name, int flag);
3725
3726/**
3727 * Get the root directory of the image.
3728 * No extra ref is added to it, so you must not unref it. Use iso_node_ref()
3729 * if you want to get your own reference.
3730 *
3731 * @since 0.6.2
3732 */
3734
3735/**
3736 * Fill in the volset identifier for a image.
3737 *
3738 * @since 0.6.2
3739 */
3740void iso_image_set_volset_id(IsoImage *image, const char *volset_id);
3741
3742/**
3743 * Get the volset identifier.
3744 * The returned string is owned by the image and must not be freed nor
3745 * changed.
3746 *
3747 * @since 0.6.2
3748 */
3749const char *iso_image_get_volset_id(const IsoImage *image);
3750
3751/**
3752 * Fill in the volume identifier for all filesystem superblocks in an image.
3753 * This call is like iso_image_set_volume_id_v2(image, 0xf, volume_id).
3754 *
3755 * @since 0.6.2
3756 */
3757void iso_image_set_volume_id(IsoImage *image, const char *volume_id);
3758
3759/**
3760 * Fill in the volume identifier for one or more filesystem superblocks in
3761 * an image.
3762 *
3763 * @param img
3764 * The image which shall be manipulated.
3765 * @param fs_type_mask
3766 * A bit field which choses the filesystem superblocks for which volume_id
3767 * shall be used:
3768 * bit0= ISO 9660 and Rock Ridge
3769 * bit1= Joliet
3770 * bit2= ISO 9660:1999
3771 * bit3= HFS+
3772 * @param volume_id
3773 * The text which shall be used as volume identifier.
3774 * @return
3775 * ISO_SUCCESS, ISO_OUT_OF_MEM
3776 *
3777 * @since 1.5.8
3778 */
3779int iso_image_set_volume_id_v2(IsoImage *image, int fs_type_mask,
3780 const char *volume_id);
3781
3782/**
3783 * Get the volume identifier of an image for ISO 9660 and Rock Ridge.
3784 * The returned string is owned by the image and must not be freed nor
3785 * changed.
3786 * This call is like iso_image_get_volume_id_v2(image, 0, volume_id).
3787 *
3788 * @since 0.6.2
3789 */
3790const char *iso_image_get_volume_id(const IsoImage *image);
3791
3792/**
3793 * Get the current volume identifier of an image for a particular filesystem
3794 * superblock.
3795 *
3796 * @param image
3797 * The image which shall be inquired.
3798 * @param fs_type
3799 * Chooses the filesystem superblock type for which the volume id is set.
3800 * 0= ISO 9660 and Rock Ridge
3801 * 1= Joliet
3802 * 2= ISO 9660:1999
3803 * 3= HFS+
3804 * @return
3805 * The currently registered volume id for the given fs_type
3806 * The returned string is owned by the image and must not be freed nor
3807 * changed.
3808 *
3809 * @since 1.5.8
3810 */
3811const char *iso_image_get_volume_id_v2(const IsoImage *image, int fs_type);
3812
3813/**
3814 * Fill in the publisher for a image.
3815 *
3816 * @since 0.6.2
3817 */
3818void iso_image_set_publisher_id(IsoImage *image, const char *publisher_id);
3819
3820/**
3821 * Get the publisher of a image.
3822 * The returned string is owned by the image and must not be freed nor
3823 * changed.
3824 *
3825 * @since 0.6.2
3826 */
3827const char *iso_image_get_publisher_id(const IsoImage *image);
3828
3829/**
3830 * Fill in the data preparer for a image.
3831 *
3832 * @since 0.6.2
3833 */
3835 const char *data_preparer_id);
3836
3837/**
3838 * Get the data preparer of a image.
3839 * The returned string is owned by the image and must not be freed nor
3840 * changed.
3841 *
3842 * @since 0.6.2
3843 */
3845
3846/**
3847 * Fill in the system id for a image. Up to 32 characters.
3848 *
3849 * @since 0.6.2
3850 */
3851void iso_image_set_system_id(IsoImage *image, const char *system_id);
3852
3853/**
3854 * Get the system id of a image.
3855 * The returned string is owned by the image and must not be freed nor
3856 * changed.
3857 *
3858 * @since 0.6.2
3859 */
3860const char *iso_image_get_system_id(const IsoImage *image);
3861
3862/**
3863 * Fill in the application id for a image. Up to 128 chars.
3864 *
3865 * @since 0.6.2
3866 */
3867void iso_image_set_application_id(IsoImage *image, const char *application_id);
3868
3869/**
3870 * Get the application id of a image.
3871 * The returned string is owned by the image and must not be freed nor
3872 * changed.
3873 *
3874 * @since 0.6.2
3875 */
3876const char *iso_image_get_application_id(const IsoImage *image);
3877
3878/**
3879 * Fill copyright information for the image. Usually this refers
3880 * to a file on disc. Up to 37 characters.
3881 *
3882 * @since 0.6.2
3883 */
3885 const char *copyright_file_id);
3886
3887/**
3888 * Get the copyright information of a image.
3889 * The returned string is owned by the image and must not be freed nor
3890 * changed.
3891 *
3892 * @since 0.6.2
3893 */
3895
3896/**
3897 * Fill abstract information for the image. Usually this refers
3898 * to a file on disc. Up to 37 characters.
3899 *
3900 * @since 0.6.2
3901 */
3903 const char *abstract_file_id);
3904
3905/**
3906 * Get the abstract information of a image.
3907 * The returned string is owned by the image and must not be freed nor
3908 * changed.
3909 *
3910 * @since 0.6.2
3911 */
3913
3914/**
3915 * Fill biblio information for the image. Usually this refers
3916 * to a file on disc. Up to 37 characters.
3917 *
3918 * @since 0.6.2
3919 */
3920void iso_image_set_biblio_file_id(IsoImage *image, const char *biblio_file_id);
3921
3922/**
3923 * Get the biblio information of a image.
3924 * The returned string is owned by the image and must not be freed or changed.
3925 *
3926 * @since 0.6.2
3927 */
3928const char *iso_image_get_biblio_file_id(const IsoImage *image);
3929
3930/**
3931 * Fill Application Use field of the Primary Volume Descriptor.
3932 * ECMA-119 8.4.32 Application Use (BP 884 to 1395)
3933 * "This field shall be reserved for application use. Its content
3934 * is not specified by this Standard."
3935 *
3936 * @param image
3937 * The image to manipulate.
3938 * @param app_use_data
3939 * Up to 512 bytes of data.
3940 * @param count
3941 * The number of bytes in app_use_data. If the number is smaller than 512,
3942 * then the remaining bytes will be set to 0.
3943 * @since 1.3.2
3944 */
3945void iso_image_set_app_use(IsoImage *image, const char *app_use_data,
3946 int count);
3947
3948/**
3949 * Get the current setting for the Application Use field of the Primary Volume
3950 * Descriptor.
3951 * The returned char array of 512 bytes is owned by the image and must not
3952 * be freed or changed.
3953 *
3954 * @param image
3955 * The image to inquire
3956 * @since 1.3.2
3957 */
3959
3960/**
3961 * Get the four timestamps from the Primary Volume Descriptor of the imported
3962 * ISO image. The timestamps are strings which are either empty or consist
3963 * of 16 digits of the form YYYYMMDDhhmmsscc, plus a signed byte in the range
3964 * of -48 to +52, which gives the timezone offset in steps of 15 minutes.
3965 * None of the returned string pointers shall be used for altering or freeing
3966 * data. They are just for reading.
3967 *
3968 * @param image
3969 * The image to be inquired.
3970 * @param creation_time
3971 * Returns a pointer to the Volume Creation time:
3972 * When "the information in the volume was created."
3973 * @param modification_time
3974 * Returns a pointer to Volume Modification time:
3975 * When "the information in the volume was last modified."
3976 * @param expiration_time
3977 * Returns a pointer to Volume Expiration time:
3978 * When "the information in the volume may be regarded as obsolete."
3979 * @param effective_time
3980 * Returns a pointer to Volume Expiration time:
3981 * When "the information in the volume may be used."
3982 * @return
3983 * ISO_SUCCESS or error
3984 *
3985 * @since 1.2.8
3986 */
3988 char **creation_time, char **modification_time,
3989 char **expiration_time, char **effective_time);
3990
3991/**
3992 * Create a new set of El-Torito bootable images by adding a boot catalog
3993 * and the default boot image.
3994 * Further boot images may then be added by iso_image_add_boot_image().
3995 *
3996 * @param image
3997 * The image to make bootable. If it was already bootable this function
3998 * returns an error and the image remains unmodified.
3999 * @param image_path
4000 * The absolute path of a IsoFile to be used as default boot image or
4001 * --interval:appended_partition_$number[_start_$start_size_$size]:...
4002 * if type is ELTORITO_NO_EMUL. $number gives the partition number.
4003 * If no partitition with the given $number was set by functions like
4004 * iso_write_opts_set_partition_img() and if the optional image_path part
4005 * "_start_$start_size_$size" is present, then $start gets read as 2 KiB
4006 * start block of the interval and $size as number of blocks of 512 bytes.
4007 * If this range of block addresses is below the address set by
4008 * iso_write_opts_set_ms_block(), then that range gets marked as boot
4009 * image. I.e. an old appended partition can be marked as boot image.
4010 * @param type
4011 * The boot media type. This can be one of 3 types:
4012 * - ELTORITO_FLOPPY_EMUL.
4013 * Floppy emulation: Boot image file must be exactly
4014 * 1200 KiB, 1440 KiB or 2880 KiB.
4015 * - ELTORITO_HARD_DISC_EMUL.
4016 * Hard disc emulation: The image must begin with a master
4017 * boot record with a single image.
4018 * - ELTORITO_NO_EMUL.
4019 * No emulation. You should specify load segment and load size
4020 * of image.
4021 * @param catalog_path
4022 * The absolute path in the image tree where the catalog will be stored.
4023 * The directory component of this path must be a directory existent on
4024 * the image tree, and the filename component must be unique among all
4025 * children of that directory on image. Otherwise a correspodent error
4026 * code will be returned. This function will add an IsoBoot node that acts
4027 * as a placeholder for the real catalog, that will be generated at image
4028 * creation time.
4029 * @param boot
4030 * Location where a pointer to the added boot image will be stored. That
4031 * object is owned by the IsoImage and must not be freed by the user,
4032 * nor dereferenced once the last reference to the IsoImage was disposed
4033 * via iso_image_unref(). A NULL value is allowed if you don't need a
4034 * reference to the boot image.
4035 * @return
4036 * 1 on success, < 0 on error
4037 *
4038 * @since 0.6.2
4039 */
4040int iso_image_set_boot_image(IsoImage *image, const char *image_path,
4041 enum eltorito_boot_media_type type,
4042 const char *catalog_path,
4043 ElToritoBootImage **boot);
4044
4045/**
4046 * Add a further boot image to the set of El-Torito bootable images.
4047 * This set has already to be created by iso_image_set_boot_image().
4048 * Up to 31 further boot images may be added.
4049 *
4050 * @param image
4051 * The image to which the boot image shall be added.
4052 * returns an error and the image remains unmodified.
4053 * @param image_path
4054 * The absolute path of a IsoFile to be used as boot image or
4055 * --interval:appended_partition_$number[_start_$start_size_$size]:...
4056 * if type is ELTORITO_NO_EMUL. See iso_image_set_boot_image.
4057 * @param type
4058 * The boot media type. See iso_image_set_boot_image.
4059 * @param flag
4060 * Bitfield for control purposes. Unused yet. Submit 0.
4061 * @param boot
4062 * Location where a pointer to the added boot image will be stored.
4063 * See iso_image_set_boot_image
4064 * @return
4065 * 1 on success, < 0 on error
4066 * ISO_BOOT_NO_CATALOG means iso_image_set_boot_image()
4067 * was not called first.
4068 *
4069 * @since 0.6.32
4070 */
4071int iso_image_add_boot_image(IsoImage *image, const char *image_path,
4072 enum eltorito_boot_media_type type, int flag,
4073 ElToritoBootImage **boot);
4074
4075/**
4076 * Get the El-Torito boot catalog and the default boot image of an ISO image.
4077 *
4078 * This can be useful, for example, to check if a volume read from a previous
4079 * session or an existing image is bootable. It can also be useful to get
4080 * the image and catalog tree nodes. An application would want those, for
4081 * example, to prevent the user removing it.
4082 *
4083 * Both nodes are owned by libisofs and must not be freed. You can get your
4084 * own ref with iso_node_ref(). You can also check if the node is already
4085 * on the tree by getting its parent (note that when reading El-Torito info
4086 * from a previous image, the nodes might not be on the tree even if you haven't
4087 * removed them). Remember that you'll need to get a new ref
4088 * (with iso_node_ref()) before inserting them again to the tree, and probably
4089 * you will also need to set the name or permissions.
4090 *
4091 * @param image
4092 * The image from which to get the boot image.
4093 * @param boot
4094 * If not NULL, it will be filled with a pointer to the boot image, if
4095 * any. That object is owned by the IsoImage and must not be freed by
4096 * the user, nor dereferenced once the last reference to the IsoImage was
4097 * disposed via iso_image_unref().
4098 * @param imgnode
4099 * When not NULL, it will be filled with the image tree node. No extra ref
4100 * is added, you can use iso_node_ref() to get one if you need it.
4101 * The returned value is NULL if the boot image source is no IsoFile.
4102 * @param catnode
4103 * When not NULL, it will be filled with the catnode tree node. No extra
4104 * ref is added, you can use iso_node_ref() to get one if you need it.
4105 * @return
4106 * 1 on success, 0 is the image is not bootable (i.e., it has no El-Torito
4107 * image), < 0 error.
4108 *
4109 * @since 0.6.2
4110 */
4112 IsoFile **imgnode, IsoBoot **catnode);
4113
4114/**
4115 * Get detailed information about the boot catalog that was loaded from
4116 * an ISO image.
4117 * The boot catalog links the El Torito boot record at LBA 17 with the
4118 * boot images which are IsoFile objects in the image. The boot catalog
4119 * itself is not a regular file and thus will not deliver an IsoStream.
4120 * Its content is usually quite short and can be obtained by this call.
4121 *
4122 * @param image
4123 * The image to inquire.
4124 * @param catnode
4125 * Will return the boot catalog tree node. No extra ref is taken.
4126 * @param lba
4127 * Will return the block address of the boot catalog in the image.
4128 * @param content
4129 * Will return either NULL or an allocated memory buffer with the
4130 * content bytes of the boot catalog.
4131 * Dispose it by free() when no longer needed.
4132 * @param size
4133 * Will return the number of bytes in content.
4134 * @return
4135 * 1 if reply is valid, 0 if not boot catalog was loaded, < 0 on error.
4136 *
4137 * @since 1.1.2
4138 */
4139int iso_image_get_bootcat(IsoImage *image, IsoBoot **catnode, uint32_t *lba,
4140 char **content, off_t *size);
4141
4142
4143/**
4144 * Get all El-Torito boot images of an ISO image.
4145 *
4146 * The first of these boot images is the same as returned by
4147 * iso_image_get_boot_image(). The others are alternative boot images.
4148 *
4149 * @param image
4150 * The image from which to get the boot images.
4151 * @param num_boots
4152 * The number of available array elements in boots and bootnodes.
4153 * @param boots
4154 * Returns NULL or an allocated array of pointers to boot images.
4155 * Apply system call free(boots) to dispose it.
4156 * @param bootnodes
4157 * Returns NULL or an allocated array of pointers to the IsoFile nodes
4158 * which bear the content of the boot images in boots.
4159 * An array entry is NULL if the boot image source is no IsoFile.
4160
4161>>> Need getter for partition index
4162
4163 * @param flag
4164 * Bitfield for control purposes. Unused yet. Submit 0.
4165 * @return
4166 * 1 on success, 0 no El-Torito catalog and boot image attached,
4167 * < 0 error.
4168 *
4169 * @since 0.6.32
4170 */
4171int iso_image_get_all_boot_imgs(IsoImage *image, int *num_boots,
4172 ElToritoBootImage ***boots, IsoFile ***bootnodes, int flag);
4173
4174
4175/**
4176 * Removes all El-Torito boot images from the ISO image.
4177 *
4178 * The IsoBoot node that acts as placeholder for the catalog is also removed
4179 * for the image tree, if there.
4180 * If the image is not bootable (don't have el-torito boot image) this function
4181 * just returns.
4182 *
4183 * @since 0.6.2
4184 */
4186
4187/**
4188 * Sets the sort weight of the boot catalog that is attached to an IsoImage.
4189 *
4190 * For the meaning of sort weights see iso_node_set_sort_weight().
4191 * That function cannot be applied to the emerging boot catalog because
4192 * it is not represented by an IsoFile.
4193 *
4194 * @param image
4195 * The image to manipulate.
4196 * @param sort_weight
4197 * The larger this value, the lower will be the block address of the
4198 * boot catalog record.
4199 * @return
4200 * 0= no boot catalog attached , 1= ok , <0 = error
4201 *
4202 * @since 0.6.32
4203 */
4204int iso_image_set_boot_catalog_weight(IsoImage *image, int sort_weight);
4205
4206/**
4207 * Hides the boot catalog file from directory trees.
4208 *
4209 * For the meaning of hiding files see iso_node_set_hidden().
4210 *
4211 *
4212 * @param image
4213 * The image to manipulate.
4214 * @param hide_attrs
4215 * Or-combination of values from enum IsoHideNodeFlag to set the trees
4216 * in which the record.
4217 * @return
4218 * 0= no boot catalog attached , 1= ok , <0 = error
4219 *
4220 * @since 0.6.34
4221 */
4223
4224
4225/**
4226 * Get the boot media type as of parameter "type" of iso_image_set_boot_image()
4227 * or iso_image_add_boot_image().
4228 *
4229 * @param bootimg
4230 * The image to inquire
4231 * @param media_type
4232 * Returns the media type
4233 * @return
4234 * 1 = ok , < 0 = error
4235 *
4236 * @since 0.6.32
4237 */
4239 enum eltorito_boot_media_type *media_type);
4240
4241/**
4242 * Sets the platform ID of the boot image.
4243 *
4244 * The Platform ID gets written into the boot catalog at byte 1 of the
4245 * Validation Entry, or at byte 1 of a Section Header Entry.
4246 * If Platform ID and ID String of two consecutive bootimages are the same
4247 *
4248 * @param bootimg
4249 * The image to manipulate.
4250 * @param id
4251 * A Platform ID as of
4252 * El Torito 1.0 : 0x00= 80x86, 0x01= PowerPC, 0x02= Mac
4253 * Others : 0xef= EFI
4254 * @return
4255 * 1 ok , <=0 error
4256 *
4257 * @since 0.6.32
4258 */
4260
4261/**
4262 * Get the platform ID value. See el_torito_set_boot_platform_id().
4263 *
4264 * @param bootimg
4265 * The image to inquire
4266 * @return
4267 * 0 - 255 : The platform ID
4268 * < 0 : error
4269 *
4270 * @since 0.6.32
4271 */
4273
4274/**
4275 * Sets the load segment for the initial boot image. This is only for
4276 * no emulation boot images, and is a NOP for other image types.
4277 *
4278 * @param bootimg
4279 * The image to to manipulate
4280 * @param segment
4281 * Load segment address.
4282 * The data type of this parameter is not fully suitable. You may submit
4283 * negative numbers in the range ((short) 0x8000) to ((short) 0xffff)
4284 * in order to express the non-negative numbers 0x8000 to 0xffff.
4285 *
4286 * @since 0.6.2
4287 */
4288void el_torito_set_load_seg(ElToritoBootImage *bootimg, short segment);
4289
4290/**
4291 * Get the load segment value. See el_torito_set_load_seg().
4292 *
4293 * @param bootimg
4294 * The image to inquire
4295 * @return
4296 * 0 - 65535 : The load segment value
4297 * < 0 : error
4298 *
4299 * @since 0.6.32
4300 */
4302
4303/**
4304 * Sets the number of sectors (512b) to be load at load segment during
4305 * the initial boot procedure. This is only for
4306 * no emulation boot images, and is a NOP for other image types.
4307 *
4308 * @param bootimg
4309 * The image to to manipulate
4310 * @param sectors
4311 * Number of 512-byte blocks to be loaded by the BIOS.
4312 * The data type of this parameter is not fully suitable. You may submit
4313 * negative numbers in the range ((short) 0x8000) to ((short) 0xffff)
4314 * in order to express the non-negative numbers 0x8000 to 0xffff.
4315 *
4316 * @since 0.6.2
4317 */
4318void el_torito_set_load_size(ElToritoBootImage *bootimg, short sectors);
4319
4320/**
4321 * Get the load size. See el_torito_set_load_size().
4322 *
4323 * @param bootimg
4324 * The image to inquire
4325 * @return
4326 * 0 - 65535 : The load size value
4327 * < 0 : error
4328 *
4329 * @since 0.6.32
4330 */
4332
4333/**
4334 * State that the load size shall be the size of the boot image automatically.
4335 * This overrides el_torito_set_load_size().
4336 * @param bootimg
4337 * The image to to manipulate
4338 * @param mode
4339 * 0= use value of el_torito_set_load_size()
4340 * 1= determine value from boot image
4341 */
4343
4344/**
4345 * Inquire the setting of el_torito_set_full_load().
4346 * @param bootimg
4347 * The image to inquire
4348 * @return
4349 * The mode set with el_torito_set_full_load().
4350 */
4352
4353/**
4354 * Marks the specified boot image as not bootable
4355 *
4356 * @since 0.6.2
4357 */
4359
4360/**
4361 * Get the bootability flag. See el_torito_set_no_bootable().
4362 *
4363 * @param bootimg
4364 * The image to inquire
4365 * @return
4366 * 0 = not bootable, 1 = bootable , <0 = error
4367 *
4368 * @since 0.6.32
4369 */
4371
4372/**
4373 * Set the id_string of the Validation Entry or Sector Header Entry which
4374 * will govern the boot image Section Entry in the El Torito Catalog.
4375 *
4376 * @param bootimg
4377 * The image to manipulate.
4378 * @param id_string
4379 * The first boot image puts 24 bytes of ID string into the Validation
4380 * Entry, where they shall "identify the manufacturer/developer of
4381 * the CD-ROM".
4382 * Further boot images put 28 bytes into their Section Header.
4383 * El Torito 1.0 states that "If the BIOS understands the ID string, it
4384 * may choose to boot the system using one of these entries in place
4385 * of the INITIAL/DEFAULT entry." (The INITIAL/DEFAULT entry points to the
4386 * first boot image.)
4387 * @return
4388 * 1 = ok , <0 = error
4389 *
4390 * @since 0.6.32
4391 */
4392int el_torito_set_id_string(ElToritoBootImage *bootimg, uint8_t id_string[28]);
4393
4394/**
4395 * Get the id_string as of el_torito_set_id_string().
4396 *
4397 * @param bootimg
4398 * The image to inquire
4399 * @param id_string
4400 * Returns 28 bytes of id string
4401 * @return
4402 * 1 = ok , <0 = error
4403 *
4404 * @since 0.6.32
4405 */
4406int el_torito_get_id_string(ElToritoBootImage *bootimg, uint8_t id_string[28]);
4407
4408/**
4409 * Set the Selection Criteria of a boot image.
4410 *
4411 * @param bootimg
4412 * The image to manipulate.
4413 * @param crit
4414 * The first boot image has no selection criteria. They will be ignored.
4415 * Further boot images put 1 byte of Selection Criteria Type and 19
4416 * bytes of data into their Section Entry.
4417 * El Torito 1.0 states that "The format of the selection criteria is
4418 * a function of the BIOS vendor. In the case of a foreign language
4419 * BIOS three bytes would be used to identify the language".
4420 * Type byte == 0 means "no criteria",
4421 * type byte == 1 means "Language and Version Information (IBM)".
4422 * @return
4423 * 1 = ok , <0 = error
4424 *
4425 * @since 0.6.32
4426 */
4427int el_torito_set_selection_crit(ElToritoBootImage *bootimg, uint8_t crit[20]);
4428
4429/**
4430 * Get the Selection Criteria bytes as of el_torito_set_selection_crit().
4431 *
4432 * @param bootimg
4433 * The image to inquire
4434 * @param crit
4435 * Returns 20 bytes of type and data
4436 * @return
4437 * 1 = ok , <0 = error
4438 *
4439 * @since 0.6.32
4440 */
4441int el_torito_get_selection_crit(ElToritoBootImage *bootimg, uint8_t crit[20]);
4442
4443
4444/**
4445 * Makes a guess whether the boot image was patched by a boot information
4446 * table. It is advisable to patch such boot images if their content gets
4447 * copied to a new location. See el_torito_set_isolinux_options().
4448 * Note: The reply can be positive only if the boot image was imported
4449 * from an existing ISO image.
4450 *
4451 * @param bootimg
4452 * The image to inquire
4453 * @param flag
4454 * Bitfield for control purposes:
4455 * bit0 - bit3= mode
4456 * 0 = inquire for classic boot info table as described in man mkisofs
4457 * @since 0.6.32
4458 * 1 = inquire for GRUB2 boot info as of bit9 of options of
4459 * el_torito_set_isolinux_options()
4460 * @since 1.3.0
4461 * @return
4462 * 1 = seems to contain the inquired boot info, 0 = quite surely not
4463 * @since 0.6.32
4464 */
4466
4467/**
4468 * Specifies options for ISOLINUX or GRUB boot images. This should only be used
4469 * if the type of boot image is known.
4470 *
4471 * @param bootimg
4472 * The image to set options on
4473 * @param options
4474 * bitmask style flag. The following values are defined:
4475 *
4476 * bit0= Patch the boot info table of the boot image.
4477 * This does the same as mkisofs option -boot-info-table.
4478 * Needed for ISOLINUX or GRUB boot images with platform ID 0.
4479 * The table is located at byte 8 of the boot image file.
4480 * Its size is 56 bytes.
4481 * The original boot image file on disk will not be modified.
4482 *
4483 * One may use el_torito_seems_boot_info_table() for a
4484 * qualified guess whether a boot info table is present in
4485 * the boot image. If the result is 1 then it should get bit0
4486 * set if its content gets copied to a new LBA.
4487 *
4488 * bit1= Generate a ISOLINUX isohybrid image with MBR.
4489 * ----------------------------------------------------------
4490 * @deprecated since 31 Mar 2010:
4491 * The author of syslinux, H. Peter Anvin requested that this
4492 * feature shall not be used any more. He intends to cease
4493 * support for the MBR template that is included in libisofs.
4494 * ----------------------------------------------------------
4495 * A hybrid image is a boot image that boots from either
4496 * CD/DVD media or from disk-like media, e.g. USB stick.
4497 * For that you need isolinux.bin from SYSLINUX 3.72 or later.
4498 * IMPORTANT: The application has to take care that the image
4499 * on media gets padded up to the next full MB.
4500 * Under seiveral circumstances it might get aligned
4501 * automatically. But there is no warranty.
4502 * bit2-7= Mentioning in isohybrid GPT
4503 * 0= Do not mention in GPT
4504 * 1= Mention as Basic Data partition.
4505 * This cannot be combined with GPT partitions as of
4506 * iso_write_opts_set_efi_bootp()
4507 * @since 1.2.4
4508 * 2= Mention as HFS+ partition.
4509 * This cannot be combined with HFS+ production by
4510 * iso_write_opts_set_hfsplus().
4511 * @since 1.2.4
4512 * Primary GPT and backup GPT get written if at least one
4513 * ElToritoBootImage shall be mentioned.
4514 * The first three mentioned GPT partitions get mirrored in the
4515 * the partition table of the isohybrid MBR. They get type 0xfe.
4516 * The MBR partition entry for PC-BIOS gets type 0x00 rather
4517 * than 0x17.
4518 * Often it is one of the further MBR partitions which actually
4519 * gets used by EFI.
4520 * @since 1.2.4
4521 * bit8= Mention in isohybrid Apple partition map
4522 * APM get written if at least one ElToritoBootImage shall be
4523 * mentioned. The ISOLINUX MBR must look suitable or else an error
4524 * event will happen at image generation time.
4525 * @since 1.2.4
4526 * bit9= GRUB2 boot info
4527 * Patch the boot image file at byte 1012 with the 512-block
4528 * address + 2. Two little endian 32-bit words. Low word first.
4529 * This is combinable with bit0.
4530 * @since 1.3.0
4531 * @param flag
4532 * Reserved for future usage, set to 0.
4533 * @return
4534 * 1 success, < 0 on error
4535 * @since 0.6.12
4536 */
4538 int options, int flag);
4539
4540/**
4541 * Get the options as of el_torito_set_isolinux_options().
4542 *
4543 * @param bootimg
4544 * The image to inquire
4545 * @param flag
4546 * Reserved for future usage, set to 0.
4547 * @return
4548 * >= 0 returned option bits , <0 = error
4549 *
4550 * @since 0.6.32
4551 */
4553
4554/** Deprecated:
4555 * Specifies that this image needs to be patched. This involves the writing
4556 * of a 16 bytes boot information table at offset 8 of the boot image file.
4557 * The original boot image file won't be modified.
4558 * This is needed for isolinux boot images.
4559 *
4560 * @since 0.6.2
4561 * @deprecated Use el_torito_set_isolinux_options() instead
4562 */
4564
4565/**
4566 * Obtain a copy of the possibly loaded first 32768 bytes of the imported
4567 * session, the System Area.
4568 * It will be written to the start of the next session unless it gets
4569 * overwritten by iso_write_opts_set_system_area().
4570 *
4571 * @param img
4572 * The image to be inquired.
4573 * @param data
4574 * A byte array of at least 32768 bytes to take the loaded bytes.
4575 * @param options
4576 * The option bits which will be applied if not overridden by
4577 * iso_write_opts_set_system_area(). See there.
4578 * @param flag
4579 * Bitfield for control purposes, unused yet, submit 0
4580 * @return
4581 * 1 on success, 0 if no System Area was loaded, < 0 error.
4582 * @since 0.6.30
4583 */
4584int iso_image_get_system_area(IsoImage *img, char data[32768],
4585 int *options, int flag);
4586
4587/**
4588 * The maximum length of a single line in the output of function
4589 * iso_image_report_system_area() and iso_image_report_el_torito().
4590 * This number includes the trailing 0.
4591 * @since 1.3.8
4592 */
4593#define ISO_MAX_SYSAREA_LINE_LENGTH 4096
4594
4595/**
4596 * Texts which describe the output format of iso_image_report_system_area().
4597 * They are publicly defined here only as part of the API description.
4598 * Do not use these macros in your application but rather call
4599 * iso_image_report_system_area() with flag bit0.
4600 */
4601#define ISO_SYSAREA_REPORT_DOC \
4602\
4603"Report format for recognized System Area data.", \
4604"", \
4605"No text will be reported if no System Area was loaded or if it was", \
4606"entirely filled with 0-bytes.", \
4607"Else there will be at least these three lines:", \
4608" System area options: hex", \
4609" see libisofs.h, parameter of iso_write_opts_set_system_area().", \
4610" System area summary: word ... word", \
4611" human readable interpretation of system area options and other info", \
4612" The words are from the set:", \
4613" { MBR, CHRP, PReP, GPT, APM, MIPS-Big-Endian, MIPS-Little-Endian,", \
4614" SUN-SPARC-Disk-Label, HP-PA-PALO, DEC-Alpha, ", \
4615" protective-msdos-label, isohybrid, grub2-mbr,", \
4616" cyl-align-{auto,on,off,all}, not-recognized, }", \
4617" The acronyms indicate boot data for particular hardware/firmware.", \
4618" protective-msdos-label is an MBR conformant to specs of GPT.", \
4619" isohybrid is an MBR implementing ISOLINUX isohybrid functionality.", \
4620" grub2-mbr is an MBR with GRUB2 64 bit address patching.", \
4621" cyl-align-on indicates that the ISO image MBR partition ends at a", \
4622" cylinder boundary. cyl-align-all means that more MBR partitions", \
4623" exist and all end at a cylinder boundary.", \
4624" not-recognized tells about unrecognized non-zero system area data.", \
4625" ISO image size/512 : decimal", \
4626" size of ISO image in block units of 512 bytes.", \
4627""
4628#define ISO_SYSAREA_REPORT_DOC_MBR \
4629\
4630"If an MBR is detected, with at least one partition entry of non-zero size,", \
4631"then there may be:", \
4632" Partition offset : decimal", \
4633" if not 0 then a second ISO 9660 superblock was found to which", \
4634" MBR partition 1 or GPT partition 1 is pointing.", \
4635" MBR heads per cyl : decimal", \
4636" conversion factor between MBR C/H/S address and LBA. 0=inconsistent.", \
4637" MBR secs per head : decimal", \
4638" conversion factor between MBR C/H/S address and LBA. 0=inconsistent.", \
4639" MBR partition table: N Status Type Start Blocks", \
4640" headline for MBR partition table.", \
4641" MBR partition : X hex hex decimal decimal", \
4642" gives partition number, status byte, type byte, start block,", \
4643" and number of blocks. 512 bytes per block.", \
4644" MBR partition path : X path", \
4645" the path of a file in the ISO image which began at the start block", \
4646" of partition X when the ISO filesystem was imported.", \
4647" PReP boot partition: decimal decimal", \
4648" gives start block and size of a PReP boot partition in ISO 9660", \
4649" block units of 2048 bytes.", \
4650""
4651#define ISO_SYSAREA_REPORT_DOC_GPT1 \
4652\
4653"GUID Partition Table can coexist with MBR:", \
4654" GPT : N Info", \
4655" headline for GPT partition table. The fields are too wide for a", \
4656" neat table. So they are listed with a partition number and a text.", \
4657" GPT CRC should be : <hex> to match first 92 GPT header block bytes", \
4658" GPT CRC found : <hex> matches all 512 bytes of GPT header block", \
4659" libisofs-1.2.4 to 1.2.8 had a bug with the GPT header CRC. So", \
4660" libisofs is willing to recognize GPT with the buggy CRC. These", \
4661" two lines inform that most partition editors will not accept it.", \
4662" GPT array CRC wrong: should be <hex>, found <hex>", \
4663" GPT entry arrays are accepted even if their CRC does not match.", \
4664" In this case, both CRCs are reported by this line.", \
4665" GPT backup problems: text", \
4666" reports about inconsistencies between main GPT and backup GPT.", \
4667" The statements are comma separated:", \
4668" Implausible header LBA <decimal>", \
4669" Cannot read header block at 2k LBA <decimal>", \
4670" Not a GPT 1.0 header of 92 bytes for 128 bytes per entry", \
4671" Head CRC <hex> wrong. Should be <hex>", \
4672" Head CRC <hex> wrong. Should be <hex>. Matches all 512 block bytes", \
4673" Disk GUID differs (<hex_digits>)", \
4674" Cannot read array block at 2k LBA <decimal>", \
4675" Array CRC <hex> wrong. Should be <hex>", \
4676" Entries differ for partitions <decimal> [... <decimal>]", \
4677" GPT disk GUID : hex_digits", \
4678" 32 hex digits giving the byte string of the disk's GUID", \
4679" GPT entry array : decimal decimal word", \
4680" start block of partition entry array and number of entries. 512 bytes", \
4681" per block. The word may be \"separated\" if partitions are disjoint,", \
4682" \"overlapping\" if they are not. In future there may be \"nested\"", \
4683" as special case where all overlapping partitions are superset and", \
4684" subset, and \"covering\" as special case of disjoint partitions", \
4685" covering the whole GPT block range for partitions.", \
4686" GPT lba range : decimal decimal decimal", \
4687" addresses of first payload block, last payload block, and of the", \
4688" GPT backup header block. 512 bytes per block." \
4689
4690#define ISO_SYSAREA_REPORT_DOC_GPT2 \
4691\
4692" GPT partition name : X hex_digits", \
4693" up to 144 hex digits giving the UTF-16LE name byte string of", \
4694" partition X. Trailing 16 bit 0-characters are omitted.", \
4695" GPT partname local : X text", \
4696" the name of partition X converted to the local character set.", \
4697" This line may be missing if the name cannot be converted, or is", \
4698" empty.", \
4699" GPT partition GUID : X hex_digits", \
4700" 32 hex digits giving the byte string of the GUID of partition X.", \
4701" GPT type GUID : X hex_digits", \
4702" 32 hex digits giving the byte string of the type GUID of partition X.", \
4703" GPT partition flags: X hex", \
4704" 64 flag bits of partition X in hex representation.", \
4705" Known bit meanings are:", \
4706" bit0 = \"System Partition\" Do not alter.", \
4707" bit2 = Legacy BIOS bootable (MBR partition type 0x80)", \
4708" bit60= read-only", \
4709" GPT start and size : X decimal decimal", \
4710" start block and number of blocks of partition X. 512 bytes per block.", \
4711" GPT partition path : X path", \
4712" the path of a file in the ISO image which began at the start block", \
4713" of partition X when the ISO filesystem was imported.", \
4714""
4715#define ISO_SYSAREA_REPORT_DOC_APM \
4716\
4717"Apple partition map can coexist with MBR and GPT:", \
4718" APM : N Info", \
4719" headline for human readers.", \
4720" APM block size : decimal", \
4721" block size of Apple Partition Map. 512 or 2048. This applies to", \
4722" start address and size of all partitions in the APM.", \
4723" APM gap fillers : decimal", \
4724" tells the number of partitions with name \"Gap[0-9[0-9]]\" and type", \
4725" \"ISO9660_data\".", \
4726" APM partition name : X text", \
4727" the name of partition X. Up to 32 characters.", \
4728" APM partition type : X text", \
4729" the type string of partition X. Up to 32 characters.", \
4730" APM start and size : X decimal decimal", \
4731" start block and number of blocks of partition X.", \
4732" APM partition path : X path", \
4733" the path of a file in the ISO image which began at the start block", \
4734" of partition X when the ISO filesystem was imported.", \
4735""
4736#define ISO_SYSAREA_REPORT_DOC_MIPS \
4737\
4738"If a MIPS Big Endian Volume Header is detected, there may be:", \
4739" MIPS-BE volume dir : N Name Block Bytes", \
4740" headline for human readers.", \
4741" MIPS-BE boot entry : X upto8chr decimal decimal", \
4742" tells name, 512-byte block address, and byte count of boot entry X.", \
4743" MIPS-BE boot path : X path", \
4744" tells the path to the boot image file in the ISO image which began", \
4745" at the block address given by boot entry X when the ISO filesystem", \
4746" was imported.", \
4747"", \
4748"If a DEC Boot Block for MIPS Little Endian is detected, there may be:", \
4749" MIPS-LE boot map : LoadAddr ExecAddr SegmentSize SegmentStart", \
4750" headline for human readers.", \
4751" MIPS-LE boot params: decimal decimal decimal decimal", \
4752" tells four numbers which are originally derived from the ELF header", \
4753" of the boot file. The first two are counted in bytes, the other two", \
4754" are counted in blocks of 512 bytes.", \
4755" MIPS-LE boot path : path", \
4756" tells the path to the boot image file in the ISO image which began", \
4757" at the block address given by SegmentStart when the ISO filesystem", \
4758" was imported.", \
4759" MIPS-LE elf offset : decimal", \
4760" tells the relative 512-byte block offset inside the boot file:", \
4761" SegmentStart - FileStartBlock", \
4762""
4763#define ISO_SYSAREA_REPORT_DOC_SUN \
4764\
4765"If a SUN SPARC Disk Label is present:", \
4766" SUN SPARC disklabel: text", \
4767" tells the disk label text.", \
4768" SUN SPARC secs/head: decimal", \
4769" tells the number of sectors per head.", \
4770" SUN SPARC heads/cyl: decimal", \
4771" tells the number of heads per cylinder.", \
4772" SUN SPARC partmap : N IdTag Perms StartCyl NumBlock", \
4773" headline for human readers.", \
4774" SUN SPARC partition: X hex hex decimal decimal", \
4775" gives partition number, type word, permission word, start cylinder,", \
4776" and number of of blocks. 512 bytes per block. Type word may be: ", \
4777" 0=unused, 2=root partition with boot, 4=user partition.", \
4778" Permission word is 0x10 = read-only.", \
4779" SPARC GRUB2 core : decimal decimal", \
4780" tells byte address and byte count of the GRUB2 SPARC core file.", \
4781" SPARC GRUB2 path : path", \
4782" tells the path to the data file in the ISO image which began at the", \
4783" address given by core when the ISO filesystem was imported.", \
4784""
4785#define ISO_SYSAREA_REPORT_DOC_HPPA \
4786\
4787"If a HP-PA PALO boot sector version 4 or 5 is present:", \
4788" PALO header version: decimal", \
4789" tells the PALO header version: 4 or 5.", \
4790" HP-PA cmdline : text", \
4791" tells the command line for the kernels.", \
4792" HP-PA boot files : ByteAddr ByteSize Path", \
4793" headline for human readers.", \
4794" HP-PA 32-bit kernel: decimal decimal path", \
4795" tells start byte and byte count of the 32-bit kernel and the path", \
4796" to the data file in the ISO image which began at the start byte", \
4797" when the ISO filesystem was imported.", \
4798" HP-PA 64-bit kernel: decimal decimal path", \
4799" tells the same for the 64-bit kernel.", \
4800" HP-PA ramdisk : decimal decimal path", \
4801" tells the same for the ramdisk file.", \
4802" HP-PA bootloader : decimal decimal path", \
4803" tells the same for the bootloader file.", \
4804""
4805#define ISO_SYSAREA_REPORT_DOC_ALPHA \
4806"If a DEC Alpha SRM boot sector is present:", \
4807" DEC Alpha ldr size : decimal", \
4808" tells the number of 512-byte blocks in DEC Alpha Secondary Bootstrap", \
4809" Loader file.", \
4810" DEC Alpha ldr adr : decimal", \
4811" tells the start of the loader file in units of 512-byte blocks.", \
4812" DEC Alpha ldr path : path", \
4813" tells the path to a file in the ISO image which began at the", \
4814" loader start address when the ISO filesystem was imported."
4815
4816/**
4817 * Obtain an array of texts describing the detected properties of the
4818 * possibly loaded System Area.
4819 * The array will be NULL if no System Area was loaded. It will be non-NULL
4820 * with zero line count if the System Area was loaded and contains only
4821 * 0-bytes.
4822 * Else it will consist of lines as described in ISO_SYSAREA_REPORT_DOC above.
4823 *
4824 * File paths and other long texts are reported as "(too long to show here)"
4825 * if their length plus preceding text plus trailing 0-byte exceeds the
4826 * line length limit of ISO_MAX_SYSAREA_LINE_LENGTH bytes.
4827 * Texts which may contain whitespace or unprintable characters will start
4828 * at fixed positions and extend to the end of the line.
4829 * Note that newline characters may well appearing in the middle of a "line".
4830 *
4831 * @param image
4832 * The image to be inquired.
4833 * @param reply
4834 * Will return an array of pointers to the result text lines or NULL.
4835 * Dispose a non-NULL reply by a call to iso_image_report_system_area()
4836 * with flag bit15, when no longer needed.
4837 * Be prepared for a long text with up to ISO_MAX_SYSAREA_LINE_LENGTH
4838 * characters per line.
4839 * @param line_count
4840 * Will return the number of valid pointers in reply.
4841 * @param flag
4842 * Bitfield for control purposes
4843 * bit0= do not report system area but rather reply a copy of
4844 * above text line arrays ISO_SYSAREA_REPORT_DOC*.
4845 * With this bit it is permissible to submit image as NULL.
4846 * bit15= dispose result from previous call.
4847 * @return
4848 * 1 on success, 0 if no System Area was loaded, < 0 error.
4849 * @since 1.3.8
4850 */
4852 char ***reply, int *line_count, int flag);
4853
4854/**
4855 * Text which describes the output format of iso_image_report_el_torito().
4856 * It is publicly defined here only as part of the API description.
4857 * Do not use it as macro in your application but rather call
4858 * iso_image_report_el_torito() with flag bit0.
4859 */
4860#define ISO_ELTORITO_REPORT_DOC \
4861"Report format for recognized El Torito boot information.", \
4862"", \
4863"No text will be reported if no El Torito information was found.", \
4864"Else there will be at least these three lines", \
4865" El Torito catalog : decimal decimal", \
4866" tells the block address and number of 2048-blocks of the boot catalog.", \
4867" El Torito images : N Pltf B Emul Ld_seg Hdpt Ldsiz LBA", \
4868" is the headline of the boot image list.", \
4869" El Torito boot img : X word char word hex hex decimal decimal", \
4870" tells about boot image number X:", \
4871" - Platform Id: \"BIOS\", \"PPC\", \"Mac\", \"UEFI\" or a hex number.", \
4872" - Bootability: either \"y\" or \"n\".", \
4873" - Emulation: \"none\", \"fd1.2\", \"fd1.4\", \"fd2.8\", \"hd\"", \
4874" for no emulation, three floppy MB sizes, hard disk.", \
4875" - Load Segment: start offset in boot image. 0x0000 means 0x07c0.", \
4876" - Hard disk emulation partition type: MBR partition type code.", \
4877" - Load size: number of 512-blocks to load with emulation mode \"none\".", \
4878" - LBA: start block number in ISO filesystem (2048-block).", \
4879"", \
4880"The following lines appear conditionally:", \
4881" El Torito cat path : iso_rr_path", \
4882" tells the path to the data file in the ISO image which began at the", \
4883" block address where the boot catalog starts when the ISO filesystem", \
4884" was imported.", \
4885" (This line is not reported if no path points to that block.)", \
4886" El Torito img path : X iso_rr_path", \
4887" tells the path to the data file in the ISO image which began at the", \
4888" LBA of boot image X when the ISO filesystem was imported.", \
4889" (This line is not reported if no path points to that block.)", \
4890" El Torito img opts : X word ... word", \
4891" tells the presence of extra features:", \
4892" \"boot-info-table\" image got boot info table patching.", \
4893" \"isohybrid-suitable\" image is suitable for ISOLINUX isohybrid MBR.", \
4894" \"grub2-boot-info\" image got GRUB2 boot info patching.", \
4895" (This line is not reported if no such options were detected.)", \
4896" El Torito id string: X hex_digits", \
4897" tells the id string of the catalog section which hosts boot image X.", \
4898" (This line is not reported if the id string is all zero.)", \
4899" El Torito sel crit : X hex_digits", \
4900" tells the selection criterion of boot image X.", \
4901" (This line is not reported if the criterion is all zero.)", \
4902" El Torito img blks : X decimal", \
4903" gives an upper limit of the number of 2048-blocks in the boot image", \
4904" if it is not accessible via a path in the ISO directory tree.", \
4905" The boot image is supposed to end before the start block of any", \
4906" other entity of the ISO filesystem.", \
4907" (This line is not reported if no limiting entity is found.)", \
4908" El Torito hdsiz/512: X decimal", \
4909" gives with a boot image of emulation type \"hd\" the lowest block", \
4910" number which is above any partition end in the boot image's MBR", \
4911" partition table. This can be considered the claimed size of the", \
4912" emulated hard disk given in blocks of 512 bytes.", \
4913" (This line is not reported if no partition is found in the image.)", \
4914""
4915
4916/**
4917 * Obtain an array of texts describing the detected properties of the
4918 * possibly loaded El Torito boot information.
4919 * The array will be NULL if no El Torito info was loaded.
4920 * Else it will consist of lines as described in ISO_ELTORITO_REPORT_DOC above.
4921 *
4922 * The lines have the same length restrictions and whitespace rules as the ones
4923 * returned by iso_image_report_system_area().
4924 *
4925 * @param image
4926 * The image to be inquired.
4927 * @param reply
4928 * Will return an array of pointers to the result text lines or NULL.
4929 * Dispose a non-NULL reply by a call to iso_image_report_el_torito()
4930 * with flag bit15, when no longer needed.
4931 * Be prepared for a long text with up to ISO_MAX_SYSAREA_LINE_LENGTH
4932 * characters per line.
4933 * @param line_count
4934 * Will return the number of valid pointers in reply.
4935 * @param flag
4936 * Bitfield for control purposes
4937 * bit0= do not report system area but rather reply a copy of
4938 * above text line array ISO_ELTORITO_REPORT_DOC.
4939 * With this bit it is permissible to submit image as NULL.
4940 * bit15= dispose result from previous call.
4941 * @return
4942 * 1 on success, 0 if no El Torito information was loaded, < 0 error.
4943 * @since 1.3.8
4944 */
4946 char ***reply, int *line_count, int flag);
4947
4948
4949/**
4950 * Compute a CRC number as expected in the GPT main and backup header blocks.
4951 *
4952 * The CRC at byte offset 88 is supposed to cover the array of partition
4953 * entries.
4954 * The CRC at byte offset 16 is supposed to cover the readily produced
4955 * first 92 bytes of the header block while its bytes 16 to 19 are still
4956 * set to 0.
4957 * Block size is 512 bytes. Numbers are stored little-endian.
4958 * See doc/boot_sectors.txt for the byte layout of GPT.
4959 *
4960 * This might be helpful for applications which want to manipulate GPT
4961 * directly. The function is in libisofs/system_area.c and self-contained.
4962 * So if you want to copy+paste it under the license of that file: Be invited.
4963 * Be warned that this implementation works bit-wise and thus is much slower
4964 * than table-driven ones. For less than 32 KiB, it fully suffices, though.
4965 *
4966 * @param data
4967 * The memory buffer with the data to sum up.
4968 * @param count
4969 * Number of bytes in data.
4970 * @param flag
4971 * Bitfield for control purposes. Submit 0.
4972 * @return
4973 * The CRC of data.
4974 * @since 1.3.8
4975 */
4976uint32_t iso_crc32_gpt(unsigned char *data, int count, int flag);
4977
4978/**
4979 * Add a MIPS boot file path to the image.
4980 * Up to 15 such files can be written into a MIPS Big Endian Volume Header
4981 * if this is enabled by value 1 in iso_write_opts_set_system_area() option
4982 * bits 2 to 7.
4983 * A single file can be written into a DEC Boot Block if this is enabled by
4984 * value 2 in iso_write_opts_set_system_area() option bits 2 to 7. So only
4985 * the first added file gets into effect with this system area type.
4986 * The data files which shall serve as MIPS boot files have to be brought into
4987 * the image by the normal means.
4988 * @param image
4989 * The image to be manipulated.
4990 * @param path
4991 * Absolute path of the boot file in the ISO 9660 Rock Ridge tree.
4992 * @param flag
4993 * Bitfield for control purposes, unused yet, submit 0
4994 * @return
4995 * 1 on success, < 0 error
4996 * @since 0.6.38
4997 */
4998int iso_image_add_mips_boot_file(IsoImage *image, char *path, int flag);
4999
5000/**
5001 * Obtain the number of added MIPS Big Endian boot files and pointers to
5002 * their paths in the ISO 9660 Rock Ridge tree.
5003 * @param image
5004 * The image to be inquired.
5005 * @param paths
5006 * An array of pointers to be set to the registered boot file paths.
5007 * This are just pointers to data inside IsoImage. Do not free() them.
5008 * Make own copies of the data before manipulating the image.
5009 * @param flag
5010 * Bitfield for control purposes, unused yet, submit 0
5011 * @return
5012 * >= 0 is the number of valid path pointers , <0 means error
5013 * @since 0.6.38
5014 */
5015int iso_image_get_mips_boot_files(IsoImage *image, char *paths[15], int flag);
5016
5017/**
5018 * Clear the list of MIPS Big Endian boot file paths.
5019 * @param image
5020 * The image to be manipulated.
5021 * @param flag
5022 * Bitfield for control purposes, unused yet, submit 0
5023 * @return
5024 * 1 is success , <0 means error
5025 * @since 0.6.38
5026 */
5028
5029/**
5030 * Designate a data file in the ISO image of which the position and size
5031 * shall be written after the SUN Disk Label. The position is written as
5032 * 64-bit big-endian number to byte position 0x228. The size is written
5033 * as 32-bit big-endian to 0x230.
5034 * This setting has an effect only if system area type is set to 3
5035 * with iso_write_opts_set_system_area().
5036 *
5037 * @param img
5038 * The image to be manipulated.
5039 * @param sparc_core
5040 * The IsoFile which shall be mentioned after the SUN Disk label.
5041 * NULL is a permissible value. It disables this feature.
5042 * @param flag
5043 * Bitfield for control purposes, unused yet, submit 0
5044 * @return
5045 * 1 is success , <0 means error
5046 * @since 1.3.0
5047 */
5048int iso_image_set_sparc_core(IsoImage *img, IsoFile *sparc_core, int flag);
5049
5050/**
5051 * Obtain the current setting of iso_image_set_sparc_core().
5052 *
5053 * @param img
5054 * The image to be inquired.
5055 * @param sparc_core
5056 * Will return a pointer to the IsoFile (or NULL, which is not an error)
5057 * @param flag
5058 * Bitfield for control purposes, unused yet, submit 0
5059 * @return
5060 * 1 is success , <0 means error
5061 * @since 1.3.0
5062 */
5063int iso_image_get_sparc_core(IsoImage *img, IsoFile **sparc_core, int flag);
5064
5065/**
5066 * Define a command line and submit the paths of four mandatory files for
5067 * production of a HP-PA PALO boot sector for PA-RISC machines.
5068 * The paths must lead to already existing data files in the ISO image
5069 * which stay with these paths until image production.
5070 *
5071 * @param img
5072 * The image to be manipulated.
5073 * @param cmdline
5074 * Up to 127 characters of command line.
5075 * @param bootloader
5076 * Absolute path of a data file in the ISO image.
5077 * @param kernel_32
5078 * Absolute path of a data file in the ISO image which serves as
5079 * 32 bit kernel.
5080 * @param kernel_64
5081 * Absolute path of a data file in the ISO image which serves as
5082 * 64 bit kernel.
5083 * @param ramdisk
5084 * Absolute path of a data file in the ISO image.
5085 * @param flag
5086 * Bitfield for control purposes
5087 * bit0= Let NULL parameters free the corresponding image properties.
5088 * Else only the non-NULL parameters of this call have an effect
5089 * @return
5090 * 1 is success , <0 means error
5091 * @since 1.3.8
5092 */
5093int iso_image_set_hppa_palo(IsoImage *img, char *cmdline, char *bootloader,
5094 char *kernel_32, char *kernel_64, char *ramdisk,
5095 int flag);
5096
5097/**
5098 * Inquire the current settings of iso_image_set_hppa_palo().
5099 * Do not free() the returned pointers.
5100 *
5101 * @param img
5102 * The image to be inquired.
5103 * @param cmdline
5104 * Will return the command line.
5105 * @param bootloader
5106 * Will return the absolute path of the bootloader file.
5107 * @param kernel_32
5108 * Will return the absolute path of the 32 bit kernel file.
5109 * @param kernel_64
5110 * Will return the absolute path of the 64 bit kernel file.
5111 * @param ramdisk
5112 * Will return the absolute path of the RAM disk file.
5113 * @return
5114 * 1 is success , <0 means error
5115 * @since 1.3.8
5116 */
5117int iso_image_get_hppa_palo(IsoImage *img, char **cmdline, char **bootloader,
5118 char **kernel_32, char **kernel_64, char **ramdisk);
5119
5120
5121/**
5122 * Submit the path of the DEC Alpha Secondary Bootstrap Loader file.
5123 * The path must lead to an already existing data file in the ISO image
5124 * which stays with this path until image production.
5125 * This setting has an effect only if system area type is set to 6
5126 * with iso_write_opts_set_system_area().
5127 *
5128 * @param img
5129 * The image to be manipulated.
5130 * @param boot_loader_path
5131 * Absolute path of a data file in the ISO image.
5132 * Submit NULL to free this image property.
5133 * @param flag
5134 * Bitfield for control purposes. Unused yet. Submit 0.
5135 * @return
5136 * 1 is success , <0 means error
5137 * @since 1.4.0
5138 */
5139int iso_image_set_alpha_boot(IsoImage *img, char *boot_loader_path, int flag);
5140
5141/**
5142 * Inquire the path submitted by iso_image_set_alpha_boot()
5143 * Do not free() the returned pointer.
5144 *
5145 * @param img
5146 * The image to be inquired.
5147 * @param boot_loader_path
5148 * Will return the path. NULL if none is currently submitted.
5149 * @return
5150 * 1 is success , <0 means error
5151 * @since 1.4.0
5152 */
5153int iso_image_get_alpha_boot(IsoImage *img, char **boot_loader_path);
5154
5155
5156/**
5157 * Increments the reference counting of the given node.
5158 *
5159 * @since 0.6.2
5160 */
5162
5163/**
5164 * Decrements the reference counting of the given node.
5165 * If it reach 0, the node is free, and, if the node is a directory,
5166 * its children will be unref() too.
5167 *
5168 * @since 0.6.2
5169 */
5171
5172/**
5173 * Get the type of an IsoNode.
5174 *
5175 * @since 0.6.2
5176 */
5178
5179/**
5180 * Class of functions to handle particular extended information. A function
5181 * instance acts as an identifier for the type of the information. Structs
5182 * with same information type must use a pointer to the same function.
5183 *
5184 * @param data
5185 * Attached data
5186 * @param flag
5187 * What to do with the data. At this time the following values are
5188 * defined:
5189 * -> 1 the data must be freed
5190 * @return
5191 * 1 in any case.
5192 *
5193 * @since 0.6.4
5194 */
5195typedef int (*iso_node_xinfo_func)(void *data, int flag);
5196
5197/**
5198 * Add extended information to the given node. Extended info allows
5199 * applications (and libisofs itself) to add more information to an IsoNode.
5200 * You can use this facilities to associate temporary information with a given
5201 * node. This information is not written into the ISO 9660 image on media
5202 * and thus does not persist longer than the node memory object.
5203 *
5204 * Each node keeps a list of added extended info, meaning you can add several
5205 * extended info data to each node. Each extended info you add is identified
5206 * by the proc parameter, a pointer to a function that knows how to manage
5207 * the external info data. Thus, in order to add several types of extended
5208 * info, you need to define a "proc" function for each type.
5209 *
5210 * @param node
5211 * The node where to add the extended info
5212 * @param proc
5213 * A function pointer used to identify the type of the data, and that
5214 * knows how to manage it
5215 * @param data
5216 * Extended info to add.
5217 * @return
5218 * 1 if success, 0 if the given node already has extended info of the
5219 * type defined by the "proc" function, < 0 on error
5220 *
5221 * @since 0.6.4
5222 */
5224
5225/**
5226 * Remove the given extended info (defined by the proc function) from the
5227 * given node.
5228 *
5229 * @return
5230 * 1 on success, 0 if node does not have extended info of the requested
5231 * type, < 0 on error
5232 *
5233 * @since 0.6.4
5234 */
5236
5237/**
5238 * Remove all extended information from the given node.
5239 *
5240 * @param node
5241 * The node where to remove all extended info
5242 * @param flag
5243 * Bitfield for control purposes, unused yet, submit 0
5244 * @return
5245 * 1 on success, < 0 on error
5246 *
5247 * @since 1.0.2
5248 */
5250
5251/**
5252 * Get the given extended info (defined by the proc function) from the
5253 * given node.
5254 *
5255 * @param node
5256 * The node to inquire
5257 * @param proc
5258 * The function pointer which serves as key
5259 * @param data
5260 * Will after successful call point to the xinfo data corresponding
5261 * to the given proc. This is a pointer, not a feeable data copy.
5262 * @return
5263 * 1 on success, 0 if node does not have extended info of the requested
5264 * type, < 0 on error
5265 *
5266 * @since 0.6.4
5267 */
5268int iso_node_get_xinfo(IsoNode *node, iso_node_xinfo_func proc, void **data);
5269
5270
5271/**
5272 * Get the next pair of function pointer and data of an iteration of the
5273 * list of extended information. Like:
5274 * iso_node_xinfo_func proc;
5275 * void *handle = NULL, *data;
5276 * while (iso_node_get_next_xinfo(node, &handle, &proc, &data) == 1) {
5277 * ... make use of proc and data ...
5278 * }
5279 * The iteration allocates no memory. So you may end it without any disposal
5280 * action.
5281 * IMPORTANT: Do not continue iterations after manipulating the extended
5282 * information of a node. Memory corruption hazard !
5283 * @param node
5284 * The node to inquire
5285 * @param handle
5286 * The opaque iteration handle. Initialize iteration by submitting
5287 * a pointer to a void pointer with value NULL.
5288 * Do not alter its content until iteration has ended.
5289 * @param proc
5290 * The function pointer which serves as key
5291 * @param data
5292 * Will be filled with the extended info corresponding to the given proc
5293 * function
5294 * @return
5295 * 1 on success
5296 * 0 if iteration has ended (proc and data are invalid then)
5297 * < 0 on error
5298 *
5299 * @since 1.0.2
5300 */
5301int iso_node_get_next_xinfo(IsoNode *node, void **handle,
5302 iso_node_xinfo_func *proc, void **data);
5303
5304
5305/**
5306 * Class of functions to clone extended information. A function instance gets
5307 * associated to a particular iso_node_xinfo_func instance by function
5308 * iso_node_xinfo_make_clonable(). This is a precondition to have IsoNode
5309 * objects clonable which carry data for a particular iso_node_xinfo_func.
5310 *
5311 * @param old_data
5312 * Data item to be cloned
5313 * @param new_data
5314 * Shall return the cloned data item
5315 * @param flag
5316 * Unused yet, submit 0
5317 * The function shall return ISO_XINFO_NO_CLONE on unknown flag bits.
5318 * @return
5319 * > 0 number of allocated bytes
5320 * 0 no size info is available
5321 * < 0 error
5322 *
5323 * @since 1.0.2
5324 */
5325typedef int (*iso_node_xinfo_cloner)(void *old_data, void **new_data,int flag);
5326
5327/**
5328 * Associate a iso_node_xinfo_cloner to a particular class of extended
5329 * information in order to make it clonable.
5330 *
5331 * @param proc
5332 * The key and disposal function which identifies the particular
5333 * extended information class.
5334 * @param cloner
5335 * The cloner function which shall be associated with proc.
5336 * @param flag
5337 * Unused yet, submit 0
5338 * @return
5339 * 1 success, < 0 error
5340 *
5341 * @since 1.0.2
5342 */
5344 iso_node_xinfo_cloner cloner, int flag);
5345
5346/**
5347 * Inquire the registered cloner function for a particular class of
5348 * extended information.
5349 *
5350 * @param proc
5351 * The key and disposal function which identifies the particular
5352 * extended information class.
5353 * @param cloner
5354 * Will return the cloner function which is associated with proc, or NULL.
5355 * @param flag
5356 * Unused yet, submit 0
5357 * @return
5358 * 1 success, 0 no cloner registered for proc, < 0 error
5359 *
5360 * @since 1.0.2
5361 */
5363 iso_node_xinfo_cloner *cloner, int flag);
5364
5365/**
5366 * Set the name of a node. Note that if the node is already added to a dir
5367 * this can fail if dir already contains a node with the new name.
5368 * The IsoImage context defines a maximum permissible name length and a mode
5369 * how to react on oversized names. See iso_image_set_truncate_mode().
5370 *
5371 * @param image
5372 * The image object to which the node belongs or shall belong in future.
5373 * @param node
5374 * The node of which you want to change the name. One cannot change the
5375 * name of the root directory.
5376 * @param name
5377 * The new name for the node. It may not be empty. If it is oversized
5378 * then it will be handled according to iso_image_set_truncate_mode().
5379 * @param flag
5380 * bit0= issue warning in case of truncation
5381 * @return
5382 * 1 on success, < 0 on error
5383 *
5384 * @since 1.4.2
5385 */
5386int iso_image_set_node_name(IsoImage *image, IsoNode *node, const char *name,
5387 int flag);
5388
5389/**
5390 * *** Deprecated ***
5391 * use iso_image_set_node_name() instead
5392 *
5393 * Set the name of a node without taking into respect name truncation mode of
5394 * an IsoImage.
5395 *
5396 * @param node
5397 * The node whose name you want to change. Note that you can't change
5398 * the name of the root.
5399 * @param name
5400 * The name for the node. If you supply an empty string or a
5401 * name greater than 255 characters this returns with failure, and
5402 * node name is not modified.
5403 * @return
5404 * 1 on success, < 0 on error
5405 *
5406 * @since 0.6.2
5407 */
5408int iso_node_set_name(IsoNode *node, const char *name);
5409
5410
5411/**
5412 * Get the name of a node.
5413 * The returned string belongs to the node and must not be modified nor
5414 * freed. Use strdup if you really need your own copy.
5415 *
5416 * Up to version 1.4.2 inquiry of the root directory name returned NULL,
5417 * which is a bug in the light of above description.
5418 * Since 1.4.2 the return value is an empty string.
5419 *
5420 * @since 0.6.2
5421 */
5422const char *iso_node_get_name(const IsoNode *node);
5423
5424/**
5425 * Set the permissions for the node. This attribute is only useful when
5426 * Rock Ridge extensions are enabled.
5427 *
5428 * @param node
5429 * The node to change
5430 * @param mode
5431 * bitmask with the permissions of the node, as specified in 'man 2 stat'.
5432 * The file type bitfields will be ignored, only file permissions will be
5433 * modified.
5434 *
5435 * @since 0.6.2
5436 */
5437void iso_node_set_permissions(IsoNode *node, mode_t mode);
5438
5439/**
5440 * Get the permissions for the node
5441 *
5442 * @since 0.6.2
5443 */
5445
5446/**
5447 * Get the mode of the node, both permissions and file type, as specified in
5448 * 'man 2 stat'.
5449 *
5450 * @since 0.6.2
5451 */
5452mode_t iso_node_get_mode(const IsoNode *node);
5453
5454/**
5455 * Set the user id for the node. This attribute is only useful when
5456 * Rock Ridge extensions are enabled.
5457 *
5458 * @since 0.6.2
5459 */
5460void iso_node_set_uid(IsoNode *node, uid_t uid);
5461
5462/**
5463 * Get the user id of the node.
5464 *
5465 * @since 0.6.2
5466 */
5467uid_t iso_node_get_uid(const IsoNode *node);
5468
5469/**
5470 * Set the group id for the node. This attribute is only useful when
5471 * Rock Ridge extensions are enabled.
5472 *
5473 * @since 0.6.2
5474 */
5475void iso_node_set_gid(IsoNode *node, gid_t gid);
5476
5477/**
5478 * Get the group id of the node.
5479 *
5480 * @since 0.6.2
5481 */
5482gid_t iso_node_get_gid(const IsoNode *node);
5483
5484/**
5485 * Set the time of last modification of the file
5486 *
5487 * @since 0.6.2
5488 */
5489void iso_node_set_mtime(IsoNode *node, time_t time);
5490
5491/**
5492 * Get the time of last modification of the file
5493 *
5494 * @since 0.6.2
5495 */
5496time_t iso_node_get_mtime(const IsoNode *node);
5497
5498/**
5499 * Set the time of last access to the file
5500 *
5501 * @since 0.6.2
5502 */
5503void iso_node_set_atime(IsoNode *node, time_t time);
5504
5505/**
5506 * Get the time of last access to the file
5507 *
5508 * @since 0.6.2
5509 */
5510time_t iso_node_get_atime(const IsoNode *node);
5511
5512/**
5513 * Set the time of last status change of the file
5514 *
5515 * @since 0.6.2
5516 */
5517void iso_node_set_ctime(IsoNode *node, time_t time);
5518
5519/**
5520 * Get the time of last status change of the file
5521 *
5522 * @since 0.6.2
5523 */
5524time_t iso_node_get_ctime(const IsoNode *node);
5525
5526/**
5527 * Set whether the node will be hidden in the directory trees of RR/ISO 9660,
5528 * or of Joliet (if enabled at all), or of an Enhanced Volume Descriptor
5529 * (aka ISO 9660:1999) as of ECMA-119 4th Edition (if enabled at all).
5530 *
5531 * A hidden file does not show up by name in the affected directory tree.
5532 * For example, if a file is hidden only in Joliet, it will normally
5533 * not be visible on Windows systems, while being shown on GNU/Linux.
5534 *
5535 * If a file is not shown in any of the enabled trees, then its content will
5536 * not be written to the image, unless LIBISO_HIDE_BUT_WRITE is given (which
5537 * is available only since release 0.6.34).
5538 *
5539 * @param node
5540 * The node that is to be hidden.
5541 * @param hide_attrs
5542 * Or-combination of values from enum IsoHideNodeFlag to set the trees
5543 * in which the node's name shall be hidden.
5544 *
5545 * @since 0.6.2
5546 */
5547void iso_node_set_hidden(IsoNode *node, int hide_attrs);
5548
5549/**
5550 * Get the hide_attrs as possibly set by iso_node_set_hidden().
5551 *
5552 * @param node
5553 * The node to inquire.
5554 * @return
5555 * Or-combination of values from enum IsoHideNodeFlag which are
5556 * currently set for the node.
5557 *
5558 * @since 0.6.34
5559 */
5561
5562/**
5563 * Compare two nodes whether they are based on the same input and
5564 * can be considered as hardlinks to the same file objects.
5565 *
5566 * @param n1
5567 * The first node to compare.
5568 * @param n2
5569 * The second node to compare.
5570 * @return
5571 * -1 if n1 is smaller n2 , 0 if n1 matches n2 , 1 if n1 is larger n2
5572 * @param flag
5573 * Bitfield for control purposes, unused yet, submit 0
5574 * @since 0.6.20
5575 */
5576int iso_node_cmp_ino(IsoNode *n1, IsoNode *n2, int flag);
5577
5578/**
5579 * Add a new node to a dir. Note that this function don't add a new ref to
5580 * the node, so you don't need to free it, it will be automatically freed
5581 * when the dir is deleted. Of course, if you want to keep using the node
5582 * after the dir life, you need to iso_node_ref() it.
5583 *
5584 * @param dir
5585 * the dir where to add the node
5586 * @param child
5587 * the node to add. You must ensure that the node hasn't previously added
5588 * to other dir, and that the node name is unique inside the child.
5589 * Otherwise this function will return a failure, and the child won't be
5590 * inserted.
5591 * @param replace
5592 * if the dir already contains a node with the same name, whether to
5593 * replace or not the old node with this.
5594 * @return
5595 * number of nodes in dir if success, < 0 otherwise
5596 * Possible errors:
5597 * ISO_NULL_POINTER, if dir or child are NULL
5598 * ISO_NODE_ALREADY_ADDED, if child is already added to other dir
5599 * ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists
5600 * ISO_WRONG_ARG_VALUE, if child == dir, or replace != (0,1)
5601 *
5602 * @since 0.6.2
5603 */
5605 enum iso_replace_mode replace);
5606
5607/**
5608 * Locate a node inside a given dir.
5609 *
5610 * The IsoImage context defines a maximum permissible name length and a mode
5611 * how to react on oversized names. See iso_image_set_truncate_mode().
5612 * If the caller looks for an oversized name and image truncate mode is 1,
5613 * then this call looks for the truncated name among the nodes of dir.
5614 *
5615 * @param image
5616 * The image object to which dir belongs.
5617 * @param dir
5618 * The dir where to look for the node.
5619 * @param name
5620 * The name of the node. (Will not be changed if truncation happens.)
5621 * @param node
5622 * Location for a pointer to the node, it will filled with NULL if the dir
5623 * doesn't have a child with the given name.
5624 * The node will be owned by the dir and shouldn't be unref(). Just call
5625 * iso_node_ref() to get your own reference to the node.
5626 * Note that you can pass NULL is the only thing you want to do is check
5627 * if a node with such name already exists on dir.
5628 * @param flag
5629 * Bitfield for control purposes.
5630 * bit0= do not truncate name but lookup exactly as given.
5631 * @return
5632 * 1 node found
5633 * 0 no name truncation was needed, name not found in dir
5634 * 2 name truncation happened, truncated name not found in dir
5635 * < 0 error, see iso_dir_get_node().
5636 *
5637 * @since 1.4.2
5638 */
5640 const char *name, IsoNode **node, int flag);
5641
5642/**
5643 * *** Deprecated ***
5644 * In most cases use iso_image_dir_get_node() instead.
5645 *
5646 * Locate a node inside a given dir without taking into respect name truncation
5647 * mode of an IsoImage.
5648 *
5649 * @param dir
5650 * The dir where to look for the node.
5651 * @param name
5652 * The name of the node
5653 * @param node
5654 * Location for a pointer to the node. See iso_image_get_node().
5655 * @return
5656 * 1 node found, 0 child has no such node, < 0 error
5657 * Possible errors:
5658 * ISO_NULL_POINTER, if dir or name are NULL
5659 *
5660 * @since 0.6.2
5661 */
5662int iso_dir_get_node(IsoDir *dir, const char *name, IsoNode **node);
5663
5664/**
5665 * Get the number of children of a directory.
5666 *
5667 * @return
5668 * >= 0 number of items, < 0 error
5669 * Possible errors:
5670 * ISO_NULL_POINTER, if dir is NULL
5671 *
5672 * @since 0.6.2
5673 */
5675
5676/**
5677 * Removes a child from a directory.
5678 * The child is not freed, so you will become the owner of the node. Later
5679 * you can add the node to another dir (calling iso_dir_add_node), or free
5680 * it if you don't need it (with iso_node_unref).
5681 *
5682 * @return
5683 * 1 on success, < 0 error
5684 * Possible errors:
5685 * ISO_NULL_POINTER, if node is NULL
5686 * ISO_NODE_NOT_ADDED_TO_DIR, if node doesn't belong to a dir
5687 *
5688 * @since 0.6.2
5689 */
5691
5692/**
5693 * Removes a child from a directory and free (unref) it.
5694 * If you want to keep the child alive, you need to iso_node_ref() it
5695 * before this call, but in that case iso_node_take() is a better
5696 * alternative.
5697 *
5698 * @return
5699 * 1 on success, < 0 error
5700 *
5701 * @since 0.6.2
5702 */
5704
5705/*
5706 * Get the parent of the given iso tree node. No extra ref is added to the
5707 * returned directory, you must take your ref. with iso_node_ref() if you
5708 * need it.
5709 *
5710 * If node is the root node, the same node will be returned as its parent.
5711 *
5712 * This returns NULL if the node doesn't pertain to any tree
5713 * (it was removed/taken).
5714 *
5715 * @since 0.6.2
5716 */
5718
5719/**
5720 * Get an iterator for the children of the given dir.
5721 *
5722 * You can iterate over the children with iso_dir_iter_next. When finished,
5723 * you should free the iterator with iso_dir_iter_free.
5724 * You must not delete a child of the same dir, using iso_node_take() or
5725 * iso_node_remove(), while you're using the iterator. You can use
5726 * iso_dir_iter_take() or iso_dir_iter_remove() instead.
5727 *
5728 * You can use the iterator in the way like this
5729 *
5730 * IsoDirIter *iter;
5731 * IsoNode *node;
5732 * if ( iso_dir_get_children(dir, &iter) != 1 ) {
5733 * // handle error
5734 * }
5735 * while ( iso_dir_iter_next(iter, &node) == 1 ) {
5736 * // do something with the child
5737 * }
5738 * iso_dir_iter_free(iter);
5739 *
5740 * An iterator is intended to be used in a single iteration over the
5741 * children of a dir. Thus, it should be treated as a temporary object,
5742 * and free as soon as possible.
5743 *
5744 * @return
5745 * 1 success, < 0 error
5746 * Possible errors:
5747 * ISO_NULL_POINTER, if dir or iter are NULL
5748 * ISO_OUT_OF_MEM
5749 *
5750 * @since 0.6.2
5751 */
5753
5754/**
5755 * Get the next child.
5756 * Take care that the node is owned by its parent, and will be unref() when
5757 * the parent is freed. If you want your own ref to it, call iso_node_ref()
5758 * on it.
5759 *
5760 * @return
5761 * 1 success, 0 if dir has no more elements, < 0 error
5762 * Possible errors:
5763 * ISO_NULL_POINTER, if node or iter are NULL
5764 * ISO_ERROR, on wrong iter usage, usual caused by modiying the
5765 * dir during iteration
5766 *
5767 * @since 0.6.2
5768 */
5770
5771/**
5772 * Check if there're more children.
5773 *
5774 * @return
5775 * 1 dir has more elements, 0 no, < 0 error
5776 * Possible errors:
5777 * ISO_NULL_POINTER, if iter is NULL
5778 *
5779 * @since 0.6.2
5780 */
5782
5783/**
5784 * Free a dir iterator.
5785 *
5786 * @since 0.6.2
5787 */
5789
5790/**
5791 * Removes a child from a directory during an iteration, without freeing it.
5792 * It's like iso_node_take(), but to be used during a directory iteration.
5793 * The node removed will be the last returned by the iteration.
5794 *
5795 * If you call this function twice without calling iso_dir_iter_next between
5796 * them is not allowed and you will get an ISO_ERROR in second call.
5797 *
5798 * @return
5799 * 1 on success, < 0 error
5800 * Possible errors:
5801 * ISO_NULL_POINTER, if iter is NULL
5802 * ISO_ERROR, on wrong iter usage, for example by call this before
5803 * iso_dir_iter_next.
5804 *
5805 * @since 0.6.2
5806 */
5808
5809/**
5810 * Removes a child from a directory during an iteration and unref() it.
5811 * Like iso_node_remove(), but to be used during a directory iteration.
5812 * The node removed will be the one returned by the previous iteration.
5813 *
5814 * It is not allowed to call this function twice without calling
5815 * iso_dir_iter_next between the calls.
5816 *
5817 * @return
5818 * 1 on success, < 0 error
5819 * Possible errors:
5820 * ISO_NULL_POINTER, if iter is NULL
5821 * ISO_ERROR, on wrong iter usage, for example by calling this before
5822 * iso_dir_iter_next.
5823 *
5824 * @since 0.6.2
5825 */
5827
5828/**
5829 * Removes a node by iso_node_remove() or iso_dir_iter_remove(). If the node
5830 * is a directory then the whole tree of nodes underneath is removed too.
5831 *
5832 * @param node
5833 * The node to be removed.
5834 * @param boss_iter
5835 * If not NULL, then the node will be removed by
5836 * iso_dir_iter_remove(boss_iter)
5837 * else it will be removed by iso_node_remove(node).
5838 * @return
5839 * 1 is success, <0 indicates error
5840 *
5841 * @since 1.0.2
5842 */
5844
5845
5846/**
5847 * @since 0.6.4
5848 */
5849typedef struct iso_find_condition IsoFindCondition;
5850
5851/**
5852 * Create a new condition that checks if the node name matches the given
5853 * wildcard.
5854 *
5855 * @param wildcard
5856 * @result
5857 * The created IsoFindCondition, NULL on error.
5858 *
5859 * @since 0.6.4
5860 */
5862
5863/**
5864 * Create a new condition that checks the node mode against a mode mask. It
5865 * can be used to check both file type and permissions.
5866 *
5867 * For example:
5868 *
5869 * iso_new_find_conditions_mode(S_IFREG) : search for regular files
5870 * iso_new_find_conditions_mode(S_IFCHR | S_IWUSR) : search for character
5871 * devices where owner has write permissions.
5872 *
5873 * @param mask
5874 * Mode mask to AND against node mode.
5875 * @result
5876 * The created IsoFindCondition, NULL on error.
5877 *
5878 * @since 0.6.4
5879 */
5881
5882/**
5883 * Create a new condition that checks the node gid.
5884 *
5885 * @param gid
5886 * Desired Group Id.
5887 * @result
5888 * The created IsoFindCondition, NULL on error.
5889 *
5890 * @since 0.6.4
5891 */
5893
5894/**
5895 * Create a new condition that checks the node uid.
5896 *
5897 * @param uid
5898 * Desired User Id.
5899 * @result
5900 * The created IsoFindCondition, NULL on error.
5901 *
5902 * @since 0.6.4
5903 */
5905
5906/**
5907 * Possible comparison between IsoNode and given conditions.
5908 *
5909 * @since 0.6.4
5910 */
5918
5919/**
5920 * Create a new condition that checks the time of last access.
5921 *
5922 * @param time
5923 * Time to compare against IsoNode atime.
5924 * @param comparison
5925 * Comparison to be done between IsoNode atime and submitted time.
5926 * Note that ISO_FIND_COND_GREATER, for example, is true if the node
5927 * time is greater than the submitted time.
5928 * @result
5929 * The created IsoFindCondition, NULL on error.
5930 *
5931 * @since 0.6.4
5932 */
5934 enum iso_find_comparisons comparison);
5935
5936/**
5937 * Create a new condition that checks the time of last modification.
5938 *
5939 * @param time
5940 * Time to compare against IsoNode mtime.
5941 * @param comparison
5942 * Comparison to be done between IsoNode mtime and submitted time.
5943 * Note that ISO_FIND_COND_GREATER, for example, is true if the node
5944 * time is greater than the submitted time.
5945 * @result
5946 * The created IsoFindCondition, NULL on error.
5947 *
5948 * @since 0.6.4
5949 */
5951 enum iso_find_comparisons comparison);
5952
5953/**
5954 * Create a new condition that checks the time of last status change.
5955 *
5956 * @param time
5957 * Time to compare against IsoNode ctime.
5958 * @param comparison
5959 * Comparison to be done between IsoNode ctime and submitted time.
5960 * Note that ISO_FIND_COND_GREATER, for example, is true if the node
5961 * time is greater than the submitted time.
5962 * @result
5963 * The created IsoFindCondition, NULL on error.
5964 *
5965 * @since 0.6.4
5966 */
5968 enum iso_find_comparisons comparison);
5969
5970/**
5971 * Create a new condition that check if the two given conditions are
5972 * valid.
5973 *
5974 * @param a
5975 * @param b
5976 * IsoFindCondition to compare
5977 * @result
5978 * The created IsoFindCondition, NULL on error.
5979 *
5980 * @since 0.6.4
5981 */
5983 IsoFindCondition *b);
5984
5985/**
5986 * Create a new condition that check if at least one the two given conditions
5987 * is valid.
5988 *
5989 * @param a
5990 * @param b
5991 * IsoFindCondition to compare
5992 * @result
5993 * The created IsoFindCondition, NULL on error.
5994 *
5995 * @since 0.6.4
5996 */
5998 IsoFindCondition *b);
5999
6000/**
6001 * Create a new condition that check if the given conditions is false.
6002 *
6003 * @param negate
6004 * @result
6005 * The created IsoFindCondition, NULL on error.
6006 *
6007 * @since 0.6.4
6008 */
6010
6011/**
6012 * Find all directory children that match the given condition.
6013 *
6014 * @param dir
6015 * Directory where we will search children.
6016 * @param cond
6017 * Condition that the children must match in order to be returned.
6018 * It will be free together with the iterator. Remember to delete it
6019 * if this function return error.
6020 * @param iter
6021 * Iterator that returns only the children that match condition.
6022 * @return
6023 * 1 on success, < 0 on error
6024 *
6025 * @since 0.6.4
6026 */
6028 IsoDirIter **iter);
6029
6030/**
6031 * Get the destination of a node.
6032 * The returned string belongs to the node and must not be modified nor
6033 * freed. Use strdup if you really need your own copy.
6034 *
6035 * @since 0.6.2
6036 */
6037const char *iso_symlink_get_dest(const IsoSymlink *link);
6038
6039/**
6040 * Set the destination of a symbolic
6041 *
6042 * @param link
6043 * The link node to be manipulated
6044 * @param dest
6045 * New destination for the link. It must be a non-empty string, otherwise
6046 * this function doesn't modify previous destination.
6047 * @return
6048 * 1 on success, < 0 on error
6049 *
6050 * @since 0.6.2
6051 */
6052int iso_symlink_set_dest(IsoSymlink *link, const char *dest);
6053
6054/**
6055 * Sets the order in which a node will be written on image. The data content
6056 * of files with high weight will be written to low block addresses.
6057 *
6058 * @param node
6059 * The node which weight will be changed. If it's a dir, this function
6060 * will change the weight of all its children. For nodes other that dirs
6061 * or regular files, this function has no effect.
6062 * @param w
6063 * The weight as a integer number, the greater this value is, the
6064 * closer from the beginning of image the file will be written.
6065 * Default value at IsoNode creation is 0.
6066 *
6067 * @since 0.6.2
6068 */
6070
6071/**
6072 * Get the sort weight of a file.
6073 *
6074 * @since 0.6.2
6075 */
6077
6078/**
6079 * Get the size of the file, in bytes
6080 *
6081 * @since 0.6.2
6082 */
6084
6085/**
6086 * Get the device id (major/minor numbers) of the given block or
6087 * character device file. The result is undefined for other kind
6088 * of special files, of first be sure iso_node_get_mode() returns either
6089 * S_IFBLK or S_IFCHR.
6090 *
6091 * @since 0.6.6
6092 */
6094
6095/**
6096 * Get the IsoStream that represents the contents of the given IsoFile.
6097 * The stream may be a filter stream which itself get its input from a
6098 * further stream. This may be inquired by iso_stream_get_input_stream().
6099 *
6100 * If you iso_stream_open() the stream, iso_stream_close() it before
6101 * image generation begins.
6102 *
6103 * @return
6104 * The IsoStream. No extra ref is added, so the IsoStream belongs to the
6105 * IsoFile, and it may be freed together with it. Add your own ref with
6106 * iso_stream_ref() if you need it.
6107 *
6108 * @since 0.6.4
6109 */
6111
6112/**
6113 * Get the block lba of a file node, if it was imported from an old image.
6114 *
6115 * @param file
6116 * The file
6117 * @param lba
6118 * Will be filled with the kba
6119 * @param flag
6120 * Reserved for future usage, submit 0
6121 * @return
6122 * 1 if lba is valid (file comes from old image and has only one section),
6123 * 0 if file was newly added, i.e. it does not come from an old image,
6124 * < 0 error, especially ISO_WRONG_ARG_VALUE if the file has more than
6125 * one file section.
6126 *
6127 * @since 0.6.4
6128 *
6129 * @deprecated Use iso_file_get_old_image_sections(), as this function does
6130 * not work with multi-extend files.
6131 */
6132int iso_file_get_old_image_lba(IsoFile *file, uint32_t *lba, int flag);
6133
6134/**
6135 * Get the start addresses and the sizes of the data extents of a file node
6136 * if it was imported from an old image.
6137 *
6138 * @param file
6139 * The file
6140 * @param section_count
6141 * Returns the number of extent entries in sections array.
6142 * @param sections
6143 * Returns the array of file sections if section_count > 0.
6144 * In this case, apply free() to dispose it.
6145 * @param flag
6146 * Reserved for future usage, submit 0
6147 * @return
6148 * 1 if there are valid extents (file comes from old image),
6149 * 0 if file was newly added, i.e. it does not come from an old image,
6150 * < 0 error
6151 *
6152 * @since 0.6.8
6153 */
6154int iso_file_get_old_image_sections(IsoFile *file, int *section_count,
6155 struct iso_file_section **sections,
6156 int flag);
6157
6158/*
6159 * Like iso_file_get_old_image_lba(), but take an IsoNode.
6160 *
6161 * @return
6162 * 1 if lba is valid (file comes from old image), 0 if file was newly
6163 * added, i.e. it does not come from an old image, 2 node type has no
6164 * LBA (no regular file), < 0 error
6165 *
6166 * @since 0.6.4
6167 */
6168int iso_node_get_old_image_lba(IsoNode *node, uint32_t *lba, int flag);
6169
6170/**
6171 * Add a new directory to the iso tree. Permissions, owner and hidden atts
6172 * are taken from parent, you can modify them later.
6173 *
6174 * @param image
6175 * The image object to which the new directory shall belong.
6176 * @param parent
6177 * The directory node where the new directory will be grafted in.
6178 * @param name
6179 * Name for the new directory. If truncation mode is set to 1,
6180 * an oversized name gets truncated before further processing.
6181 * If a node with same name already exists on parent, this function
6182 * fails with ISO_NODE_NAME_NOT_UNIQUE.
6183 * @param dir
6184 * place where to store a pointer to the newly created dir. No extra
6185 * ref is added, so you will need to call iso_node_ref() if you really
6186 * need it. You can pass NULL in this parameter if you don't need the
6187 * pointer.
6188 * @return
6189 * number of nodes in parent if success, < 0 otherwise
6190 * Possible errors:
6191 * ISO_NULL_POINTER, if parent or name are NULL
6192 * ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists
6193 * ISO_OUT_OF_MEM
6194 * ISO_RR_NAME_TOO_LONG
6195 *
6196 * @since 1.4.2
6197 */
6198int iso_image_add_new_dir(IsoImage *image, IsoDir *parent, const char *name,
6199 IsoDir **dir);
6200
6201/**
6202 * *** Deprecated ***
6203 * use iso_image_add_new_dir() instead
6204 *
6205 * Add a new directory to the iso tree without taking into respect name
6206 * truncation mode of an IsoImage.
6207 * For detailed description of parameters, see above iso_image_add_new_dir().
6208 *
6209 * @param parent
6210 * the dir where the new directory will be created
6211 * @param name
6212 * name for the new dir.
6213 * @param dir
6214 * place where to store a pointer to the newly created dir.i
6215 * @return
6216 * number of nodes in parent if success, < 0 otherwise
6217 * Possible errors:
6218 * ISO_NULL_POINTER, if parent or name are NULL
6219 * ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists
6220 * ISO_OUT_OF_MEM
6221 *
6222 * @since 0.6.2
6223 */
6224int iso_tree_add_new_dir(IsoDir *parent, const char *name, IsoDir **dir);
6225
6226/**
6227 * Add a new regular file to the iso tree. Permissions are set to 0444,
6228 * owner and hidden atts are taken from parent. You can modify any of them
6229 * later.
6230 *
6231 * @param image
6232 * The image object to which the new file shall belong.
6233 * @param parent
6234 * The directory node where the new directory will be grafted in.
6235 * @param name
6236 * Name for the new file. If truncation mode is set to 1,
6237 * an oversized name gets truncated before further processing.
6238 * If a node with same name already exists on parent, this function
6239 * fails with ISO_NODE_NAME_NOT_UNIQUE.
6240 * @param stream
6241 * IsoStream for the contents of the file. The reference will be taken
6242 * by the newly created file, you will need to take an extra ref to it
6243 * if you need it.
6244 * @param file
6245 * place where to store a pointer to the newly created file. No extra
6246 * ref is added, so you will need to call iso_node_ref() if you really
6247 * need it. You can pass NULL in this parameter if you don't need the
6248 * pointer
6249 * @return
6250 * number of nodes in parent if success, < 0 otherwise
6251 * Possible errors:
6252 * ISO_NULL_POINTER, if parent, name or dest are NULL
6253 * ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists
6254 * ISO_OUT_OF_MEM
6255 * ISO_RR_NAME_TOO_LONG
6256 *
6257 * @since 1.4.2
6258 */
6259int iso_image_add_new_file(IsoImage *image, IsoDir *parent, const char *name,
6260 IsoStream *stream, IsoFile **file);
6261
6262/**
6263 * *** Deprecated ***
6264 * use iso_image_add_new_file() instead
6265 *
6266 * Add a new regular file to the iso tree without taking into respect name
6267 * truncation mode of an IsoImage.
6268 * For detailed description of parameters, see above iso_image_add_new_file().
6269 *
6270 * @param parent
6271 * the dir where the new file will be created
6272 * @param name
6273 * name for the new file.
6274 * @param stream
6275 * IsoStream for the contents of the file.
6276 * @param file
6277 * place where to store a pointer to the newly created file.
6278 * @return
6279 * number of nodes in parent if success, < 0 otherwise
6280 * Possible errors:
6281 * ISO_NULL_POINTER, if parent, name or dest are NULL
6282 * ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists
6283 * ISO_OUT_OF_MEM
6284 *
6285 * @since 0.6.4
6286 */
6287int iso_tree_add_new_file(IsoDir *parent, const char *name, IsoStream *stream,
6288 IsoFile **file);
6289
6290/**
6291 * Create an IsoStream object from content which is stored in a dynamically
6292 * allocated memory buffer. The new stream will become owner of the buffer
6293 * and apply free() to it when the stream finally gets destroyed itself.
6294 *
6295 * @param buf
6296 * The dynamically allocated memory buffer with the stream content.
6297 * @param size
6298 * The number of bytes which may be read from buf.
6299 * @param stream
6300 * Will return a reference to the newly created stream.
6301 * @return
6302 * ISO_SUCCESS or <0 for error. E.g. ISO_NULL_POINTER, ISO_OUT_OF_MEM.
6303 *
6304 * @since 1.0.0
6305 */
6306int iso_memory_stream_new(unsigned char *buf, size_t size, IsoStream **stream);
6307
6308/**
6309 * Add a new symbolic link to the directory tree. Permissions are set to 0777,
6310 * owner and hidden atts are taken from parent. You can modify any of them
6311 * later.
6312 *
6313 * @param image
6314 * The image object to which the new directory shall belong.
6315 * @param parent
6316 * The directory node where the new symlink will be grafted in.
6317 * @param name
6318 * Name for the new symlink. If truncation mode is set to 1,
6319 * an oversized name gets truncated before further processing.
6320 * If a node with same name already exists on parent, this function
6321 * fails with ISO_NODE_NAME_NOT_UNIQUE.
6322 * @param dest
6323 * The destination path of the link. The components of this path are
6324 * not checked for being oversized.
6325 * @param link
6326 * Place where to store a pointer to the newly created link. No extra
6327 * ref is added, so you will need to call iso_node_ref() if you really
6328 * need it. You can pass NULL in this parameter if you don't need the
6329 * pointer
6330 * @return
6331 * number of nodes in parent if success, < 0 otherwise
6332 * Possible errors:
6333 * ISO_NULL_POINTER, if parent, name or dest are NULL
6334 * ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists
6335 * ISO_OUT_OF_MEM
6336 * ISO_RR_NAME_TOO_LONG
6337 *
6338 * @since 1.4.2
6339 */
6341 const char *name, const char *dest,
6342 IsoSymlink **link);
6343
6344/**
6345 * *** Deprecated ***
6346 * use iso_image_add_new_symlink() instead
6347 *
6348 * Add a new symlink to the directory tree without taking into respect name
6349 * truncation mode of an IsoImage.
6350 * For detailed description of parameters, see above
6351 * iso_image_add_new_isymlink().
6352 *
6353 * @param parent
6354 * the dir where the new symlink will be created
6355 * @param name
6356 * name for the new symlink.
6357 * @param dest
6358 * destination of the link
6359 * @param link
6360 * place where to store a pointer to the newly created link.
6361 * @return
6362 * number of nodes in parent if success, < 0 otherwise
6363 * Possible errors:
6364 * ISO_NULL_POINTER, if parent, name or dest are NULL
6365 * ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists
6366 * ISO_OUT_OF_MEM
6367 *
6368 * @since 0.6.2
6369 */
6370int iso_tree_add_new_symlink(IsoDir *parent, const char *name,
6371 const char *dest, IsoSymlink **link);
6372
6373/**
6374 * Add a new special file to the directory tree. As far as libisofs concerns,
6375 * a special file is a block device, a character device, a FIFO (named pipe)
6376 * or a socket. You can choose the specific kind of file you want to add
6377 * by setting mode properly (see man 2 stat).
6378 *
6379 * Note that special files are only written to image when Rock Ridge
6380 * extensions are enabled. Moreover, a special file is just a directory entry
6381 * in the image tree, no data is written beyond that.
6382 *
6383 * Owner and hidden atts are taken from parent. You can modify any of them
6384 * later.
6385 *
6386 * @param image
6387 * The image object to which the new special file shall belong.
6388 * @param parent
6389 * The directory node where the new special file will be grafted in.
6390 * @param name
6391 * Name for the new special file. If truncation mode is set to 1,
6392 * an oversized name gets truncated before further processing.
6393 * If a node with same name already exists on parent, this function
6394 * fails with ISO_NODE_NAME_NOT_UNIQUE.
6395 * @param mode
6396 * File type and permissions for the new node. Note that only the file
6397 * types S_IFSOCK, S_IFBLK, S_IFCHR, and S_IFIFO are allowed.
6398 * S_IFLNK, S_IFREG, or S_IFDIR are not.
6399 * @param dev
6400 * Device ID, equivalent to the st_rdev field in man 2 stat.
6401 * @param special
6402 * Place where to store a pointer to the newly created special file. No
6403 * extra ref is added, so you will need to call iso_node_ref() if you
6404 * really need it. You can pass NULL in this parameter if you don't need
6405 * the pointer.
6406 * @return
6407 * Number of nodes in parent if success, < 0 otherwise
6408 * Possible errors:
6409 * ISO_NULL_POINTER, if parent, name or dest are NULL
6410 * ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists
6411 * ISO_WRONG_ARG_VALUE if you select a incorrect mode
6412 * ISO_OUT_OF_MEM
6413 * ISO_RR_NAME_TOO_LONG
6414 *
6415 * @since 1.4.2
6416 */
6418 const char *name, mode_t mode,
6419 dev_t dev, IsoSpecial **special);
6420
6421/**
6422 * *** Deprecated ***
6423 * use iso_image_add_new_special() instead
6424 *
6425 * Add a new special file to the directory tree without taking into respect name
6426 * truncation mode of an IsoImage.
6427 * For detailed description of parameters, see above
6428 * iso_image_add_new_special().
6429 *
6430 * @param parent
6431 * the dir where the new special file will be created
6432 * @param name
6433 * name for the new special file.
6434 * @param mode
6435 * file type and permissions for the new node.
6436 * @param dev
6437 * device ID, equivalent to the st_rdev field in man 2 stat.
6438 * @param special
6439 * place where to store a pointer to the newly created special file.
6440 * @return
6441 * number of nodes in parent if success, < 0 otherwise
6442 * Possible errors:
6443 * ISO_NULL_POINTER, if parent, name or dest are NULL
6444 * ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists
6445 * ISO_WRONG_ARG_VALUE if you select a incorrect mode
6446 * ISO_OUT_OF_MEM
6447 *
6448 * @since 0.6.2
6449 */
6450int iso_tree_add_new_special(IsoDir *parent, const char *name, mode_t mode,
6451 dev_t dev, IsoSpecial **special);
6452
6453/**
6454 * Set whether to follow or not symbolic links when added a file from a source
6455 * to IsoImage. Default behavior is to not follow symlinks.
6456 *
6457 * @since 0.6.2
6458 */
6460
6461/**
6462 * Get current setting for follow_symlinks.
6463 *
6464 * @see iso_tree_set_follow_symlinks
6465 * @since 0.6.2
6466 */
6468
6469/**
6470 * Set whether to skip or not disk files with names beginning by '.'
6471 * when adding a directory recursively.
6472 * Default behavior is to not ignore them.
6473 *
6474 * Clarification: This is not related to the IsoNode property to be hidden
6475 * in one or more of the resulting image trees as of
6476 * IsoHideNodeFlag and iso_node_set_hidden().
6477 *
6478 * @since 0.6.2
6479 */
6481
6482/**
6483 * Get current setting for ignore_hidden.
6484 *
6485 * @see iso_tree_set_ignore_hidden
6486 * @since 0.6.2
6487 */
6489
6490/**
6491 * Set the replace mode, that defines the behavior of libisofs when adding
6492 * a node whit the same name that an existent one, during a recursive
6493 * directory addition.
6494 *
6495 * @since 0.6.2
6496 */
6498
6499/**
6500 * Get current setting for replace_mode.
6501 *
6502 * @see iso_tree_set_replace_mode
6503 * @since 0.6.2
6504 */
6506
6507/**
6508 * Set whether to skip or not special files. Default behavior is to not skip
6509 * them. Note that, despite of this setting, special files will never be added
6510 * to an image unless RR extensions were enabled.
6511 *
6512 * @param image
6513 * The image to manipulate.
6514 * @param skip
6515 * Bitmask to determine what kind of special files will be skipped:
6516 * bit0: ignore FIFOs
6517 * bit1: ignore Sockets
6518 * bit2: ignore char devices
6519 * bit3: ignore block devices
6520 *
6521 * @since 0.6.2
6522 */
6524
6525/**
6526 * Get current setting for ignore_special.
6527 *
6528 * @see iso_tree_set_ignore_special
6529 * @since 0.6.2
6530 */
6532
6533/**
6534 * Add a excluded path. These are paths that won't never added to image, and
6535 * will be excluded even when adding recursively its parent directory.
6536 *
6537 * For example, in
6538 *
6539 * iso_tree_add_exclude(image, "/home/user/data/private");
6540 * iso_tree_add_dir_rec(image, root, "/home/user/data");
6541 *
6542 * the directory /home/user/data/private won't be added to image.
6543 *
6544 * However, if you explicitly add a deeper dir, it won't be excluded. i.e.,
6545 * in the following example.
6546 *
6547 * iso_tree_add_exclude(image, "/home/user/data");
6548 * iso_tree_add_dir_rec(image, root, "/home/user/data/private");
6549 *
6550 * the directory /home/user/data/private is added. On the other, side, and
6551 * following the example above,
6552 *
6553 * iso_tree_add_dir_rec(image, root, "/home/user");
6554 *
6555 * will exclude the directory "/home/user/data".
6556 *
6557 * Absolute paths are not mandatory, you can, for example, add a relative
6558 * path such as:
6559 *
6560 * iso_tree_add_exclude(image, "private");
6561 * iso_tree_add_exclude(image, "user/data");
6562 *
6563 * to exclude, respectively, all files or dirs named private, and also all
6564 * files or dirs named data that belong to a folder named "user". Note that the
6565 * above rule about deeper dirs is still valid. i.e., if you call
6566 *
6567 * iso_tree_add_dir_rec(image, root, "/home/user/data/music");
6568 *
6569 * it is included even containing "user/data" string. However, a possible
6570 * "/home/user/data/music/user/data" is not added.
6571 *
6572 * Usual wildcards, such as * or ? are also supported, with the usual meaning
6573 * as stated in "man 7 glob". For example
6574 *
6575 * // to exclude backup text files
6576 * iso_tree_add_exclude(image, "*.~");
6577 *
6578 * @return
6579 * 1 on success, < 0 on error
6580 *
6581 * @since 0.6.2
6582 */
6583int iso_tree_add_exclude(IsoImage *image, const char *path);
6584
6585/**
6586 * Remove a previously added exclude.
6587 *
6588 * @see iso_tree_add_exclude
6589 * @return
6590 * 1 on success, 0 exclude do not exists, < 0 on error
6591 *
6592 * @since 0.6.2
6593 */
6594int iso_tree_remove_exclude(IsoImage *image, const char *path);
6595
6596/**
6597 * Set a callback function that libisofs will call for each file that is
6598 * added to the given image by a recursive addition function. This includes
6599 * image import.
6600 *
6601 * @param image
6602 * The image to manipulate.
6603 * @param report
6604 * pointer to a function that will be called just before a file will be
6605 * added to the image. You can control whether the file will be in fact
6606 * added or ignored.
6607 * This function should return 1 to add the file, 0 to ignore it and
6608 * continue, < 0 to abort the process
6609 * NULL is allowed if you don't want any callback.
6610 *
6611 * @since 0.6.2
6612 */
6614 int (*report)(IsoImage*, IsoFileSource*));
6615
6616/**
6617 * Add a new node to the image tree, from an existing file.
6618 *
6619 * TODO comment Builder and Filesystem related issues when exposing both
6620 *
6621 * All attributes will be taken from the source file. The appropriate file
6622 * type will be created.
6623 *
6624 * @param image
6625 * The image
6626 * @param parent
6627 * The directory in the image tree where the node will be added.
6628 * @param path
6629 * The absolute path of the file in the local filesystem.
6630 * The node will have the same leaf name as the file on disk, possibly
6631 * truncated according to iso_image_set_truncate_mode().
6632 * Its directory path depends on the parent node.
6633 * @param node
6634 * place where to store a pointer to the newly added file. No
6635 * extra ref is added, so you will need to call iso_node_ref() if you
6636 * really need it. You can pass NULL in this parameter if you don't need
6637 * the pointer.
6638 * @return
6639 * number of nodes in parent if success, < 0 otherwise
6640 * Possible errors:
6641 * ISO_NULL_POINTER, if image, parent or path are NULL
6642 * ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists
6643 * ISO_OUT_OF_MEM
6644 * ISO_RR_NAME_TOO_LONG
6645 *
6646 * @since 0.6.2
6647 */
6648int iso_tree_add_node(IsoImage *image, IsoDir *parent, const char *path,
6649 IsoNode **node);
6650
6651/**
6652 * This is a more versatile form of iso_tree_add_node which allows to set
6653 * the node name in ISO image already when it gets added.
6654 *
6655 * Add a new node to the image tree, from an existing file, and with the
6656 * given name, that must not exist on dir.
6657 *
6658 * @param image
6659 * The image
6660 * @param parent
6661 * The directory in the image tree where the node will be added.
6662 * @param name
6663 * The leaf name that the node will have on image, possibly truncated
6664 * according to iso_image_set_truncate_mode().
6665 * Its directory path depends on the parent node.
6666 * @param path
6667 * The absolute path of the file in the local filesystem.
6668 * @param node
6669 * place where to store a pointer to the newly added file. No
6670 * extra ref is added, so you will need to call iso_node_ref() if you
6671 * really need it. You can pass NULL in this parameter if you don't need
6672 * the pointer.
6673 * @return
6674 * number of nodes in parent if success, < 0 otherwise
6675 * Possible errors:
6676 * ISO_NULL_POINTER, if image, parent or path are NULL
6677 * ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists
6678 * ISO_OUT_OF_MEM
6679 * ISO_RR_NAME_TOO_LONG
6680 *
6681 * @since 0.6.4
6682 */
6683int iso_tree_add_new_node(IsoImage *image, IsoDir *parent, const char *name,
6684 const char *path, IsoNode **node);
6685
6686/**
6687 * Add a new node to the image tree with the given name that must not exist
6688 * on dir. The node data content will be a byte interval out of the data
6689 * content of a file in the local filesystem.
6690 *
6691 * @param image
6692 * The image
6693 * @param parent
6694 * The directory in the image tree where the node will be added.
6695 * @param name
6696 * The leaf name that the node will have on image, possibly truncated
6697 * according to iso_image_set_truncate_mode().
6698 * Its directory path depends on the parent node.
6699 * @param path
6700 * The absolute path of the random-access capable file in the local
6701 * filesystem. Only regular files and device files are supported.
6702 * On Linux, only regular files and block device offer random-access.
6703 * @param offset
6704 * Byte number in the given file from where to start reading data.
6705 * @param size
6706 * Max size of the file. This may be more than actually available from
6707 * byte offset to the end of the file in the local filesystem.
6708 * @param node
6709 * place where to store a pointer to the newly added file. No
6710 * extra ref is added, so you will need to call iso_node_ref() if you
6711 * really need it. You can pass NULL in this parameter if you don't need
6712 * the pointer.
6713 * @return
6714 * number of nodes in parent if success, < 0 otherwise
6715 * Possible errors:
6716 * ISO_NULL_POINTER, if image, parent or path are NULL
6717 * ISO_NODE_NAME_NOT_UNIQUE, a node with same name already exists
6718 * ISO_OUT_OF_MEM
6719 * ISO_RR_NAME_TOO_LONG
6720 * ISO_WRONG_ARG_VALUE, if path is not suitable for random access
6721 *
6722 * @since 0.6.4
6723 *
6724 * Device files as path: @since 1.5.6
6725 */
6727 const char *name, const char *path,
6728 off_t offset, off_t size,
6729 IsoNode **node);
6730
6731/**
6732 * Create a copy of the given node under a different path. If the node is
6733 * actually a directory then clone its whole subtree.
6734 * This call may fail because an IsoFile is encountered which gets fed by an
6735 * IsoStream which cannot be cloned. See also IsoStream_Iface method
6736 * clone_stream().
6737 * Surely clonable node types are:
6738 * IsoDir,
6739 * IsoSymlink,
6740 * IsoSpecial,
6741 * IsoFile from a loaded ISO image,
6742 * IsoFile referring to local filesystem files,
6743 * IsoFile created by iso_tree_add_new_file
6744 * from a stream created by iso_memory_stream_new(),
6745 * IsoFile created by iso_tree_add_new_cut_out_node()
6746 * Silently ignored are nodes of type IsoBoot.
6747 * An IsoFile node with IsoStream filters can be cloned if all those filters
6748 * are clonable and the node would be clonable without filter.
6749 * Clonable IsoStream filters are created by:
6750 * iso_file_add_zisofs_filter()
6751 * iso_file_add_gzip_filter()
6752 * iso_file_add_external_filter()
6753 * An IsoNode with extended information as of iso_node_add_xinfo() can only be
6754 * cloned if each of the iso_node_xinfo_func instances is associated to a
6755 * clone function. See iso_node_xinfo_make_clonable().
6756 * All internally used classes of extended information are clonable.
6757 *
6758 * The IsoImage context defines a maximum permissible name length and a mode
6759 * how to react on oversized names. See iso_image_set_truncate_mode().
6760 *
6761 * @param image
6762 * The image object to which the node belongs.
6763 * @param node
6764 * The node to be cloned.
6765 * @param new_parent
6766 * The existing directory node where to insert the cloned node.
6767 * @param new_name
6768 * The name for the cloned node. It must not yet exist in new_parent,
6769 * unless it is a directory and node is a directory and flag bit0 is set.
6770 * @param new_node
6771 * Will return a pointer (without reference) to the newly created clone.
6772 * @param flag
6773 * Bitfield for control purposes. Submit any undefined bits as 0.
6774 * bit0= Merge directories rather than returning ISO_NODE_NAME_NOT_UNIQUE.
6775 * This will not allow to overwrite any existing node.
6776 * Attributes of existing directories will not be overwritten.
6777 * bit1= issue warning in case of new_name truncation
6778 * @return
6779 * <0 means error, 1 = new node created,
6780 * 2 = if flag bit0 is set: new_node is a directory which already existed.
6781 *
6782 * @since 1.4.2
6783 */
6784int iso_image_tree_clone(IsoImage *image, IsoNode *node, IsoDir *new_parent,
6785 char *new_name, IsoNode **new_node, int flag);
6786
6787/**
6788 * *** Deprecated ***
6789 * use iso_image_tree_clone() instead
6790 *
6791 * Create a copy of the given node under a different path without taking
6792 * into respect name truncation mode of an IsoImage.
6793 *
6794 * @param node
6795 * The node to be cloned.
6796 * @param new_parent
6797 * The existing directory node where to insert the cloned node.
6798 * @param new_name
6799 * The name for the cloned node. It must not yet exist in new_parent,
6800 * unless it is a directory and node is a directory and flag bit0 is set.
6801 * @param new_node
6802 * Will return a pointer (without reference) to the newly created clone.
6803 * @param flag
6804 * Bitfield for control purposes. Submit any undefined bits as 0.
6805 * bit0= Merge directories rather than returning ISO_NODE_NAME_NOT_UNIQUE.
6806 * This will not allow to overwrite any existing node.
6807 * Attributes of existing directories will not be overwritten.
6808 * @return
6809 * <0 means error, 1 = new node created,
6810 * 2 = if flag bit0 is set: new_node is a directory which already existed.
6811 *
6812 * @since 1.0.2
6813 */
6815 IsoDir *new_parent, char *new_name, IsoNode **new_node,
6816 int flag);
6817
6818/**
6819 * Add the contents of a dir to a given directory of the iso tree.
6820 *
6821 * There are several options to control what files are added or how they are
6822 * managed. Take a look at iso_tree_set_* functions to see different options
6823 * for recursive directory addition.
6824 *
6825 * TODO comment Builder and Filesystem related issues when exposing both
6826 *
6827 * @param image
6828 * The image to which the directory belongs.
6829 * @param parent
6830 * Directory on the image tree where to add the contents of the dir
6831 * @param dir
6832 * Path to a dir in the filesystem
6833 * @return
6834 * number of nodes in parent if success, < 0 otherwise
6835 *
6836 * @since 0.6.2
6837 */
6838int iso_tree_add_dir_rec(IsoImage *image, IsoDir *parent, const char *dir);
6839
6840/**
6841 * Inquire whether some local filesystem xattr namespace could not be explored
6842 * during node building.This may happen due to lack of administrator privileges
6843 * e.g. on FreeBSD namespace "system".
6844 * It may well be that the processed local files have no attributes which
6845 * would require special privileges. But already their existence was neither
6846 * denied nor confirmed.
6847 *
6848 * @param image
6849 * The image to inquire.
6850 * @param flag
6851 * Bitfield for control purposes:
6852 * bit0 = reset internal value to 0
6853 * @return
6854 * 1 = Exploration was prevented
6855 * 0 = No such prevention occurred
6856 *
6857 * @since 1.5.0
6858 */
6860
6861
6862/**
6863 * Locate a node by its absolute path in the image.
6864 * The IsoImage context defines a maximum permissible name length and a mode
6865 * how to react on oversized names. See iso_image_set_truncate_mode().
6866 *
6867 * @param image
6868 * The image to which the node belongs.
6869 * @param path
6870 * File path beginning at the root directory of image. If truncation mode
6871 * is set to 1, oversized path components will be truncated before lookup.
6872 * @param node
6873 * Location for a pointer to the node, it will be filled with NULL if the
6874 * given path does not exists on image.
6875 * The node will be owned by the image and shouldn't be unref(). Just call
6876 * iso_node_ref() to get your own reference to the node.
6877 * Note that you can pass NULL is the only thing you want to do is check
6878 * if a node with such path really exists.
6879 *
6880 * @return
6881 * 1 node found
6882 * 0 no truncation was needed, path not found in image
6883 * 2 truncation happened, truncated path component not found in parent dir
6884 * < 0 error, see iso_dir_get_node().
6885 *
6886 * @since 1.4.2
6887 */
6888int iso_image_path_to_node(IsoImage *image, const char *path, IsoNode **node);
6889
6890/**
6891 * *** Deprecated ***
6892 * In most cases use iso_image_path_to_node() instead
6893 *
6894 * Locate a node by its absolute path on image without taking into respect
6895 * name truncation mode of the image.
6896 *
6897 * @param image
6898 * The image to which the node belongs.
6899 * @param path
6900 * File path beginning at the root directory of image. No truncation will
6901 * happen.
6902 * @param node
6903 * Location for a pointer to the node, it will be filled with NULL if the
6904 * given path does not exists on image. See iso_image_path_to_node().
6905 * @return
6906 * 1 found, 0 not found, < 0 error
6907 *
6908 * @since 0.6.2
6909 */
6910int iso_tree_path_to_node(IsoImage *image, const char *path, IsoNode **node);
6911
6912/**
6913 * Get the absolute path on image of the given node.
6914 *
6915 * @return
6916 * The path on the image, that must be freed when no more needed. If the
6917 * given node is not added to any image, this returns NULL.
6918 * @since 0.6.4
6919 */
6921
6922/**
6923 * Get the destination node of a symbolic link within the IsoImage.
6924 *
6925 * @param img
6926 * The image wherein to try resolving the link.
6927 * @param sym
6928 * The symbolic link node which to resolve.
6929 * @param res
6930 * Will return the found destination node, in case of success.
6931 * Call iso_node_ref() / iso_node_unref() if you intend to use the node
6932 * over API calls which might in any event delete it.
6933 * @param depth
6934 * Prevents endless loops. Submit as 0.
6935 * @param flag
6936 * Bitfield for control purposes. Submit 0 for now.
6937 * @return
6938 * 1 on success,
6939 * < 0 on failure, especially ISO_DEEP_SYMLINK and ISO_DEAD_SYMLINK
6940 *
6941 * @since 1.2.4
6942 */
6944 int *depth, int flag);
6945
6946/* Maximum number link resolution steps before ISO_DEEP_SYMLINK gets
6947 * returned by iso_tree_resolve_symlink().
6948 *
6949 * @since 1.2.4
6950*/
6951#define LIBISO_MAX_LINK_DEPTH 100
6952
6953/**
6954 * Increments the reference counting of the given IsoDataSource.
6955 *
6956 * @since 0.6.2
6957 */
6959
6960/**
6961 * Decrements the reference counting of the given IsoDataSource, freeing it
6962 * if refcount reach 0.
6963 *
6964 * @since 0.6.2
6965 */
6967
6968/**
6969 * Create a new IsoDataSource from a local file. This is suitable for
6970 * accessing regular files or block devices with ISO images.
6971 *
6972 * @param path
6973 * The absolute path of the file
6974 * @param src
6975 * Will be filled with the pointer to the newly created data source.
6976 * @return
6977 * 1 on success, < 0 on error.
6978 *
6979 * @since 0.6.2
6980 */
6982
6983/**
6984 * Get the status of the buffer used by a burn_source.
6985 *
6986 * @param b
6987 * A burn_source previously obtained with
6988 * iso_image_create_burn_source().
6989 * @param size
6990 * Will be filled with the total size of the buffer, in bytes
6991 * @param free_bytes
6992 * Will be filled with the bytes currently available in buffer
6993 * @return
6994 * < 0 error, > 0 state:
6995 * 1="active" : input and consumption are active
6996 * 2="ending" : input has ended without error
6997 * 3="failing" : input had error and ended,
6998 * 5="abandoned" : consumption has ended prematurely
6999 * 6="ended" : consumption has ended without input error
7000 * 7="aborted" : consumption has ended after input error
7001 *
7002 * @since 0.6.2
7003 */
7004int iso_ring_buffer_get_status(struct burn_source *b, size_t *size,
7005 size_t *free_bytes);
7006
7007#define ISO_MSGS_MESSAGE_LEN 4096
7008
7009/**
7010 * Control queueing and stderr printing of messages from libisofs.
7011 * Severity may be one of "NEVER", "FATAL", "SORRY", "WARNING", "HINT",
7012 * "NOTE", "UPDATE", "DEBUG", "ALL".
7013 *
7014 * @param queue_severity Gives the minimum limit for messages to be queued.
7015 * Default: "NEVER". If you queue messages then you
7016 * must consume them by iso_obtain_msgs().
7017 * @param print_severity Does the same for messages to be printed directly
7018 * to stderr.
7019 * @param print_id A text prefix to be printed before the message.
7020 * @return >0 for success, <=0 for error
7021 *
7022 * @since 0.6.2
7023 */
7024int iso_set_msgs_severities(char *queue_severity, char *print_severity,
7025 char *print_id);
7026
7027/**
7028 * Obtain the oldest pending libisofs message from the queue which has at
7029 * least the given minimum_severity. This message and any older message of
7030 * lower severity will get discarded from the queue and is then lost forever.
7031 *
7032 * Severity may be one of "NEVER", "FATAL", "SORRY", "WARNING", "HINT",
7033 * "NOTE", "UPDATE", "DEBUG", "ALL". To call with minimum_severity "NEVER"
7034 * will discard the whole queue.
7035 *
7036 * @param minimum_severity
7037 * Threshold
7038 * @param error_code
7039 * Will become a unique error code as listed at the end of this header
7040 * @param imgid
7041 * Id of the image that was issued the message.
7042 * @param msg_text
7043 * Must provide at least ISO_MSGS_MESSAGE_LEN bytes.
7044 * @param severity
7045 * Will become the severity related to the message and should provide at
7046 * least 80 bytes.
7047 * @return
7048 * 1 if a matching item was found, 0 if not, <0 for severe errors
7049 *
7050 * @since 0.6.2
7051 */
7052int iso_obtain_msgs(char *minimum_severity, int *error_code, int *imgid,
7053 char msg_text[], char severity[]);
7054
7055
7056/**
7057 * Submit a message to the libisofs queueing system. It will be queued or
7058 * printed as if it was generated by libisofs itself.
7059 *
7060 * @param error_code
7061 * The unique error code of your message.
7062 * Submit 0 if you do not have reserved error codes within the libburnia
7063 * project.
7064 * @param msg_text
7065 * Not more than ISO_MSGS_MESSAGE_LEN characters of message text.
7066 * @param os_errno
7067 * errno related to the message. Submit 0 if the message is not related
7068 * to an operating system error.
7069 * @param severity
7070 * One of "ABORT", "FATAL", "FAILURE", "SORRY", "WARNING", "HINT", "NOTE",
7071 * "UPDATE", "DEBUG". Defaults to "FATAL".
7072 * @param origin
7073 * Submit 0 for now.
7074 * @return
7075 * 1 if message was delivered, <=0 if failure
7076 *
7077 * @since 0.6.4
7078 */
7079int iso_msgs_submit(int error_code, char msg_text[], int os_errno,
7080 char severity[], int origin);
7081
7082
7083/**
7084 * Convert a severity name into a severity number, which gives the severity
7085 * rank of the name.
7086 *
7087 * @param severity_name
7088 * A name as with iso_msgs_submit(), e.g. "SORRY".
7089 * @param severity_number
7090 * The rank number: the higher, the more severe.
7091 * @return
7092 * >0 success, <=0 failure
7093 *
7094 * @since 0.6.4
7095 */
7096int iso_text_to_sev(char *severity_name, int *severity_number);
7097
7098
7099/**
7100 * Convert a severity number into a severity name
7101 *
7102 * @param severity_number
7103 * The rank number: the higher, the more severe.
7104 * @param severity_name
7105 * A name as with iso_msgs_submit(), e.g. "SORRY".
7106 *
7107 * @since 0.6.4
7108 */
7109int iso_sev_to_text(int severity_number, char **severity_name);
7110
7111
7112/**
7113 * Get the id of an IsoImage, used for message reporting. This message id,
7114 * retrieved with iso_obtain_msgs(), can be used to distinguish what
7115 * IsoImage has issued a given message.
7116 *
7117 * @since 0.6.2
7118 */
7120
7121/**
7122 * Get a textual description of a libisofs error.
7123 *
7124 * @since 0.6.2
7125 */
7126const char *iso_error_to_msg(int errcode);
7127
7128/**
7129 * Get the severity of a given error code
7130 * @return
7131 * 0x10000000 -> DEBUG
7132 * 0x20000000 -> UPDATE
7133 * 0x30000000 -> NOTE
7134 * 0x40000000 -> HINT
7135 * 0x50000000 -> WARNING
7136 * 0x60000000 -> SORRY
7137 * 0x64000000 -> MISHAP
7138 * 0x68000000 -> FAILURE
7139 * 0x70000000 -> FATAL
7140 * 0x71000000 -> ABORT
7141 *
7142 * @since 0.6.2
7143 */
7145
7146/**
7147 * Get the priority of a given error.
7148 * @return
7149 * 0x00000000 -> ZERO
7150 * 0x10000000 -> LOW
7151 * 0x20000000 -> MEDIUM
7152 * 0x30000000 -> HIGH
7153 *
7154 * @since 0.6.2
7155 */
7157
7158/**
7159 * Get the message queue code of a libisofs error.
7160 */
7162
7163/**
7164 * Set the minimum error severity that causes a libisofs operation to
7165 * be aborted as soon as possible.
7166 *
7167 * @param severity
7168 * one of "FAILURE", "MISHAP", "SORRY", "WARNING", "HINT", "NOTE".
7169 * Severities greater or equal than FAILURE always cause program to abort.
7170 * Severities under NOTE won't never cause function abort.
7171 * @return
7172 * Previous abort priority on success, < 0 on error.
7173 *
7174 * @since 0.6.2
7175 */
7176int iso_set_abort_severity(char *severity);
7177
7178/**
7179 * Return the messenger object handle used by libisofs. This handle
7180 * may be used by related libraries to their own compatible
7181 * messenger objects and thus to direct their messages to the libisofs
7182 * message queue. See also: libburn, API function burn_set_messenger().
7183 *
7184 * @return the handle. Do only use with compatible
7185 *
7186 * @since 0.6.2
7187 */
7189
7190/**
7191 * Take a ref to the given IsoFileSource.
7192 *
7193 * @since 0.6.2
7194 */
7196
7197/**
7198 * Drop your ref to the given IsoFileSource, freeing the associated system
7199 * resources if not still needed by other objects.
7200 *
7201 * @since 0.6.2
7202 */
7204
7205/*
7206 * this are just helpers to invoque methods in class
7207 */
7208
7209/**
7210 * Get the absolute path in the filesystem this file source belongs to.
7211 *
7212 * @return
7213 * the path of the FileSource inside the filesystem, it should be
7214 * freed when no more needed.
7215 *
7216 * @since 0.6.2
7217 */
7219
7220/**
7221 * Get the name of the file, with the dir component of the path.
7222 *
7223 * @return
7224 * the name of the file, it should be freed when no more needed.
7225 *
7226 * @since 0.6.2
7227 */
7229
7230/**
7231 * Get information about the file.
7232 * @return
7233 * 1 success, < 0 error
7234 * Error codes:
7235 * ISO_FILE_ACCESS_DENIED
7236 * ISO_FILE_BAD_PATH
7237 * ISO_FILE_DOESNT_EXIST
7238 * ISO_OUT_OF_MEM
7239 * ISO_FILE_ERROR
7240 * ISO_NULL_POINTER
7241 *
7242 * @since 0.6.2
7243 */
7244int iso_file_source_lstat(IsoFileSource *src, struct stat *info);
7245
7246/**
7247 * Check if the process has access to read file contents. Note that this
7248 * is not necessarily related with (l)stat functions. For example, in a
7249 * filesystem implementation to deal with an ISO image, if the user has
7250 * read access to the image it will be able to read all files inside it,
7251 * despite of the particular permission of each file in the RR tree, that
7252 * are what the above functions return.
7253 *
7254 * @return
7255 * 1 if process has read access, < 0 on error
7256 * Error codes:
7257 * ISO_FILE_ACCESS_DENIED
7258 * ISO_FILE_BAD_PATH
7259 * ISO_FILE_DOESNT_EXIST
7260 * ISO_OUT_OF_MEM
7261 * ISO_FILE_ERROR
7262 * ISO_NULL_POINTER
7263 *
7264 * @since 0.6.2
7265 */
7267
7268/**
7269 * Get information about the file. If the file is a symlink, the info
7270 * returned refers to the destination.
7271 *
7272 * @return
7273 * 1 success, < 0 error
7274 * Error codes:
7275 * ISO_FILE_ACCESS_DENIED
7276 * ISO_FILE_BAD_PATH
7277 * ISO_FILE_DOESNT_EXIST
7278 * ISO_OUT_OF_MEM
7279 * ISO_FILE_ERROR
7280 * ISO_NULL_POINTER
7281 *
7282 * @since 0.6.2
7283 */
7284int iso_file_source_stat(IsoFileSource *src, struct stat *info);
7285
7286/**
7287 * Opens the source.
7288 * @return 1 on success, < 0 on error
7289 * Error codes:
7290 * ISO_FILE_ALREADY_OPENED
7291 * ISO_FILE_ACCESS_DENIED
7292 * ISO_FILE_BAD_PATH
7293 * ISO_FILE_DOESNT_EXIST
7294 * ISO_OUT_OF_MEM
7295 * ISO_FILE_ERROR
7296 * ISO_NULL_POINTER
7297 *
7298 * @since 0.6.2
7299 */
7301
7302/**
7303 * Close a previously opened file
7304 * @return 1 on success, < 0 on error
7305 * Error codes:
7306 * ISO_FILE_ERROR
7307 * ISO_NULL_POINTER
7308 * ISO_FILE_NOT_OPENED
7309 *
7310 * @since 0.6.2
7311 */
7313
7314/**
7315 * Attempts to read up to count bytes from the given source into
7316 * the buffer starting at buf.
7317 *
7318 * The file src must be open() before calling this, and close() when no
7319 * more needed. Not valid for dirs. On symlinks it reads the destination
7320 * file.
7321 *
7322 * @param src
7323 * The given source
7324 * @param buf
7325 * Pointer to a buffer of at least count bytes where the read data will be
7326 * stored
7327 * @param count
7328 * Bytes to read
7329 * @return
7330 * number of bytes read, 0 if EOF, < 0 on error
7331 * Error codes:
7332 * ISO_FILE_ERROR
7333 * ISO_NULL_POINTER
7334 * ISO_FILE_NOT_OPENED
7335 * ISO_WRONG_ARG_VALUE -> if count == 0
7336 * ISO_FILE_IS_DIR
7337 * ISO_OUT_OF_MEM
7338 * ISO_INTERRUPTED
7339 *
7340 * @since 0.6.2
7341 */
7342int iso_file_source_read(IsoFileSource *src, void *buf, size_t count);
7343
7344/**
7345 * Repositions the offset of the given IsoFileSource (must be opened) to the
7346 * given offset according to the value of flag.
7347 *
7348 * @param src
7349 * The given source
7350 * @param offset
7351 * in bytes
7352 * @param flag
7353 * 0 The offset is set to offset bytes (SEEK_SET)
7354 * 1 The offset is set to its current location plus offset bytes
7355 * (SEEK_CUR)
7356 * 2 The offset is set to the size of the file plus offset bytes
7357 * (SEEK_END).
7358 * @return
7359 * Absolute offset position on the file, or < 0 on error. Cast the
7360 * returning value to int to get a valid libisofs error.
7361 * @since 0.6.4
7362 */
7363off_t iso_file_source_lseek(IsoFileSource *src, off_t offset, int flag);
7364
7365/**
7366 * Read a directory.
7367 *
7368 * Each call to this function will return a new child, until we reach
7369 * the end of file (i.e, no more children), in that case it returns 0.
7370 *
7371 * The dir must be open() before calling this, and close() when no more
7372 * needed. Only valid for dirs.
7373 *
7374 * Note that "." and ".." children MUST NOT BE returned.
7375 *
7376 * @param src
7377 * The given source
7378 * @param child
7379 * pointer to be filled with the given child. Undefined on error or OEF
7380 * @return
7381 * 1 on success, 0 if EOF (no more children), < 0 on error
7382 * Error codes:
7383 * ISO_FILE_ERROR
7384 * ISO_NULL_POINTER
7385 * ISO_FILE_NOT_OPENED
7386 * ISO_FILE_IS_NOT_DIR
7387 * ISO_OUT_OF_MEM
7388 *
7389 * @since 0.6.2
7390 */
7392
7393/**
7394 * Read the destination of a symlink. You don't need to open the file
7395 * to call this.
7396 *
7397 * @param src
7398 * An IsoFileSource corresponding to a symbolic link.
7399 * @param buf
7400 * Allocated buffer of at least bufsiz bytes.
7401 * The destination string will be copied there, and it will be 0-terminated
7402 * if the return value indicates success or ISO_RR_PATH_TOO_LONG.
7403 * @param bufsiz
7404 * Maximum number of buf characters + 1. The string will be truncated if
7405 * it is larger than bufsiz - 1 and ISO_RR_PATH_TOO_LONG. will be returned.
7406 * @return
7407 * 1 on success, < 0 on error
7408 * Error codes:
7409 * ISO_FILE_ERROR
7410 * ISO_NULL_POINTER
7411 * ISO_WRONG_ARG_VALUE -> if bufsiz <= 0
7412 * ISO_FILE_IS_NOT_SYMLINK
7413 * ISO_OUT_OF_MEM
7414 * ISO_FILE_BAD_PATH
7415 * ISO_FILE_DOESNT_EXIST
7416 * ISO_RR_PATH_TOO_LONG (@since 1.0.6)
7417 *
7418 * @since 0.6.2
7419 */
7420int iso_file_source_readlink(IsoFileSource *src, char *buf, size_t bufsiz);
7421
7422
7423/**
7424 * Get the AAIP string with encoded ACL and xattr.
7425 * (Not to be confused with ECMA-119 Extended Attributes).
7426 * @param src The file source object to be inquired.
7427 * @param aa_string Returns a pointer to the AAIP string data. If no AAIP
7428 * string is available, *aa_string becomes NULL.
7429 * (See doc/susp_aaip_2_0.txt for the meaning of AAIP.)
7430 * The caller is responsible for finally calling free()
7431 * on non-NULL results.
7432 * @param flag Bitfield for control purposes
7433 * bit0= Transfer ownership of AAIP string data.
7434 * src will free the possibly cached data and might
7435 * not be able to produce it again.
7436 * bit1= No need to get ACL (but no guarantee of exclusion)
7437 * bit2= No need to get xattr (but no guarantee of exclusion)
7438 * bit3= if not bit2: import all xattr namespaces from
7439 * local filesystem, not only "user."
7440 * @since 1.5.0
7441 * bit4= Try to get Linux-like file attribute flags (chattr)
7442 * as "isofs.fa"
7443 * @since 1.5.8
7444 * bit5= With bit4: Ignore non-settable Linux-like file
7445 * attribute flags and do not record "isofs.fa"
7446 * if the other flags are all zero
7447 * @since 1.5.8
7448 * bit6= Try to get XFS-style project id as "isofs.pi"
7449 * @since 1.5.8
7450 * @return 1 means success (*aa_string == NULL is possible)
7451 * <0 means failure and must b a valid libisofs error code
7452 * (e.g. ISO_FILE_ERROR if no better one can be found).
7453 * @since 0.6.14
7454 */
7456 unsigned char **aa_string, int flag);
7457
7458/**
7459 * Get the filesystem for this source. No extra ref is added, so you
7460 * must not unref the IsoFilesystem.
7461 *
7462 * @return
7463 * The filesystem, NULL on error
7464 *
7465 * @since 0.6.2
7466 */
7468
7469/**
7470 * Take a ref to the given IsoFilesystem
7471 *
7472 * @since 0.6.2
7473 */
7475
7476/**
7477 * Drop your ref to the given IsoFilesystem, evetually freeing associated
7478 * resources.
7479 *
7480 * @since 0.6.2
7481 */
7483
7484/**
7485 * Create a new IsoFilesystem to access a existent ISO image.
7486 *
7487 * @param src
7488 * Data source to access data.
7489 * @param opts
7490 * Image read options
7491 * @param msgid
7492 * An image identifier, obtained with iso_image_get_msg_id(), used to
7493 * associated messages issued by the filesystem implementation with an
7494 * existent image. If you are not using this filesystem in relation with
7495 * any image context, just use 0x1fffff as the value for this parameter.
7496 * @param fs
7497 * Will be filled with a pointer to the filesystem that can be used
7498 * to access image contents.
7499 * @return
7500 * 1 on success, < 0 on error
7501 *
7502 * @since 0.6.2
7503 */
7505 IsoImageFilesystem **fs);
7506
7507/**
7508 * Get the volset identifier for an existent image. The returned string belong
7509 * to the IsoImageFilesystem and shouldn't be free() nor modified.
7510 *
7511 * @since 0.6.2
7512 */
7514
7515/**
7516 * Get the volume identifier for an existent image. The returned string belong
7517 * to the IsoImageFilesystem and shouldn't be free() nor modified.
7518 *
7519 * @since 0.6.2
7520 */
7522
7523/**
7524 * Get the volume identifier of a loaded image from a particular filesystem
7525 * superblock.
7526 *
7527 * @param fs
7528 * The loaded filesystem shall be inquired.
7529 * @param fs_type
7530 * Chooses the filesystem superblock type from which the volume id was
7531 * read.
7532 * 0= ISO 9660 and Rock Ridge
7533 * 1= Joliet
7534 * 2= ISO 9660:1999
7535 * 3= HFS+
7536 * @return
7537 * The currently registered volume id for the given fs_type
7538 * The returned string is owned by the loaded filesystem and must not be
7539 * freed nor changed.
7540 *
7541 * @since 1.5.8
7542 */
7544
7545/**
7546 * Get the publisher identifier for an existent image. The returned string
7547 * belong to the IsoImageFilesystem and shouldn't be free() nor modified.
7548 *
7549 * @since 0.6.2
7550 */
7552
7553/**
7554 * Get the data preparer identifier for an existent image. The returned string
7555 * belong to the IsoImageFilesystem and shouldn't be free() nor modified.
7556 *
7557 * @since 0.6.2
7558 */
7560
7561/**
7562 * Get the system identifier for an existent image. The returned string belong
7563 * to the IsoImageFilesystem and shouldn't be free() nor modified.
7564 *
7565 * @since 0.6.2
7566 */
7568
7569/**
7570 * Get the application identifier for an existent image. The returned string
7571 * belong to the IsoImageFilesystem and shouldn't be free() nor modified.
7572 *
7573 * @since 0.6.2
7574 */
7576
7577/**
7578 * Get the copyright file identifier for an existent image. The returned string
7579 * belong to the IsoImageFilesystem and shouldn't be free() nor modified.
7580 *
7581 * @since 0.6.2
7582 */
7584
7585/**
7586 * Get the abstract file identifier for an existent image. The returned string
7587 * belong to the IsoImageFilesystem and shouldn't be free() nor modified.
7588 *
7589 * @since 0.6.2
7590 */
7592
7593/**
7594 * Get the biblio file identifier for an existent image. The returned string
7595 * belong to the IsoImageFilesystem and shouldn't be free() nor modified.
7596 *
7597 * @since 0.6.2
7598 */
7600
7601/**
7602 * Increment reference count of an IsoStream.
7603 *
7604 * @since 0.6.4
7605 */
7607
7608/**
7609 * Decrement reference count of an IsoStream, and free it if reference count
7610 * reaches 0.
7611 *
7612 * @since 0.6.4
7613 */
7615
7616/**
7617 * Opens the given stream. Remember to close the Stream before writing the
7618 * image.
7619 *
7620 * @return
7621 * 1 on success, 2 file greater than expected, 3 file smaller than
7622 * expected, < 0 on error
7623 *
7624 * @since 0.6.4
7625 */
7627
7628/**
7629 * Close a previously opened IsoStream.
7630 *
7631 * @return
7632 * 1 on success, < 0 on error
7633 *
7634 * @since 0.6.4
7635 */
7637
7638/**
7639 * Get the size of a given stream. This function should always return the same
7640 * size, even if the underlying source size changes, unless you call
7641 * iso_stream_update_size().
7642 *
7643 * @return
7644 * IsoStream size in bytes
7645 *
7646 * @since 0.6.4
7647 */
7649
7650/**
7651 * Attempts to read up to count bytes from the given stream into
7652 * the buffer starting at buf.
7653 *
7654 * The stream must be open() before calling this, and close() when no
7655 * more needed.
7656 *
7657 * @return
7658 * number of bytes read, 0 if EOF, < 0 on error
7659 *
7660 * @since 0.6.4
7661 */
7662int iso_stream_read(IsoStream *stream, void *buf, size_t count);
7663
7664/**
7665 * Whether the given IsoStream can be read several times, with the same
7666 * results.
7667 * For example, a regular file is repeatable, you can read it as many
7668 * times as you want. However, a pipe isn't.
7669 *
7670 * This function doesn't take into account if the file has been modified
7671 * between the two reads.
7672 *
7673 * @return
7674 * 1 if stream is repeatable, 0 if not, < 0 on error
7675 *
7676 * @since 0.6.4
7677 */
7679
7680/**
7681 * Updates the size of the IsoStream with the current size of the
7682 * underlying source.
7683 *
7684 * @return
7685 * 1 if ok, < 0 on error (has to be a valid libisofs error code),
7686 * 0 if the IsoStream does not support this function.
7687 * @since 0.6.8
7688 */
7690
7691/**
7692 * Get an unique identifier for a given IsoStream.
7693 *
7694 * @since 0.6.4
7695 */
7696void iso_stream_get_id(IsoStream *stream, unsigned int *fs_id, dev_t *dev_id,
7697 ino_t *ino_id);
7698
7699/**
7700 * Try to get the source path string of a stream. Meaning and availability
7701 * of this string depends on the stream.class . Expect valid results with
7702 * types "fsrc" and "cout". Result formats are
7703 * fsrc: result of file_source_get_path()
7704 * cout: result of file_source_get_path() " " offset " " size
7705 * @param stream
7706 * The stream to be inquired.
7707 * @param flag
7708 * Bitfield for control purposes, unused yet, submit 0
7709 * @return
7710 * A copy of the path string. Apply free() when no longer needed.
7711 * NULL if no path string is available.
7712 *
7713 * @since 0.6.18
7714 */
7715char *iso_stream_get_source_path(IsoStream *stream, int flag);
7716
7717/**
7718 * Compare two streams whether they are based on the same input and will
7719 * produce the same output. If in any doubt, then this comparison will
7720 * indicate no match.
7721 *
7722 * @param s1
7723 * The first stream to compare.
7724 * @param s2
7725 * The second stream to compare.
7726 * @return
7727 * -1 if s1 is smaller s2 , 0 if s1 matches s2 , 1 if s1 is larger s2
7728 * @param flag
7729 * bit0= do not use s1->class->cmp_ino() even if available
7730 *
7731 * @since 0.6.20
7732 */
7734
7735
7736/**
7737 * Produce a copy of a stream. It must be possible to operate both stream
7738 * objects concurrently. The success of this function depends on the
7739 * existence of a IsoStream_Iface.clone_stream() method with the stream
7740 * and with its subordinate streams, if there are any.
7741 * See iso_tree_clone() for a list of surely clonable built-in streams.
7742 *
7743 * @param old_stream
7744 * The existing stream object to be copied
7745 * @param new_stream
7746 * Will return a pointer to the copy
7747 * @param flag
7748 * Bitfield for control purposes. Submit 0 for now.
7749 * @return
7750 * >0 means success
7751 * ISO_STREAM_NO_CLONE is issued if no .clone_stream() exists
7752 * other error return values < 0 may occur depending on kind of stream
7753 *
7754 * @since 1.0.2
7755 */
7756int iso_stream_clone(IsoStream *old_stream, IsoStream **new_stream, int flag);
7757
7758
7759/* --------------------------------- AAIP --------------------------------- */
7760
7761/**
7762 * Function to identify and manage AAIP strings as xinfo of IsoNode.
7763 *
7764 * An AAIP string contains the Attribute List with the xattr and ACL of a node
7765 * in the image tree. It is formatted according to libisofs specification
7766 * AAIP-2.0 and ready to be written into the System Use Area or Continuation
7767 * Area of a directory entry in an ISO image.
7768 *
7769 * Applications are not supposed to manipulate AAIP strings directly.
7770 * They should rather make use of the appropriate iso_node_get_* and
7771 * iso_node_set_* calls.
7772 *
7773 * AAIP represents ACLs as xattr with empty name and AAIP-specific binary
7774 * content. Local filesystems may represent ACLs as xattr with names like
7775 * "system.posix_acl_access". libisofs does not interpret those local
7776 * xattr representations of ACL directly but rather uses the ACL interface of
7777 * the local system. By default the local xattr representations of ACL will
7778 * not become part of the AAIP Attribute List via iso_local_get_attrs() and
7779 * not be attached to local files via iso_local_set_attrs().
7780 *
7781 * @since 0.6.14
7782 */
7783int aaip_xinfo_func(void *data, int flag);
7784
7785/**
7786 * The iso_node_xinfo_cloner function which gets associated to aaip_xinfo_func
7787 * by iso_init() or iso_init_with_flag() via iso_node_xinfo_make_clonable().
7788 * @since 1.0.2
7789 */
7790int aaip_xinfo_cloner(void *old_data, void **new_data, int flag);
7791
7792/**
7793 * Get the ACLs which are associated with the node.
7794 * The result will be in "long" text form as of man acl and acl_to_text().
7795 * Call this function with flag bit15 to finally release the memory
7796 * occupied by an ACL inquiry.
7797 *
7798 * @param node
7799 * The node that is to be inquired.
7800 * @param access_text
7801 * Will return a pointer to the "access" ACL text or NULL if it is
7802 * not available and flag bit 4 is set.
7803 * @param default_text
7804 * Will return a pointer to the "default" ACL or NULL if it is
7805 * not available.
7806 * (GNU/Linux directories can have a "default" ACL which influences
7807 * the permissions of newly created files.)
7808 * @param flag
7809 * Bitfield for control purposes
7810 * bit4= if no "access" ACL is available: return *access_text == NULL
7811 * else: produce ACL from stat(2) permissions
7812 * bit15= free memory and return 1 (node may be NULL)
7813 * @return
7814 * 2 *access_text was produced from stat(2) permissions
7815 * 1 *access_text was produced from ACL of node
7816 * 0 if flag bit4 is set and no ACL is available
7817 * < 0 on error
7818 *
7819 * @since 0.6.14
7820 */
7822 char **access_text, char **default_text, int flag);
7823
7824
7825/**
7826 * Set the ACLs of the given node to the lists in parameters access_text and
7827 * default_text or delete them.
7828 *
7829 * The stat(2) permission bits get updated according to the new "access" ACL if
7830 * neither bit1 of parameter flag is set nor parameter access_text is NULL.
7831 * Note that S_IRWXG permission bits correspond to ACL mask permissions
7832 * if a "mask::" entry exists in the ACL. Only if there is no "mask::" then
7833 * the "group::" entry corresponds to to S_IRWXG.
7834 *
7835 * @param node
7836 * The node that is to be manipulated.
7837 * @param access_text
7838 * The text to be set into effect as "access" ACL. NULL will delete a
7839 * possibly existing "access" ACL of the node.
7840 * @param default_text
7841 * The text to be set into effect as "default" ACL. NULL will delete a
7842 * possibly existing "default" ACL of the node.
7843 * (GNU/Linux directories can have a "default" ACL which influences
7844 * the permissions of newly created files.)
7845 * @param flag
7846 * Bitfield for control purposes
7847 * bit0= Do not change the stat(2) permissions.
7848 * Caution: This can make the node's permission set inconsistent.
7849 * bit1= Ignore text parameters but rather update the "access" ACL
7850 * to the stat(2) permissions of node. If no "access" ACL exists,
7851 * then do nothing and return success.
7852 * bit2= Be verbose about failure causes.
7853 * @since 1.5.2
7854 * @return
7855 * > 0 success
7856 * < 0 failure
7857 *
7858 * @since 0.6.14
7859 */
7861 char *access_text, char *default_text, int flag);
7862
7863/**
7864 * Like iso_node_get_permissions but reflecting ACL entry "group::" in S_IRWXG
7865 * rather than ACL entry "mask::". This is necessary if the permissions of a
7866 * node with ACL shall be restored to a filesystem without restoring the ACL.
7867 * The same mapping happens internally when the ACL of a node is deleted.
7868 * If the node has no ACL then the result is iso_node_get_permissions(node).
7869 * @param node
7870 * The node that is to be inquired.
7871 * @return
7872 * Permission bits as of stat(2)
7873 *
7874 * @since 0.6.14
7875 */
7877
7878
7879/**
7880 * Get the list of xattr which is associated with the node.
7881 * The resulting data may finally be disposed by a call to this function
7882 * with flag bit15 set, or its components may be freed one-by-one.
7883 * The following values are either NULL or malloc() memory:
7884 * *names, *value_lengths, *values, (*names)[i], (*values)[i]
7885 * with 0 <= i < *num_attrs.
7886 * It is allowed to replace or reallocate those memory items in order to
7887 * to manipulate the attribute list before submitting it to other calls.
7888 *
7889 * If enabled by flag bit0, this list possibly includes the ACLs of the node.
7890 * They are encoded in a pair with empty name. It is not advisable to alter
7891 * the value or name of that pair. One may decide to erase both ACLs by
7892 * deleting this pair or to copy both ACLs by copying the content of this
7893 * pair to an empty named pair of another node.
7894 * For all other ACL purposes use iso_node_get_acl_text().
7895 *
7896 * @param node
7897 * The node that is to be inquired.
7898 * @param num_attrs
7899 * Will return the number of name-value pairs
7900 * @param names
7901 * Will return an array of pointers to 0-terminated names
7902 * @param value_lengths
7903 * Will return an array with the lengths of values
7904 * @param values
7905 * Will return an array of pointers to strings of 8-bit bytes
7906 * @param flag
7907 * Bitfield for control purposes
7908 * bit0= obtain ACLs as attribute with empty name
7909 * bit2= with bit0: do not obtain attributes other than ACLs
7910 * bit15= free memory (node may be NULL)
7911 * @return
7912 * 1 = ok (but *num_attrs may be 0)
7913 * < 0 = error
7914 *
7915 * @since 0.6.14
7916 */
7917int iso_node_get_attrs(IsoNode *node, size_t *num_attrs,
7918 char ***names, size_t **value_lengths, char ***values, int flag);
7919
7920
7921/**
7922 * Obtain the value of a particular xattr name. Make a copy of that value and
7923 * add a trailing 0 byte for caller convenience.
7924 * @param node
7925 * The node that is to be inquired.
7926 * @param name
7927 * The xattr name that shall be looked up.
7928 * @param value_length
7929 * Will return the length of value
7930 * @param value
7931 * Will return a string of 8-bit bytes. free() it when no longer needed.
7932 * @param flag
7933 * Bitfield for control purposes, unused yet, submit 0
7934 * @return
7935 * 1= name found , 0= name not found , <0 indicates error
7936 *
7937 * @since 0.6.18
7938 */
7939int iso_node_lookup_attr(IsoNode *node, char *name,
7940 size_t *value_length, char **value, int flag);
7941
7942/**
7943 * Set the list of xattr which is associated with the node.
7944 * The data get copied so that you may dispose your input data afterwards.
7945 *
7946 * If enabled by flag bit0 then the submitted list of attributes will not only
7947 * overwrite xattr but also both ACLs of the node. ACLs in the submitted list
7948 * have to reside in an attribute with empty name.
7949 *
7950 * @param node
7951 * The node that is to be manipulated.
7952 * @param num_attrs
7953 * Number of attributes
7954 * @param names
7955 * Array of pointers to 0 terminated name strings
7956 * @param value_lengths
7957 * Array of byte lengths for each value
7958 * @param values
7959 * Array of pointers to the value bytes
7960 * @param flag
7961 * Bitfield for control purposes
7962 * bit0= Do not maintain existing ACLs of the node.
7963 * Set new ACLs from value of empty name.
7964 * bit1= Do not clear the existing attribute list but merge it with
7965 * the list given by this call.
7966 * The given values override the values of their possibly existing
7967 * names. If no xattr with a given name exists, then it will be
7968 * added as new xattr. So this bit can be used to set a single
7969 * xattr without inquiring any other xattr of the node.
7970 * bit2= Delete the attributes with the given names
7971 * bit3= Allow to affect non-user attributes.
7972 * I.e. those with a non-empty name which does not begin by "user."
7973 * (The empty name is always allowed and governed by bit0.) This
7974 * deletes all previously existing attributes if not bit1 is set.
7975 * bit4= Do not affect attributes from namespace "isofs".
7976 * To be combined with bit3 for copying attributes from local
7977 * filesystem to ISO image.
7978 * @since 1.2.4
7979 * @return
7980 * 1 = ok
7981 * < 0 = error
7982 *
7983 * @since 0.6.14
7984 */
7985int iso_node_set_attrs(IsoNode *node, size_t num_attrs, char **names,
7986 size_t *value_lengths, char **values, int flag);
7987
7988
7989/**
7990 * Obtain the Linux-like file attribute flags (chattr) as bit array.
7991 * The bit numbers are compatible to the FS_*_FL definitions in Linux
7992 * include file <linux/fs.h>. A (possibly outdated) copy of them is in
7993 * doc/susp_aaip_isofs_names.txt, name isofs.fa .
7994 *
7995 * @param node
7996 * The node that is to be inquired.
7997 * @param lfa_flags
7998 * Will get filled with the FS_*_FL bits
7999 * @param max_bit
8000 * Will tell the highest bit that is possibly set
8001 * (-1 = surely no bit is valid)
8002 * @param flag
8003 * Bitfield for control purposes. Submit 0.
8004 * @return
8005 * 1 = ok, lfa_flags and max_bit are valid
8006 * 0 = no Linux-like file attributes are associated with the node
8007 * < 0 = error
8008 *
8009 * @since 1.5.8
8010 */
8011int iso_node_get_lfa_flags(IsoNode *node, uint64_t *lfa_flags, int *max_bit,
8012 int flag);
8013
8014/**
8015 * Set the Linux-like file attribute flags (chattr) which are associated with
8016 * the node.
8017 * The bit numbers are compatible to the FS_*_FL definitions in Linux
8018 * include file <linux/fs.h>. A (possibly outdated) copy of them is in
8019 * doc/susp_aaip_isofs_names.txt, name isofs.fa .
8020 *
8021 * @param node
8022 * The node that is to be manipulated.
8023 * @param lfa_flags
8024 * File attribute flag bits
8025 * @param flag
8026 * Bitfield for control purposes. Submit 0.
8027 * @return
8028 * 1 = ok
8029 * < 0 = error
8030 *
8031 * @since 1.5.8
8032 */
8033int iso_node_set_lfa_flags(IsoNode *node, uint64_t lfa_flags, int flag);
8034
8035
8036/**
8037 * Obtain the XFS-style project id of the given node.
8038 * The result is 0 if no project id information is associated with the node.
8039 *
8040 * @param node
8041 * The node that is to be inquired.
8042 * @param projid
8043 * Will get filled with the project id
8044 * @param flag
8045 * Bitfield for control purposes. Submit 0.
8046 * @return
8047 * 1 = ok, projid is valid
8048 * < 0 = error
8049 *
8050 * @since 1.5.8
8051 */
8052int iso_node_get_projid(IsoNode *node, uint32_t *projid, int flag);
8053
8054
8055/**
8056 * Set the Linux-like XFS-style project id of the given node.
8057 *
8058 * @param node
8059 * The node that is to be manipulated.
8060 * @param projid
8061 * The project id to be set.
8062 * @param flag
8063 * Bitfield for control purposes. Submit 0.
8064 * @return
8065 * 1 = ok
8066 * < 0 = error
8067 *
8068 * @since 1.5.8
8069 */
8070int iso_node_set_projid(IsoNode *node, uint32_t projid, int flag);
8071
8072
8073/* ---- This is an interface to file attributes of the local filesystem ---- */
8074
8075/**
8076 * libisofs has an internal system dependent adapter to perform operations on
8077 * ACL, xattr, Linux-like file attribute flags, and XFS-style project ids.
8078 * For the sake of completeness and simplicity it exposes this functionality
8079 * to its applications which might want to get and set such attributes from
8080 * local files.
8081 */
8082
8083/**
8084 * Inquire whether local filesystem operations with ACL or xattr are enabled
8085 * inside libisofs. They may be disabled because of compile time decisions.
8086 * E.g. because the operating system does not support these features or
8087 * because libisofs has not yet an adapter to use them.
8088 *
8089 * @param flag
8090 * Bitfield for control purposes
8091 * bit0= inquire availability of ACL
8092 * bit1= inquire availability of xattr
8093 * bit2= inquire availability of Linux-like file attribute flags
8094 * @since 1.5.8
8095 * bit3= inquire availability of XFS-style project id
8096 * @since 1.5.8
8097 * bit4 - bit7= Reserved for future types.
8098 * It is permissibile to set them to 1 already now.
8099 * bit8 and higher: reserved, submit 0
8100 * @return
8101 * Bitfield corresponding to flag.
8102 * bit0= ACL adapter is enabled
8103 * bit1= xattr adapter is enabled
8104 * bit2= Linux-like file attribute flags (chattr) adapter is enabled
8105 * @since 1.5.8
8106 * bit3= XFS-style project ids are enabled
8107 * @since 1.5.8
8108 * bit4 - bit7= Reserved for future types.
8109 * It is permissibile to set them to 1 already now.
8110 * bit8 and higher: reserved, do not interpret these
8111 *
8112 * @since 1.1.6
8113 */
8115
8116
8117/**
8118 * Get an ACL of the given file in the local filesystem in long text form.
8119 *
8120 * @param disk_path
8121 * Absolute path to the file
8122 * @param text
8123 * Will return a pointer to the ACL text. If not NULL the text will be
8124 * 0 terminated and finally has to be disposed by a call to this function
8125 * with bit15 set.
8126 * @param flag
8127 * Bitfield for control purposes
8128 * bit0= get "default" ACL rather than "access" ACL
8129 * bit4= set *text = NULL and return 2
8130 * if the ACL matches st_mode permissions.
8131 * bit5= in case of symbolic link: inquire link target
8132 * bit15= free text and return 1
8133 * @return
8134 * 1 ok
8135 * 2 ok, trivial ACL found while bit4 is set, *text is NULL
8136 * 0 no ACL manipulation adapter available / ACL not supported on fs
8137 * -1 failure of system ACL service (see errno)
8138 * -2 attempt to inquire ACL of a symbolic link without bit4 or bit5
8139 * or with no suitable link target
8140 *
8141 * @since 0.6.14
8142 */
8143int iso_local_get_acl_text(char *disk_path, char **text, int flag);
8144
8145
8146/**
8147 * Set the ACL of the given file in the local filesystem to a given list
8148 * in long text form.
8149 *
8150 * @param disk_path
8151 * Absolute path to the file
8152 * @param text
8153 * The input text (0 terminated, ACL long text form)
8154 * @param flag
8155 * Bitfield for control purposes
8156 * bit0= set "default" ACL rather than "access" ACL
8157 * bit5= in case of symbolic link: manipulate link target
8158 * @return
8159 * > 0 ok
8160 * 0 no ACL manipulation adapter available for desired ACL type
8161 * -1 failure of system ACL service (see errno)
8162 * -2 attempt to manipulate ACL of a symbolic link without bit5
8163 * or with no suitable link target
8164 *
8165 * @since 0.6.14
8166 */
8167int iso_local_set_acl_text(char *disk_path, char *text, int flag);
8168
8169
8170/**
8171 * Obtain permissions of a file in the local filesystem which shall reflect
8172 * ACL entry "group::" in S_IRWXG rather than ACL entry "mask::". This is
8173 * necessary if the permissions of a disk file with ACL shall be copied to
8174 * an object which has no ACL.
8175 * @param disk_path
8176 * Absolute path to the local file which may have an "access" ACL or not.
8177 * @param flag
8178 * Bitfield for control purposes
8179 * bit5= in case of symbolic link: inquire link target
8180 * @param st_mode
8181 * Returns permission bits as of stat(2)
8182 * @return
8183 * 1 success
8184 * -1 failure of lstat() or stat() (see errno)
8185 *
8186 * @since 0.6.14
8187 */
8188int iso_local_get_perms_wo_acl(char *disk_path, mode_t *st_mode, int flag);
8189
8190
8191/**
8192 * Get xattr, non-trivial ACLs, possible Linux-like file attribute flags
8193 * (chattr), and XFS-style project id of the given file in the local
8194 * filesystem.
8195 * The resulting data has finally to be disposed by a call to this function
8196 * with flag bit15 set.
8197 *
8198 * ACLs will get encoded as attribute pair with empty name if this is
8199 * enabled by flag bit0. An ACL which simply reflects stat(2) permissions
8200 * will not be put into the result.
8201 *
8202 * @param disk_path
8203 * Absolute path to the file
8204 * @param num_attrs
8205 * Will return the number of name-value pairs
8206 * @param names
8207 * Will return an array of pointers to 0-terminated names
8208 * @param value_lengths
8209 * Will return an array with the lengths of values
8210 * @param values
8211 * Will return an array of pointers to 8-bit values
8212 * @param flag
8213 * Bitfield for control purposes
8214 * bit0= obtain non-trivial ACLs as attribute with empty name
8215 * bit2= do not obtain attributes other than non-trivial ACLs
8216 * bit3= do not ignore non-user attributes.
8217 * I.e. those with a name which does not begin by "user."
8218 * bit5= in case of symbolic link: inquire link target
8219 * bit6= obtain Linux-like file attribute flags (chattr) as "isofs.fa"
8220 * @since 1.5.8
8221 * bit8= obtain XFS-style non-zero project id as "isofs.pi"
8222 * @since 1.5.8
8223 * bit15= free memory
8224 * @return
8225 * 1 ok
8226 * 2 ok, but it is possible that attributes exist in non-user namespaces
8227 * which could not be explored due to lack of permission.
8228 * @since 1.5.0
8229 * < 0 failure
8230 *
8231 * @since 0.6.14
8232 */
8233int iso_local_get_attrs(char *disk_path, size_t *num_attrs, char ***names,
8234 size_t **value_lengths, char ***values, int flag);
8235
8236
8237/**
8238 * Attach a list of xattr and ACLs to the given file in the local filesystem.
8239 *
8240 * Given ACLs have to be encoded as attribute pair with empty name.
8241 *
8242 * @param disk_path
8243 * Absolute path to the file
8244 * @param num_attrs
8245 * Number of attributes
8246 * @param names
8247 * Array of pointers to 0 terminated name strings
8248 * @param value_lengths
8249 * Array of byte lengths for each attribute payload
8250 * @param values
8251 * Array of pointers to the attribute payload bytes
8252 * @param errnos
8253 * Array of integers to return error numbers if encountered at the attempt
8254 * to process the name-value pair at the given array index number:
8255 * 0 = no error , -1 = unknown error
8256 * >0 = errno as of local system calls to set xattr and ACLs
8257 * @param flag
8258 * Bitfield for control purposes
8259 * bit0= do not attach ACLs from a given attribute with empty name
8260 * bit3= do not ignore non-user attributes.
8261 * I.e. those with a name which does not begin by "user."
8262 * bit5= in case of symbolic link: manipulate link target
8263 * bit6= @since 1.1.6
8264 * tolerate inappropriate presence or absence of
8265 * directory "default" ACL
8266 * bit7= @since 1.5.0
8267 * avoid setting a name value pair if it already exists and
8268 * has the desired value.
8269 * @return
8270 * 1 = ok
8271 * < 0 = error
8272 *
8273 * @since 1.5.0
8274 */
8275int iso_local_set_attrs_errno(char *disk_path, size_t num_attrs, char **names,
8276 size_t *value_lengths, char **values,
8277 int *errnos, int flag);
8278/**
8279 * Older version of iso_local_set_attrs_errno() without the errnos array.
8280 * All other parameters and the return value have the same meaning.
8281 *
8282 * @since 0.6.14
8283 */
8284int iso_local_set_attrs(char *disk_path, size_t num_attrs, char **names,
8285 size_t *value_lengths, char **values, int flag);
8286
8287
8288/**
8289 * Obtain the Linux-like file attribute flags (chattr) of the given file as
8290 * bit array.
8291 * The bit numbers are compatible to the FS_*_FL definitions in Linux
8292 * include file <linux/fs.h>. A (possibly outdated) copy of them is in
8293 * doc/susp_aaip_isofs_names.txt, name isofs.fa .
8294 * The attribute flags of other systems may or may not be mappable to these
8295 * flags.
8296 * @param disk_path
8297 * Path to the file
8298 * @param lfa_flags
8299 * Will get filled with the FS_*_FL bits
8300 * @param max_bit
8301 * Will tell the highest bit that is possibly set
8302 * (-1 = surely no bit is valid)
8303 * @param os_errno
8304 * Will get filled with errno if a system call fails.
8305 * Else it will be filled with 0.
8306 * @param flag
8307 * Bitfield for control purposes
8308 * bit2= do not issue own error messages with system call errors
8309 * bit5= in case of symbolic link: inquire link target
8310 * bit7= Ignore non-settable Linux-like file attribute flags
8311 * @since 1.5.8
8312 * @return
8313 * 1 = ok, lfa_flags is valid
8314 * 2 = ok, but some local flags could not be mapped to the FS_*_FL bits
8315 * 3 = ok, symbolic link encountered, flag bit5 not set,lfa_flags set to 0
8316 * 4 = ok, file did not bear attribute flags. E.g. because not S_IFDIR or
8317 * S_IFREG, or because unsuitable filesystem.
8318 * lfa_flags is set to 0
8319 * <0 = error
8320 *
8321 * @since 1.5.8
8322 */
8323int iso_local_get_lfa_flags(char *disk_path, uint64_t *lfa_flags, int *max_bit,
8324 int *os_errno, int flag);
8325
8326
8327/**
8328 * Bring the given Linux-like file attribute flags (chattr) into effect with
8329 * the given file.
8330 * The bit numbers are compatible to the FS_*_FL definitions in Linux
8331 * include file <linux/fs.h>. A (possibly outdated) copy of them is in
8332 * doc/susp_aaip_isofs_names.txt, name isofs.fa .
8333 * The attribute flags of other systems may or may not be mappable to these
8334 * flags.
8335 * @param disk_path
8336 * Path to the file
8337 * @param lfa_flags
8338 * File attribute flag bits
8339 * @param max_bit
8340 * Gives an upper limit of the highest possibly set flag bit.
8341 * (-1 = surely no bit is valid)
8342 * On Linux this must be smaller than sizeof(long) * 8.
8343 * @param os_errno
8344 * Will get filled with errno if a system call fails.
8345 * Else it will be filled with 0.
8346 * @param change_mask
8347 * Tells which bits of lfa_flags are meant to change attribute flags
8348 * of the file. Submit ~((uint64_t) 0) if all bits may cause changes.
8349 * The set of changeable bits may further be restricted by bit0 and bit1
8350 * of parameter flag.
8351 * @param flag
8352 * Bitfield for control purposes
8353 * bit0= do not try to change known chattr superuser flags: iaj
8354 * bit1= change only known chattr settable flags: sucSiadAmjtDTCxPF
8355 * bit2= do not issue own error messages with system call errors
8356 * bit5= in case of symbolic link: operate on link target
8357 * @return
8358 * 1 = ok, all lfa_flags bits were written
8359 * 2 = ok, but some FS_*_FL bits could not be mapped to local flags
8360 * 3 = ok, symbolic link encountered, flag bit5 not set, nothing done
8361 * <0 = error
8362 *
8363 * @since 1.5.8
8364 */
8365int iso_local_set_lfa_flags(char *disk_path, uint64_t lfa_flags, int max_bit,
8366 uint64_t change_mask, int *os_errno, int flag);
8367
8368
8369/**
8370 * Convert the known set bits of the given Linux-like file attribute flags
8371 * to a string of flag letters like expected by chattr(1).
8372 *
8373 * @param lfa_flags
8374 * File attribute flag bits to be converted
8375 * @param flags_text
8376 * Will return the string of known set flag letters.
8377 * If it is not returned as NULL, then submit it to free(2) when
8378 * no longer needed.
8379 * @param flag
8380 * Bitfield for control purposes.
8381 * bit0= produce lsattr(1) format with '-' and peculiar sequence
8382 * (This might be more prone to ISO_LFA_UNKNOWN_BIT.
8383 * Some versions of lsattr showed less bits. Maybe newer versions
8384 * will show more bits.)
8385 * @return
8386 * >0 = success
8387 * <0 = error
8388 * ISO_LFA_UNKNOWN_BIT indicates a partial result in flags_text
8389 *
8390 * @since 1.5.8
8391 */
8392int iso_util_encode_lfa_flags(uint64_t lfa_flags, char **flags_text, int flag);
8393
8394
8395/**
8396 * Convert the given string of flag letters to a bit array usable by
8397 * iso_*_set_lfa_flags(). The letters are as expected by chattr(1) or shown
8398 * by lsattr(1).
8399 *
8400 * @param flags_text
8401 * The string of flag letters to be converted
8402 * @param lfa_flags
8403 * Will return the resultig file attribute flag bits
8404 * @param flag
8405 * Bitfield for control purposes. Submit 0.
8406 * @return
8407 * >0 = success
8408 * <0 = error
8409 *
8410 * @since 1.5.8
8411 */
8412int iso_util_decode_lfa_flags(char *flags_text, uint64_t *lfa_flags, int flag);
8413
8414
8415/**
8416 * Return the bit patterns of four classes of Linux-like file attribute flags.
8417 * They were determined according to man 1 chattr and the source of lsattr
8418 * in juli 2024. The symbolic strings and bit numbers are given here only
8419 * for convenience. Decisive are the returned bit patterns.
8420 *
8421 * @param user_settable
8422 * The flag bits which are known to be user settable with chattr:
8423 * AcCdDFmPsStTux
8424 * @param su_settable
8425 * The flag bits which are known to be settable with chattr only by
8426 * bearers of various superuser powers:
8427 * aij
8428 * @param non_settable
8429 * The flags bits which are known to be not settable or not clearable
8430 * by chattr or only known to lsattr:
8431 * eEhINVZ
8432 *
8433 * @param unknown
8434 * The flags bits for which no symbolic letter is known. Some of them are
8435 * defined in <linux/fs.h> with sparse info, some not even that:
8436 * 9, 13, 21, 22, 24, 26, 27, 31
8437 *
8438 * @since 1.5.8
8439 */
8440void iso_util_get_lfa_masks(uint64_t *user_settable, uint64_t *su_settable,
8441 uint64_t *non_settable, uint64_t *unknown);
8442
8443
8444/**
8445 * Return the effective change mask which will be used by
8446 * iso_local_set_lfa_flags() with the same input of parameters change_mask
8447 * and flag bits 0 and 1.
8448 *
8449 * @param change_mask
8450 * Tells which bits of lfa_flags are meant to change attribute flags
8451 * of the file. Submit ~((uint64_t) 0) if all bits may cause changes.
8452 * The set of changeable bits may further be restricted by bit0 and bit1
8453 * of parameter flag.
8454 * @param flag
8455 * Bitfield for control purposes
8456 * bit0= do not try to change known superuser flags
8457 * bit1= change only known chattr settable flags
8458 *
8459 * @since 1.5.8
8460 */
8461uint64_t iso_util_get_effective_lfa_mask(uint64_t change_mask, int flag);
8462
8463
8464/**
8465 * Obtain the XFS-style project id of the given file.
8466 *
8467 * @param disk_path
8468 * Path to the file
8469 * @param projid
8470 * Will get filled with the project id number.
8471 * @param os_errno
8472 * Will get filled with errno if a system call fails.
8473 * Else it will be filled with 0.
8474 * @param flag
8475 * Bitfield for control purposes
8476 * bit2= do not issue own error messages with operating system errors
8477 * bit5= in case of symbolic link: inquire link target
8478 * @return
8479 * 1 = ok, projid is valid
8480 * 3 = ok, symbolic link encountered, flag bit5 not set, projid set to 0
8481 * <0 = error with system calls
8482 *
8483 * @since 1.5.8
8484 */
8485int iso_local_get_projid(char *disk_path, uint32_t *projid, int *os_errno,
8486 int flag);
8487
8488
8489/**
8490 * Bring the given XFS-style project id into effect with the given file.
8491 *
8492 * @param disk_path
8493 * Path to the file
8494 * @param projid
8495 * Project id
8496 * @param os_errno
8497 * Will get filled with errno if a system call fails.
8498 * Else it will be filled with 0.
8499 * @param flag
8500 * Bitfield for control purposes
8501 * bit2= do not issue own error messages with system call errors
8502 * bit5= in case of symbolic link: operate on link target
8503 * @return
8504 * 1 = ok, projid was written
8505 * 3 = ok, symbolic link encountered, flag bit5 not set, nothing done
8506 * <0 = error
8507 *
8508 * @since 1.5.8
8509 */
8510int iso_local_set_projid(char *disk_path, uint32_t projid, int *os_errno,
8511 int flag);
8512
8513
8514/* -------- API for creating device files in the local filesystem --------- */
8515
8516/**
8517 * Create a device file in the local filesystem.
8518 * Equivalent of non-portable and possibly obsolete mknod(2).
8519 * Whether this makes sense on modern systems is very questionable. But as
8520 * libisofs records device files, it should try to restore them where
8521 * device creation might be supported.
8522 *
8523 * @param disk_path
8524 * Path in the local filesystem where to create the file.
8525 * @param st_mode
8526 * File type and permission bits as of man stat(2) field st_mode.
8527 * Possibly supported file types are: S_IFCHR , S_IFBLK
8528 * @param dev
8529 * System specific parameters for the new device file. It should have
8530 * been originally obtained by a stat(2) call on a system with compatible
8531 * device parameters.
8532 * @param os_errno
8533 * Will get filled with errno if a system call fails.
8534 * Else it will be filled with 0.
8535 * @param flag
8536 * Bitfield for control purposes.
8537 * bit0= do not issue error messages
8538 * @return
8539 * ISO_SUCCESS or <0 to indicate error.
8540 *
8541 * @since 1.5.8
8542 */
8543int iso_local_create_dev(char *disk_path, mode_t st_mode, dev_t dev,
8544 int *os_errno, int flag);
8545
8546
8547/* ------------------------------------------------------------------------- */
8548
8549
8550/* Default in case that the compile environment has no macro PATH_MAX.
8551*/
8552#define Libisofs_default_path_maX 4096
8553
8554
8555/* --------------------------- Filters in General -------------------------- */
8556
8557/*
8558 * A filter is an IsoStream which uses another IsoStream as input. It gets
8559 * attached to an IsoFile by specialized calls iso_file_add_*_filter() which
8560 * replace its current IsoStream by the filter stream which takes over the
8561 * current IsoStream as input.
8562 * The consequences are:
8563 * iso_file_get_stream() will return the filter stream.
8564 * iso_stream_get_size() will return the (cached) size of the filtered data,
8565 * iso_stream_open() will start child processes if there are any,
8566 * iso_stream_close() will kill child processes if there are any,
8567 * iso_stream_read() will return filtered data. E.g. as data file content
8568 * during ISO image generation.
8569 *
8570 * There are external filters which run child processes
8571 * iso_file_add_external_filter()
8572 * and internal filters
8573 * iso_file_add_zisofs_filter()
8574 * iso_file_add_gzip_filter()
8575 * which may or may not be available depending on compile time settings and
8576 * installed software packages like libz.
8577 *
8578 * During image generation filters get not in effect if the original IsoStream
8579 * is an "fsrc" stream based on a file in the loaded ISO image and if the
8580 * image generation type is set to 1 by iso_write_opts_set_appendable().
8581 */
8582
8583/**
8584 * Delete the top filter stream from a data file. This is the most recent one
8585 * which was added by iso_file_add_*_filter().
8586 * Caution: One should not do this while the IsoStream of the file is opened.
8587 * For now there is no general way to determine this state.
8588 * Filter stream implementations are urged to call .close() inside
8589 * method .free() . This will close the input stream too.
8590 * @param file
8591 * The data file node which shall get rid of one layer of content
8592 * filtering.
8593 * @param flag
8594 * Bitfield for control purposes, unused yet, submit 0.
8595 * @return
8596 * 1 on success, 0 if no filter was present
8597 * <0 on error
8598 *
8599 * @since 0.6.18
8600 */
8601int iso_file_remove_filter(IsoFile *file, int flag);
8602
8603/**
8604 * Obtain the input stream of a filter stream.
8605 * @param stream
8606 * The stream to be inquired.
8607 * @param flag
8608 * Bitfield for control purposes.
8609 * bit0= Follow the chain of input streams and return the one at the
8610 * end of the chain.
8611 * @since 1.3.2
8612 * @return
8613 * The input stream, if one exists. Elsewise NULL.
8614 * No extra reference to the stream is taken by this call.
8615 *
8616 * @since 0.6.18
8617 */
8619
8620
8621/* ---------------------------- External Filters --------------------------- */
8622
8623/**
8624 * Representation of an external program that shall serve as filter for
8625 * an IsoStream. This object may be shared among many IsoStream objects.
8626 * It is to be created and disposed by the application.
8627 *
8628 * The filter will act as proxy between the original IsoStream of an IsoFile.
8629 * Up to completed image generation it will be run at least twice:
8630 * for IsoStream.class.get_size() and for .open() with subsequent .read().
8631 * So the original IsoStream has to return 1 by its .class.is_repeatable().
8632 * The filter program has to be repeateable too. I.e. it must produce the same
8633 * output on the same input.
8634 *
8635 * @since 0.6.18
8636 */
8638{
8639 /* Will indicate future extensions. It has to be 0 for now. */
8641
8642 /* Tells how many IsoStream objects depend on this command object.
8643 * One may only dispose an IsoExternalFilterCommand when this count is 0.
8644 * Initially this value has to be 0.
8645 */
8647
8648 /* An optional instance id.
8649 * Set to empty text if no individual name for this object is intended.
8650 */
8651 char *name;
8652
8653 /* Absolute local filesystem path to the executable program. */
8654 char *path;
8655
8656 /* Tells the number of arguments. */
8657 int argc;
8658
8659 /* NULL terminated list suitable for system call execv(3).
8660 * I.e. argv[0] points to the alleged program name,
8661 * argv[1] to argv[argc] point to program arguments (if argc > 0)
8662 * argv[argc+1] is NULL
8663 */
8664 char **argv;
8665
8666 /* A bit field which controls behavior variations:
8667 * bit0= Do not install filter if the input has size 0.
8668 * bit1= Do not install filter if the output is not smaller than the input.
8669 * bit2= Do not install filter if the number of output blocks is
8670 * not smaller than the number of input blocks. Block size is 2048.
8671 * Assume that non-empty input yields non-empty output and thus do
8672 * not attempt to attach a filter to files smaller than 2049 bytes.
8673 * bit3= suffix removed rather than added.
8674 * (Removal and adding suffixes is the task of the application.
8675 * This behavior bit serves only as reminder for the application.)
8676 */
8678
8679 /* The possible suffix which is supposed to be added to the IsoFile name
8680 * or to be removed from the name.
8681 * (This is to be done by the application, not by calls
8682 * iso_file_add_external_filter() or iso_file_remove_filter().
8683 * The value recorded here serves only as reminder for the application.)
8684 */
8685 char *suffix;
8686};
8687
8689
8690/**
8691 * Install an external filter command on top of the content stream of a data
8692 * file. The filter process must be repeatable. It will be run once by this
8693 * call in order to cache the output size.
8694 * @param file
8695 * The data file node which shall show filtered content.
8696 * @param cmd
8697 * The external program and its arguments which shall do the filtering.
8698 * @param flag
8699 * Bitfield for control purposes, unused yet, submit 0.
8700 * @return
8701 * 1 on success, 2 if filter installation revoked (e.g. cmd.behavior bit1)
8702 * <0 on error
8703 *
8704 * @since 0.6.18
8705 */
8707 int flag);
8708
8709/**
8710 * Obtain the IsoExternalFilterCommand which is associated with the given
8711 * stream. (Typically obtained from an IsoFile by iso_file_get_stream()
8712 * or from an IsoStream by iso_stream_get_input_stream()).
8713 * @param stream
8714 * The stream to be inquired.
8715 * @param cmd
8716 * Will return the external IsoExternalFilterCommand. Valid only if
8717 * the call returns 1. This does not increment cmd->refcount.
8718 * @param flag
8719 * Bitfield for control purposes, unused yet, submit 0.
8720 * @return
8721 * 1 on success, 0 if the stream is not an external filter
8722 * <0 on error
8723 *
8724 * @since 0.6.18
8725 */
8727 IsoExternalFilterCommand **cmd, int flag);
8728
8729
8730/* ---------------------------- Internal Filters --------------------------- */
8731
8732
8733/**
8734 * Install a zisofs filter on top of the content stream of a data file.
8735 * zisofs is a compression format which is decompressed by some Linux kernels.
8736 * See also doc/zisofs_format.txt and doc/zisofs2_format.txt.
8737 * The filter will not be installed if its output size is not smaller than
8738 * the size of the input stream.
8739 * This is only enabled if the use of libz was enabled at compile time.
8740 * @param file
8741 * The data file node which shall show filtered content.
8742 * @param flag
8743 * Bitfield for control purposes
8744 * bit0= Do not install filter if the number of output blocks is
8745 * not smaller than the number of input blocks. Block size is 2048.
8746 * bit1= Install a decompression filter rather than one for compression.
8747 * bit2= Only inquire availability of zisofs filtering. file may be NULL.
8748 * If available return 2, else return error.
8749 * bit3= is reserved for internal use and will be forced to 0
8750 * @return
8751 * 1 on success, 2 if filter available but installation revoked
8752 * <0 on error, e.g. ISO_ZLIB_NOT_ENABLED
8753 *
8754 * @since 0.6.18
8755 */
8757
8758
8759/**
8760 * Obtain the parameters of a zisofs filter stream.
8761 * @param stream
8762 * The stream to be inquired.
8763 * @param stream_type
8764 * 1=compressing ("ziso")
8765 * -1=uncompressing ("osiz")
8766 * 0 other (any obtained parameters have invalid content)
8767 * @param zisofs_algo
8768 * Algorithm as of ZF field:
8769 * {'p', 'z'} = zisofs version 1 (Zlib)
8770 * {'P', 'Z'} = zisofs version 2 (Zlib)
8771 * @param algo_num
8772 * Algorithm as of zisofs header:
8773 * 0 = zisofs version 1 (Zlib)
8774 * 1 = zisofs version 2 (Zlib)
8775 * @param block_size_log2
8776 * Log2 of the compression block size
8777 * 15 = 32 kiB , 16 = 64 kiB , 17 = 128 kiB, ...
8778 * @param flag
8779 * Bitfield for control purposes, unused yet, submit 0
8780 * @return
8781 * 1 on success, 0 if the stream has not class->type "ziso" or "osiz"
8782 * <0 on error
8783 * @since 1.5.4
8784 */
8785int iso_stream_get_zisofs_par(IsoStream *stream, int *stream_type,
8786 uint8_t zisofs_algo[2], uint8_t* algo_num,
8787 int *block_size_log2, int flag);
8788
8789
8790/**
8791 * Discard the buffered zisofs compression block pointers of a stream, if the
8792 * stream is a zisofs compression stream and not currently opened.
8793 * @param stream
8794 * The stream to be manipulated.
8795 * @param flag
8796 * Bitfield for control purposes, unused yet, submit 0
8797 * @return
8798 * 1 on success, 0 if no block pointers were reoved, <0 on error
8799 * @since 1.5.4
8800 */
8802
8803/**
8804 * Discard all buffered zisofs compression block pointers of streams in the
8805 * given image, which are zisofs compression streams and not currently opened.
8806 * @param image
8807 * The image to be manipulated.
8808 * @param flag
8809 * Bitfield for control purposes, unused yet, submit 0
8810 * @return
8811 * ISO_SUCCESS on success, <0 on error
8812 * @since 1.5.4
8813 */
8815
8816
8817/**
8818 * Inquire the number of zisofs compression and uncompression filters which
8819 * are in use.
8820 * @param ziso_count
8821 * Will return the number of currently installed compression filters.
8822 * @param osiz_count
8823 * Will return the number of currently installed uncompression filters.
8824 * @param flag
8825 * Bitfield for control purposes, unused yet, submit 0
8826 * @return
8827 * 1 on success, <0 on error
8828 *
8829 * @since 0.6.18
8830 */
8831int iso_zisofs_get_refcounts(off_t *ziso_count, off_t *osiz_count, int flag);
8832
8833
8834/**
8835 * Parameter set for iso_zisofs_set_params().
8836 *
8837 * @since 0.6.18
8838 */
8840
8841 /* Set to 0 or 1 for this version of the structure
8842 * 0 = only members up to .block_size_log2 are valid
8843 * 1 = members up to .bpt_discard_free_ratio are valid
8844 * @since 1.5.4
8845 */
8847
8848 /* Compression level for zlib function compress2(). From <zlib.h>:
8849 * "between 0 and 9:
8850 * 1 gives best speed, 9 gives best compression, 0 gives no compression"
8851 * Default is 6.
8852 */
8854
8855 /* Log2 of the block size for compression filters of zisofs version 1.
8856 * Allowed values are:
8857 * 15 = 32 kiB , 16 = 64 kiB , 17 = 128 kiB
8858 */
8860
8861 /* ------------------- Only valid with .version >= 1 ------------------- */
8862
8863 /*
8864 * Whether to produce zisofs2 (zisofs version 2) file headers and ZF
8865 * entries for files which get compressed:
8866 * 0 = do not produce zisofs2,
8867 * do not recognize zisofs2 file headers by magic
8868 * This is the default.
8869 * 1 = zisofs2 is enabled for file size 4 GiB or more
8870 * 2 = zisofs2 shall be used if zisofs is used at all
8871 * @since 1.5.4
8872 */
8874
8875 /*
8876 * Log2 of block size for zisofs2 files. 0 keeps current setting.
8877 * Allowed are 15 = 32 kiB to 20 = 1024 kiB.
8878 * @since 1.5.4
8879 */
8881
8882 /*
8883 * Maximum overall number of blocklist pointers. 0 keeps current setting.
8884 * @since 1.5.4
8885 */
8887
8888 /*
8889 * Ignored as input value: Number of allocated zisofs block pointers.
8890 * @since 1.5.4
8891 */
8893
8894 /*
8895 * Maximum number of blocklist pointers per file. 0 keeps current setting.
8896 * @since 1.5.4
8897 */
8899
8900 /*
8901 * Number of block pointers of a file, which is considered low enough to
8902 * justify a reduction of block size. If this number is > 0, then the
8903 * lowest permissible block size is used, with which not more than the
8904 * given number of block pointers gets produced. Upper limit is the
8905 * setting of block size log2.
8906 * The inavoidable end block pointer counts. E.g. a file of 55 KiB has
8907 * 3 blocks pointers with block size log2 15, and 2 blocks pointers with
8908 * block size log2 16.
8909 * -1 disables this automatic block size adjustment.
8910 * 0 keeps the current setting.
8911 * @since 1.5.4
8912 */
8914
8915 /*
8916 * The number of blocks from which on the block pointer list shall be
8917 * discarded on iso_stream_close() of a compressing stream. This means that
8918 * the pointers have to be determined again on next ziso_stream_compress(),
8919 * so that adding a zisofs compression filter and writing the compressed
8920 * stream needs in the sum three read runs of the input stream.
8921 * 0 keeps the current setting.
8922 * < 0 disables this file size based discarding.
8923 * @since 1.5.4
8924 */
8926
8927 /*
8928 * A ratio describing the part of max_file_blocks which shall be kept free
8929 * by intermediate discarding of block pointers.
8930 * See above bpt_discard_file_blocks .
8931 * It makes sense to set this to 1.0 if max_file_blocks is substantially
8932 * smaller than max_total_blocks.
8933 * 0.0 keeps the current setting.
8934 * < 0.0 disables this memory consumption based discarding.
8935 * @since 1.5.4
8936 */
8938
8939};
8940
8941/**
8942 * Set the global parameters for zisofs filtering.
8943 * This is only allowed while no zisofs compression filters are installed.
8944 * i.e. ziso_count returned by iso_zisofs_get_refcounts() has to be 0.
8945 * @param params
8946 * Pointer to a structure with the intended settings.
8947 * The caller sets params->version to indicate which set of members
8948 * has been filled. I.e. params->version == 0 causes all members after
8949 * params->block_size_log2 to be ignored.
8950 * @param flag
8951 * Bitfield for control purposes, unused yet, submit 0
8952 * @return
8953 * 1 on success, <0 on error
8954 *
8955 * @since 0.6.18
8956 */
8957int iso_zisofs_set_params(struct iso_zisofs_ctrl *params, int flag);
8958
8959/**
8960 * Get the current global parameters for zisofs filtering.
8961 * @param params
8962 * Pointer to a caller provided structure which shall take the settings.
8963 * The caller sets params->version to indicate which set of members
8964 * shall be filled. I.e. params->version == 0 leaves all members after
8965 * params->block_size_log2 untouched.
8966 * @param flag
8967 * Bitfield for control purposes, unused yet, submit 0
8968 * @return
8969 * 1 on success, <0 on error
8970 *
8971 * @since 0.6.18
8972 */
8973int iso_zisofs_get_params(struct iso_zisofs_ctrl *params, int flag);
8974
8975
8976/**
8977 * Enable or disable the production of "Z2" SUSP entries instead of "ZF"
8978 * entries for zisofs2 compressed files.
8979 * "ZF" with zisofs2 causes unaware Linux kernels to complain like:
8980 * isofs: Unknown ZF compression algorithm: PZ
8981 * "Z2" is silently ignored by unaware Linux kernels.
8982 * @param enable
8983 * 1 = produce "Z2" , 0 = only "ZF" , -1 = do not change
8984 * @return
8985 * 1 = enabled , 0 = not enabled
8986 * @since 1.5.4
8987 */
8989
8990
8991/**
8992 * Check for the given node or for its subtree whether the data file content
8993 * effectively bears zisofs file headers and mark the outcome by an xinfo data
8994 * record if not already marked by a zisofs compressor filter.
8995 * This does not install any filter but only a hint for image generation
8996 * that the already compressed files shall get written with zisofs ZF entries.
8997 * Use this if you insert the compressed results of program mkzftree from disk
8998 * into the image.
8999 * @param node
9000 * The node which shall be checked and, if appropriate, be marked.
9001 * @param flag
9002 * Bitfield for control purposes
9003 * bit0= prepare for a run with iso_write_opts_set_appendable(,1).
9004 * Take into account that files from the imported image
9005 * do not get their content filtered.
9006 * bit1= permission to overwrite existing zisofs_zf_info
9007 * bit2= if no zisofs header is found:
9008 * create xinfo with parameters which indicate no zisofs
9009 * bit3= no tree recursion if node is a directory
9010 * bit4= skip files which stem from the imported image
9011 * bit8-bit15= maximum zisofs version to be recognized (0 means 1)
9012 * @return
9013 * 0= no zisofs data found
9014 * 1= zf xinfo added
9015 * 2= found existing zf xinfo and flag bit1 was not set
9016 * 3= both encountered: 1 and 2
9017 * <0 means error
9018 *
9019 * @since 0.6.18
9020 */
9021int iso_node_zf_by_magic(IsoNode *node, int flag);
9022
9023
9024/**
9025 * Install a gzip or gunzip filter on top of the content stream of a data file.
9026 * gzip is a compression format which is used by programs gzip and gunzip.
9027 * The filter will not be installed if its output size is not smaller than
9028 * the size of the input stream.
9029 * This is only enabled if the use of libz was enabled at compile time.
9030 * @param file
9031 * The data file node which shall show filtered content.
9032 * @param flag
9033 * Bitfield for control purposes
9034 * bit0= Do not install filter if the number of output blocks is
9035 * not smaller than the number of input blocks. Block size is 2048.
9036 * bit1= Install a decompression filter rather than one for compression.
9037 * bit2= Only inquire availability of gzip filtering. file may be NULL.
9038 * If available return 2, else return error.
9039 * bit3= is reserved for internal use and will be forced to 0
9040 * @return
9041 * 1 on success, 2 if filter available but installation revoked
9042 * <0 on error, e.g. ISO_ZLIB_NOT_ENABLED
9043 *
9044 * @since 0.6.18
9045 */
9047
9048
9049/**
9050 * Inquire the number of gzip compression and uncompression filters which
9051 * are in use.
9052 * @param gzip_count
9053 * Will return the number of currently installed compression filters.
9054 * @param gunzip_count
9055 * Will return the number of currently installed uncompression filters.
9056 * @param flag
9057 * Bitfield for control purposes, unused yet, submit 0
9058 * @return
9059 * 1 on success, <0 on error
9060 *
9061 * @since 0.6.18
9062 */
9063int iso_gzip_get_refcounts(off_t *gzip_count, off_t *gunzip_count, int flag);
9064
9065
9066/* ---------------------------- MD5 Checksums --------------------------- */
9067
9068/* Production and loading of MD5 checksums is controlled by calls
9069 iso_write_opts_set_record_md5() and iso_read_opts_set_no_md5().
9070 For data representation details see doc/checksums.txt .
9071*/
9072
9073/**
9074 * Obtain the recorded MD5 checksum of the session which was
9075 * loaded as ISO image. Such a checksum may be stored together with others
9076 * in a contiguous array at the end of the session. The session checksum
9077 * covers the data blocks from address start_lba to address end_lba - 1.
9078 * It does not cover the recorded array of md5 checksums.
9079 * Layout, size, and position of the checksum array is recorded in the xattr
9080 * "isofs.ca" of the session root node.
9081 * @param image
9082 * The image to inquire
9083 * @param start_lba
9084 * Returns the first block address covered by md5
9085 * @param end_lba
9086 * Returns the first block address not covered by md5 any more
9087 * @param md5
9088 * Returns 16 byte of MD5 checksum
9089 * @param flag
9090 * Bitfield for control purposes, unused yet, submit 0
9091 * @return
9092 * 1= md5 found
9093 * 0= no md5 available (i.e. start_lba, end_lba, md5 are invalid)
9094 * <0 indicates error
9095 *
9096 * @since 0.6.22
9097 */
9098int iso_image_get_session_md5(IsoImage *image, uint32_t *start_lba,
9099 uint32_t *end_lba, char md5[16], int flag);
9100
9101/**
9102 * Obtain the recorded MD5 checksum of a data file from the loaded ISO image.
9103 * Such a checksum may be stored with others in a contiguous array at the end
9104 * of the loaded session. The data file then has an xattr "isofs.cx" which
9105 * gives the index in that array.
9106 * @param image
9107 * The image from which file stems.
9108 * @param file
9109 * The file object to inquire
9110 * @param md5
9111 * Will be filled with 16 byte of MD5 checksum if available
9112 * @param flag
9113 * Bitfield for control purposes
9114 * bit0= only determine return value, do not touch parameter md5
9115 * @return
9116 * 1= md5 found , 0= no md5 available , <0 indicates error
9117 *
9118 * @since 0.6.22
9119 */
9120int iso_file_get_md5(IsoImage *image, IsoFile *file, char md5[16], int flag);
9121
9122/**
9123 * Read the content of an IsoFile object, compute its MD5 and attach it to
9124 * the IsoFile. It can then be inquired by iso_file_get_md5() and will get
9125 * written into the next session if this is enabled at write time and if the
9126 * image write process does not compute an MD5 from content which it copies.
9127 * So this call can be used to equip nodes from the old image with checksums
9128 * or to make available checksums of newly added files before the session gets
9129 * written.
9130 * @param file
9131 * The file object to read data from and to which to attach the checksum.
9132 * If the file is from the imported image, then its most original stream
9133 * will be checksummed. Else the possible filter streams of file will get
9134 * into effect.
9135 * @param flag
9136 * Bitfield for control purposes. Unused yet. Submit 0.
9137 * @return
9138 * 1= ok, MD5 is computed and attached , <0 indicates error
9139 *
9140 * @since 0.6.22
9141 */
9142int iso_file_make_md5(IsoFile *file, int flag);
9143
9144/**
9145 * Check a data block whether it is a libisofs checksum tag and if so, obtain
9146 * its recorded parameters. These tags get written after volume descriptors,
9147 * directory tree and checksum array and can be detected without loading the
9148 * image tree.
9149 * One may start reading and computing MD5 at the suspected image session
9150 * start and look out for a checksum tag on the fly. See doc/checksum.txt .
9151 * @param data
9152 * A complete and aligned data block read from an ISO image session.
9153 * @param tag_type
9154 * Returns the tag type:
9155 * 0= no tag
9156 * 1= session tag
9157 * 2= superblock tag
9158 * 3= tree tag
9159 * 4= relocated 64 kB superblock tag (at LBA 0 of overwritable media)
9160 * @param pos
9161 * Returns the LBA where the tag supposes itself to be stored.
9162 * If this does not match the data block LBA then the tag might be
9163 * image data payload and should be ignored for image checksumming.
9164 * @param range_start
9165 * Returns the block address where the session is supposed to start.
9166 * If this does not match the session start on media then the image
9167 * volume descriptors have been been relocated.
9168 * A proper checksum will only emerge if computing started at range_start.
9169 * @param range_size
9170 * Returns the number of blocks beginning at range_start which are
9171 * covered by parameter md5.
9172 * @param next_tag
9173 * Returns the predicted block address of the next tag.
9174 * next_tag is valid only if not 0 and only with tag types 2, 3, 4.
9175 * With tag types 2 and 3, reading shall go on sequentially and the MD5
9176 * computation shall continue up to that address.
9177 * With tag type 4, reading shall resume either at LBA 32 for the first
9178 * session or at the given address for the session which is to be loaded
9179 * by default. In both cases the MD5 computation shall be re-started from
9180 * scratch.
9181 * @param md5
9182 * Returns 16 byte of MD5 checksum.
9183 * @param flag
9184 * Bitfield for control purposes:
9185 * bit0-bit7= tag type being looked for
9186 * 0= any checksum tag
9187 * 1= session tag
9188 * 2= superblock tag
9189 * 3= tree tag
9190 * 4= relocated superblock tag
9191 * @return
9192 * 0= not a checksum tag, return parameters are invalid
9193 * 1= checksum tag found, return parameters are valid
9194 * <0= error
9195 * (return parameters are valid with error ISO_MD5_AREA_CORRUPTED
9196 * but not trustworthy because the tag seems corrupted)
9197 *
9198 * @since 0.6.22
9199 */
9200int iso_util_decode_md5_tag(char data[2048], int *tag_type, uint32_t *pos,
9201 uint32_t *range_start, uint32_t *range_size,
9202 uint32_t *next_tag, char md5[16], int flag);
9203
9204
9205/* The following functions allow to do own MD5 computations. E.g for
9206 comparing the result with a recorded checksum.
9207*/
9208/**
9209 * Create a MD5 computation context and hand out an opaque handle.
9210 *
9211 * @param md5_context
9212 * Returns the opaque handle. Submitted *md5_context must be NULL or
9213 * point to freeable memory.
9214 * @return
9215 * 1= success , <0 indicates error
9216 *
9217 * @since 0.6.22
9218 */
9219int iso_md5_start(void **md5_context);
9220
9221/**
9222 * Advance the computation of a MD5 checksum by a chunk of data bytes.
9223 *
9224 * @param md5_context
9225 * An opaque handle once returned by iso_md5_start() or iso_md5_clone().
9226 * @param data
9227 * The bytes which shall be processed into to the checksum.
9228 * @param datalen
9229 * The number of bytes to be processed.
9230 * @return
9231 * 1= success , <0 indicates error
9232 *
9233 * @since 0.6.22
9234 */
9235int iso_md5_compute(void *md5_context, char *data, int datalen);
9236
9237/**
9238 * Create a MD5 computation context as clone of an existing one. One may call
9239 * iso_md5_clone(old, &new, 0) and then iso_md5_end(&new, result, 0) in order
9240 * to obtain an intermediate MD5 sum before the computation goes on.
9241 *
9242 * @param old_md5_context
9243 * An opaque handle once returned by iso_md5_start() or iso_md5_clone().
9244 * @param new_md5_context
9245 * Returns the opaque handle to the new MD5 context. Submitted
9246 * *md5_context must be NULL or point to freeable memory.
9247 * @return
9248 * 1= success , <0 indicates error
9249 *
9250 * @since 0.6.22
9251 */
9252int iso_md5_clone(void *old_md5_context, void **new_md5_context);
9253
9254/**
9255 * Obtain the MD5 checksum from a MD5 computation context and dispose this
9256 * context. (If you want to keep the context then call iso_md5_clone() and
9257 * apply iso_md5_end() to the clone.)
9258 *
9259 * @param md5_context
9260 * A pointer to an opaque handle once returned by iso_md5_start() or
9261 * iso_md5_clone(). *md5_context will be set to NULL in this call.
9262 * @param result
9263 * Gets filled with the 16 bytes of MD5 checksum.
9264 * @return
9265 * 1= success , <0 indicates error
9266 *
9267 * @since 0.6.22
9268 */
9269int iso_md5_end(void **md5_context, char result[16]);
9270
9271/**
9272 * Inquire whether two MD5 checksums match. (This is trivial but such a call
9273 * is convenient and completes the interface.)
9274 * @param first_md5
9275 * A MD5 byte string as returned by iso_md5_end()
9276 * @param second_md5
9277 * A MD5 byte string as returned by iso_md5_end()
9278 * @return
9279 * 1= match , 0= mismatch
9280 *
9281 * @since 0.6.22
9282 */
9283int iso_md5_match(char first_md5[16], char second_md5[16]);
9284
9285
9286/* -------------------------------- For HFS+ ------------------------------- */
9287
9288
9289/**
9290 * HFS+ attributes which may be attached to IsoNode objects as data parameter
9291 * of iso_node_add_xinfo(). As parameter proc use iso_hfsplus_xinfo_func().
9292 * Create instances of this struct by iso_hfsplus_xinfo_new().
9293 *
9294 * @since 1.2.4
9295 */
9297
9298 /* Currently set to 0 by iso_hfsplus_xinfo_new() */
9300
9301 /* Attributes available with version 0.
9302 * See: http://en.wikipedia.org/wiki/Creator_code , .../Type_code
9303 * @since 1.2.4
9304 */
9305 uint8_t creator_code[4];
9306 uint8_t type_code[4];
9307};
9308
9309/**
9310 * The function that is used to mark struct iso_hfsplus_xinfo_data at IsoNodes
9311 * and finally disposes such structs when their IsoNodes get disposed.
9312 * Usually an application does not call this function, but only uses it as
9313 * parameter of xinfo calls like iso_node_add_xinfo() or iso_node_get_xinfo().
9314 *
9315 * @since 1.2.4
9316 */
9317int iso_hfsplus_xinfo_func(void *data, int flag);
9318
9319/**
9320 * Create an instance of struct iso_hfsplus_xinfo_new().
9321 *
9322 * @param flag
9323 * Bitfield for control purposes. Unused yet. Submit 0.
9324 * @return
9325 * A pointer to the new object
9326 * NULL indicates failure to allocate memory
9327 *
9328 * @since 1.2.4
9329 */
9331
9332
9333/**
9334 * HFS+ blessings are relationships between HFS+ enhanced ISO images and
9335 * particular files in such images. Except for ISO_HFSPLUS_BLESS_INTEL_BOOTFILE
9336 * and ISO_HFSPLUS_BLESS_MAX, these files have to be directories.
9337 * No file may have more than one blessing. Each blessing can only be issued
9338 * to one file.
9339 *
9340 * @since 1.2.4
9341 */
9343 /* The blessing that is issued by mkisofs option -hfs-bless. */
9345
9346 /* To be applied to a data file */
9348
9349 /* Further blessings for directories */
9353
9354 /* Not a blessing, but telling the number of blessings in this list */
9356};
9357
9358/**
9359 * Issue a blessing to a particular IsoNode. If the blessing is already issued
9360 * to some file, then it gets revoked from that one.
9361 *
9362 * @param img
9363 * The image to manipulate.
9364 * @param blessing
9365 * The kind of blessing to be issued.
9366 * @param node
9367 * The file that shall be blessed. It must actually be an IsoDir or
9368 * IsoFile as is appropriate for the kind of blessing. (See above enum.)
9369 * The node may not yet bear a blessing other than the desired one.
9370 * If node is NULL, then the blessing will be revoked from any node
9371 * which bears it.
9372 * @param flag
9373 * Bitfield for control purposes.
9374 * bit0= Revoke blessing if node != NULL bears it.
9375 * bit1= Revoke any blessing of the node, regardless of parameter
9376 * blessing. If node is NULL, then revoke all blessings in
9377 * the image.
9378 * @return
9379 * 1 means successful blessing or revokation of an existing blessing.
9380 * 0 means the node already bears another blessing, or is of wrong type,
9381 * or that the node was not blessed and revokation was desired.
9382 * <0 is one of the listed error codes.
9383 *
9384 * @since 1.2.4
9385 */
9387 IsoNode *node, int flag);
9388
9389/**
9390 * Get the array of nodes which are currently blessed.
9391 * Array indice correspond to enum IsoHfsplusBlessings.
9392 * Array element value NULL means that no node bears that blessing.
9393 *
9394 * Several usage restrictions apply. See parameter blessed_nodes.
9395 *
9396 * @param img
9397 * The image to inquire.
9398 * @param blessed_nodes
9399 * Will return a pointer to an internal node array of image.
9400 * This pointer is valid only as long as image exists and only until
9401 * iso_image_hfsplus_bless() gets used to manipulate the blessings.
9402 * Do not free() this array. Do not alter the content of the array
9403 * directly, but rather use iso_image_hfsplus_bless() and re-inquire
9404 * by iso_image_hfsplus_get_blessed().
9405 * This call does not impose an extra reference on the nodes in the
9406 * array. So do not iso_node_unref() them.
9407 * Nodes listed here are not necessarily grafted into the tree of
9408 * the IsoImage.
9409 * @param bless_max
9410 * Will return the number of elements in the array.
9411 * It is unlikely but not outruled that it will be larger than
9412 * ISO_HFSPLUS_BLESS_MAX in this libisofs.h file.
9413 * @param flag
9414 * Bitfield for control purposes. Submit 0.
9415 * @return
9416 * 1 means success, <0 means error
9417 *
9418 * @since 1.2.4
9419 */
9421 int *bless_max, int flag);
9422
9423
9424/* ----------------------------- Character sets ---------------------------- */
9425
9426/**
9427 * Convert the characters in name from local charset to another charset or
9428 * convert name to the representation of a particular ISO image name space.
9429 * In the latter case it is assumed that the conversion result does not
9430 * collide with any other converted name in the same directory.
9431 * I.e. this function does not take into respect possible name changes
9432 * due to collision handling.
9433 *
9434 * @param opts
9435 * Defines output charset, UCS-2 versus UTF-16 for Joliet,
9436 * and naming restrictions.
9437 * @param name
9438 * The input text which shall be converted.
9439 * @param name_len
9440 * The number of bytes in input text.
9441 * @param result
9442 * Will return the conversion result in case of success. Terminated by
9443 * a trailing zero byte.
9444 * Use free() to dispose it when no longer needed.
9445 * @param result_len
9446 * Will return the number of bytes in result (excluding trailing zero)
9447 * @param flag
9448 * Bitfield for control purposes.
9449 * bit0-bit7= Name space
9450 * 0= generic (output charset is used,
9451 * no reserved characters, no length limits)
9452 * 1= Rock Ridge (output charset is used)
9453 * 2= Joliet (output charset gets overridden by UCS-2 or
9454 * UTF-16)
9455 * 3= ECMA-119 (output charset gets overridden by the
9456 * dull ISO 9660 subset of ASCII)
9457 * 4= HFS+ (output charset gets overridden by UTF-16BE)
9458 * bit8= Treat input text as directory name
9459 * (matters for Joliet and ECMA-119)
9460 * bit9= Do not issue error messages
9461 * bit15= Reverse operation (best to be done only with results of
9462 * previous conversions)
9463 * @return
9464 * 1 means success, <0 means error
9465 *
9466 * @since 1.3.6
9467 */
9468int iso_conv_name_chars(IsoWriteOpts *opts, char *name, size_t name_len,
9469 char **result, size_t *result_len, int flag);
9470
9471
9472
9473/************ Error codes and return values for libisofs ********************/
9474
9475/** successfully execution */
9476#define ISO_SUCCESS 1
9477
9478/**
9479 * special return value, it could be or not an error depending on the
9480 * context.
9481 */
9482#define ISO_NONE 0
9483
9484/** Operation canceled (FAILURE,HIGH, -1) */
9485#define ISO_CANCELED 0xE830FFFF
9486
9487/** Unknown or unexpected fatal error (FATAL,HIGH, -2) */
9488#define ISO_FATAL_ERROR 0xF030FFFE
9489
9490/** Unknown or unexpected error (FAILURE,HIGH, -3) */
9491#define ISO_ERROR 0xE830FFFD
9492
9493/** Internal programming error. Please report this bug (FATAL,HIGH, -4) */
9494#define ISO_ASSERT_FAILURE 0xF030FFFC
9495
9496/**
9497 * NULL pointer as value for an arg. that doesn't allow NULL (FAILURE,HIGH, -5)
9498 */
9499#define ISO_NULL_POINTER 0xE830FFFB
9500
9501/** Memory allocation error (FATAL,HIGH, -6) */
9502#define ISO_OUT_OF_MEM 0xF030FFFA
9503
9504/** Interrupted by a signal (FATAL,HIGH, -7) */
9505#define ISO_INTERRUPTED 0xF030FFF9
9506
9507/** Invalid parameter value (FAILURE,HIGH, -8) */
9508#define ISO_WRONG_ARG_VALUE 0xE830FFF8
9509
9510/** Can't create a needed thread (FATAL,HIGH, -9) */
9511#define ISO_THREAD_ERROR 0xF030FFF7
9512
9513/** Write error (FAILURE,HIGH, -10) */
9514#define ISO_WRITE_ERROR 0xE830FFF6
9515
9516/** Buffer read error (FAILURE,HIGH, -11) */
9517#define ISO_BUF_READ_ERROR 0xE830FFF5
9518
9519/** Trying to add to a dir a node already added to a dir (FAILURE,HIGH, -64) */
9520#define ISO_NODE_ALREADY_ADDED 0xE830FFC0
9521
9522/** Node with same name already exists (FAILURE,HIGH, -65) */
9523#define ISO_NODE_NAME_NOT_UNIQUE 0xE830FFBF
9524
9525/** Trying to remove a node that was not added to dir (FAILURE,HIGH, -65) */
9526#define ISO_NODE_NOT_ADDED_TO_DIR 0xE830FFBE
9527
9528/** A requested node does not exist (FAILURE,HIGH, -66) */
9529#define ISO_NODE_DOESNT_EXIST 0xE830FFBD
9530
9531/**
9532 * Try to set the boot image of an already bootable image (FAILURE,HIGH, -67)
9533 */
9534#define ISO_IMAGE_ALREADY_BOOTABLE 0xE830FFBC
9535
9536/** Trying to use an invalid file as boot image (FAILURE,HIGH, -68) */
9537#define ISO_BOOT_IMAGE_NOT_VALID 0xE830FFBB
9538
9539/** Too many boot images (FAILURE,HIGH, -69) */
9540#define ISO_BOOT_IMAGE_OVERFLOW 0xE830FFBA
9541
9542/** No boot catalog created yet ((FAILURE,HIGH, -70) */ /* @since 0.6.34 */
9543#define ISO_BOOT_NO_CATALOG 0xE830FFB9
9544
9545
9546/**
9547 * Error on file operation (FAILURE,HIGH, -128)
9548 * (take a look at more specified error codes below)
9549 */
9550#define ISO_FILE_ERROR 0xE830FF80
9551
9552/** Trying to open an already opened file (FAILURE,HIGH, -129) */
9553#define ISO_FILE_ALREADY_OPENED 0xE830FF7F
9554
9555/* @deprecated use ISO_FILE_ALREADY_OPENED instead */
9556#define ISO_FILE_ALREADY_OPENNED 0xE830FF7F
9557
9558/** Access to file is not allowed (FAILURE,HIGH, -130) */
9559#define ISO_FILE_ACCESS_DENIED 0xE830FF7E
9560
9561/** Incorrect path to file (FAILURE,HIGH, -131) */
9562#define ISO_FILE_BAD_PATH 0xE830FF7D
9563
9564/** The file does not exist in the filesystem (FAILURE,HIGH, -132) */
9565#define ISO_FILE_DOESNT_EXIST 0xE830FF7C
9566
9567/** Trying to read or close a file not opened (FAILURE,HIGH, -133) */
9568#define ISO_FILE_NOT_OPENED 0xE830FF7B
9569
9570/* @deprecated use ISO_FILE_NOT_OPENED instead */
9571#define ISO_FILE_NOT_OPENNED ISO_FILE_NOT_OPENED
9572
9573/** Directory used where no dir is expected (FAILURE,HIGH, -134) */
9574#define ISO_FILE_IS_DIR 0xE830FF7A
9575
9576/** Read error (FAILURE,HIGH, -135) */
9577#define ISO_FILE_READ_ERROR 0xE830FF79
9578
9579/** Not dir used where a dir is expected (FAILURE,HIGH, -136) */
9580#define ISO_FILE_IS_NOT_DIR 0xE830FF78
9581
9582/** Not symlink used where a symlink is expected (FAILURE,HIGH, -137) */
9583#define ISO_FILE_IS_NOT_SYMLINK 0xE830FF77
9584
9585/** Can't seek to specified location (FAILURE,HIGH, -138) */
9586#define ISO_FILE_SEEK_ERROR 0xE830FF76
9587
9588/** File not supported in ECMA-119 tree and thus ignored (WARNING,MEDIUM, -139) */
9589#define ISO_FILE_IGNORED 0xD020FF75
9590
9591/* A file is bigger than supported by used standard (FAILURE,HIGH, -140) */
9592#define ISO_FILE_TOO_BIG 0xE830FF74
9593
9594/* File read error during image creation (MISHAP,HIGH, -141) */
9595#define ISO_FILE_CANT_WRITE 0xE430FF73
9596
9597/* Can't convert filename to requested charset (WARNING,MEDIUM, -142) */
9598#define ISO_FILENAME_WRONG_CHARSET 0xD020FF72
9599/* This was once a HINT. Deprecated now. */
9600#define ISO_FILENAME_WRONG_CHARSET_OLD 0xC020FF72
9601
9602/* File can't be added to the tree (SORRY,HIGH, -143) */
9603#define ISO_FILE_CANT_ADD 0xE030FF71
9604
9605/**
9606 * File path break specification constraints and will be ignored
9607 * (WARNING,MEDIUM, -144)
9608 */
9609#define ISO_FILE_IMGPATH_WRONG 0xD020FF70
9610
9611/**
9612 * Offset greater than file size (FAILURE,HIGH, -150)
9613 * @since 0.6.4
9614 */
9615#define ISO_FILE_OFFSET_TOO_BIG 0xE830FF6A
9616
9617
9618/** Charset conversion error (FAILURE,HIGH, -256) */
9619#define ISO_CHARSET_CONV_ERROR 0xE830FF00
9620
9621/**
9622 * Too many files to mangle, i.e. we cannot guarantee unique file names
9623 * (FAILURE,HIGH, -257)
9624 */
9625#define ISO_MANGLE_TOO_MUCH_FILES 0xE830FEFF
9626
9627/* image related errors */
9628
9629/**
9630 * Wrong or damaged Primary Volume Descriptor (FAILURE,HIGH, -320)
9631 * This could mean that the file is not a valid ISO image.
9632 */
9633#define ISO_WRONG_PVD 0xE830FEC0
9634
9635/** Wrong or damaged RR entry (SORRY,HIGH, -321) */
9636#define ISO_WRONG_RR 0xE030FEBF
9637
9638/** Unsupported RR feature (SORRY,HIGH, -322) */
9639#define ISO_UNSUPPORTED_RR 0xE030FEBE
9640
9641/** Wrong or damaged ECMA-119 (FAILURE,HIGH, -323) */
9642#define ISO_WRONG_ECMA119 0xE830FEBD
9643
9644/** Unsupported ECMA-119 feature (FAILURE,HIGH, -324) */
9645#define ISO_UNSUPPORTED_ECMA119 0xE830FEBC
9646
9647/** Wrong or damaged El-Torito catalog (WARN,HIGH, -325) */
9648#define ISO_WRONG_EL_TORITO 0xD030FEBB
9649
9650/** Unsupported El-Torito feature (WARN,HIGH, -326) */
9651#define ISO_UNSUPPORTED_EL_TORITO 0xD030FEBA
9652
9653/** Can't patch an isolinux boot image (SORRY,HIGH, -327) */
9654#define ISO_ISOLINUX_CANT_PATCH 0xE030FEB9
9655
9656/** Unsupported SUSP feature (SORRY,HIGH, -328) */
9657#define ISO_UNSUPPORTED_SUSP 0xE030FEB8
9658
9659/** Error on a RR entry that can be ignored (WARNING,HIGH, -329) */
9660#define ISO_WRONG_RR_WARN 0xD030FEB7
9661
9662/** Error on a RR entry that can be ignored (HINT,MEDIUM, -330) */
9663#define ISO_SUSP_UNHANDLED 0xC020FEB6
9664
9665/** Multiple ER SUSP entries found (WARNING,HIGH, -331) */
9666#define ISO_SUSP_MULTIPLE_ER 0xD030FEB5
9667
9668/** Unsupported volume descriptor found (HINT,MEDIUM, -332) */
9669#define ISO_UNSUPPORTED_VD 0xC020FEB4
9670
9671/** El-Torito related warning (WARNING,HIGH, -333) */
9672#define ISO_EL_TORITO_WARN 0xD030FEB3
9673
9674/** Image write cancelled (MISHAP,HIGH, -334) */
9675#define ISO_IMAGE_WRITE_CANCELED 0xE430FEB2
9676
9677/** El-Torito image is hidden (WARNING,HIGH, -335) */
9678#define ISO_EL_TORITO_HIDDEN 0xD030FEB1
9679
9680
9681/** AAIP info with ACL or xattr in ISO image will be ignored
9682 (NOTE, HIGH, -336) */
9683#define ISO_AAIP_IGNORED 0xB030FEB0
9684
9685/** Error with decoding ACL from AAIP info (FAILURE, HIGH, -337) */
9686#define ISO_AAIP_BAD_ACL 0xE830FEAF
9687
9688/** Error with encoding ACL for AAIP (FAILURE, HIGH, -338) */
9689#define ISO_AAIP_BAD_ACL_TEXT 0xE830FEAE
9690
9691/** AAIP processing for ACL or xattr not enabled at compile time
9692 (FAILURE, HIGH, -339) */
9693#define ISO_AAIP_NOT_ENABLED 0xE830FEAD
9694
9695/** Error with decoding AAIP info for ACL or xattr (FAILURE, HIGH, -340) */
9696#define ISO_AAIP_BAD_AASTRING 0xE830FEAC
9697
9698/** Error with reading ACL or xattr from local file (FAILURE, HIGH, -341) */
9699#define ISO_AAIP_NO_GET_LOCAL 0xE830FEAB
9700/** Error with reading ACL or xattr from local file (SORRY, HIGH, -341) */
9701#define ISO_AAIP_NO_GET_LOCAL_S 0xE030FEAB
9702
9703/** Error with attaching ACL or xattr to local file (FAILURE, HIGH, -342) */
9704#define ISO_AAIP_NO_SET_LOCAL 0xE830FEAA
9705/** Error with attaching ACL or xattr to local file (SORRY, HIGH, -342) */
9706#define ISO_AAIP_NO_SET_LOCAL_S 0xE030FEAA
9707
9708/** Unallowed attempt to set an xattr with non-userspace name
9709 (FAILURE, HIGH, -343) */
9710#define ISO_AAIP_NON_USER_NAME 0xE830FEA9
9711
9712/** Too many references on a single IsoExternalFilterCommand
9713 (FAILURE, HIGH, -344) */
9714#define ISO_EXTF_TOO_OFTEN 0xE830FEA8
9715
9716/** Use of zlib was not enabled at compile time (FAILURE, HIGH, -345) */
9717#define ISO_ZLIB_NOT_ENABLED 0xE830FEA7
9718
9719/** File too large. Cannot apply zisofs filter. (FAILURE, HIGH, -346) */
9720#define ISO_ZISOFS_TOO_LARGE 0xE830FEA6
9721
9722/** Filter input differs from previous run (FAILURE, HIGH, -347) */
9723#define ISO_FILTER_WRONG_INPUT 0xE830FEA5
9724
9725/** zlib compression/decompression error (FAILURE, HIGH, -348) */
9726#define ISO_ZLIB_COMPR_ERR 0xE830FEA4
9727
9728/** Input stream is not in a supported zisofs format (FAILURE, HIGH, -349) */
9729#define ISO_ZISOFS_WRONG_INPUT 0xE830FEA3
9730
9731/** Cannot set global zisofs parameters while filters exist
9732 (FAILURE, HIGH, -350) */
9733#define ISO_ZISOFS_PARAM_LOCK 0xE830FEA2
9734
9735/** Premature EOF of zlib input stream (FAILURE, HIGH, -351) */
9736#define ISO_ZLIB_EARLY_EOF 0xE830FEA1
9737
9738/**
9739 * Checksum area or checksum tag appear corrupted (WARNING,HIGH, -352)
9740 * @since 0.6.22
9741*/
9742#define ISO_MD5_AREA_CORRUPTED 0xD030FEA0
9743
9744/**
9745 * Checksum mismatch between checksum tag and data blocks
9746 * (FAILURE, HIGH, -353)
9747 * @since 0.6.22
9748*/
9749#define ISO_MD5_TAG_MISMATCH 0xE830FE9F
9750
9751/**
9752 * Checksum mismatch in System Area, Volume Descriptors, or directory tree.
9753 * (FAILURE, HIGH, -354)
9754 * @since 0.6.22
9755*/
9756#define ISO_SB_TREE_CORRUPTED 0xE830FE9E
9757
9758/**
9759 * Unexpected checksum tag type encountered. (WARNING, HIGH, -355)
9760 * @since 0.6.22
9761*/
9762#define ISO_MD5_TAG_UNEXPECTED 0xD030FE9D
9763
9764/**
9765 * Misplaced checksum tag encountered. (WARNING, HIGH, -356)
9766 * @since 0.6.22
9767*/
9768#define ISO_MD5_TAG_MISPLACED 0xD030FE9C
9769
9770/**
9771 * Checksum tag with unexpected address range encountered.
9772 * (WARNING, HIGH, -357)
9773 * @since 0.6.22
9774*/
9775#define ISO_MD5_TAG_OTHER_RANGE 0xD030FE9B
9776
9777/**
9778 * Detected file content changes while it was written into the image.
9779 * (MISHAP, HIGH, -358)
9780 * @since 0.6.22
9781*/
9782#define ISO_MD5_STREAM_CHANGE 0xE430FE9A
9783
9784/**
9785 * Session does not start at LBA 0. scdbackup checksum tag not written.
9786 * (WARNING, HIGH, -359)
9787 * @since 0.6.24
9788*/
9789#define ISO_SCDBACKUP_TAG_NOT_0 0xD030FE99
9790
9791/**
9792 * The setting of iso_write_opts_set_ms_block() leaves not enough room
9793 * for the prescibed size of iso_write_opts_set_overwrite_buf().
9794 * (FAILURE, HIGH, -360)
9795 * @since 0.6.36
9796 */
9797#define ISO_OVWRT_MS_TOO_SMALL 0xE830FE98
9798
9799/**
9800 * The partition offset is not 0 and leaves not not enough room for
9801 * system area, volume descriptors, and checksum tags of the first tree.
9802 * (FAILURE, HIGH, -361)
9803 */
9804#define ISO_PART_OFFST_TOO_SMALL 0xE830FE97
9805
9806/**
9807 * The ring buffer is smaller than 64 kB + partition offset.
9808 * (FAILURE, HIGH, -362)
9809 */
9810#define ISO_OVWRT_FIFO_TOO_SMALL 0xE830FE96
9811
9812/** Use of libjte was not enabled at compile time (FAILURE, HIGH, -363) */
9813#define ISO_LIBJTE_NOT_ENABLED 0xE830FE95
9814
9815/** Failed to start up Jigdo Template Extraction (FAILURE, HIGH, -364) */
9816#define ISO_LIBJTE_START_FAILED 0xE830FE94
9817
9818/** Failed to finish Jigdo Template Extraction (FAILURE, HIGH, -365) */
9819#define ISO_LIBJTE_END_FAILED 0xE830FE93
9820
9821/** Failed to process file for Jigdo Template Extraction
9822 (MISHAP, HIGH, -366) */
9823#define ISO_LIBJTE_FILE_FAILED 0xE430FE92
9824
9825/** Too many MIPS Big Endian boot files given (max. 15) (FAILURE, HIGH, -367)*/
9826#define ISO_BOOT_TOO_MANY_MIPS 0xE830FE91
9827
9828/** Boot file missing in image (MISHAP, HIGH, -368) */
9829#define ISO_BOOT_FILE_MISSING 0xE430FE90
9830
9831/** Partition number out of range (FAILURE, HIGH, -369) */
9832#define ISO_BAD_PARTITION_NO 0xE830FE8F
9833
9834/** Cannot open data file for appended partition (FAILURE, HIGH, -370) */
9835#define ISO_BAD_PARTITION_FILE 0xE830FE8E
9836
9837/** May not combine MBR partition with non-MBR system area
9838 (FAILURE, HIGH, -371) */
9839#define ISO_NON_MBR_SYS_AREA 0xE830FE8D
9840
9841/** Displacement offset leads outside 32 bit range (FAILURE, HIGH, -372) */
9842#define ISO_DISPLACE_ROLLOVER 0xE830FE8C
9843
9844/** File name cannot be written into ECMA-119 untranslated
9845 (FAILURE, HIGH, -373) */
9846#define ISO_NAME_NEEDS_TRANSL 0xE830FE8B
9847
9848/** Data file input stream object offers no cloning method
9849 (FAILURE, HIGH, -374) */
9850#define ISO_STREAM_NO_CLONE 0xE830FE8A
9851
9852/** Extended information class offers no cloning method
9853 (FAILURE, HIGH, -375) */
9854#define ISO_XINFO_NO_CLONE 0xE830FE89
9855
9856/** Found copied superblock checksum tag (WARNING, HIGH, -376) */
9857#define ISO_MD5_TAG_COPIED 0xD030FE88
9858
9859/** Rock Ridge leaf name too long (FAILURE, HIGH, -377) */
9860#define ISO_RR_NAME_TOO_LONG 0xE830FE87
9861
9862/** Reserved Rock Ridge leaf name (FAILURE, HIGH, -378) */
9863#define ISO_RR_NAME_RESERVED 0xE830FE86
9864
9865/** Rock Ridge path too long (FAILURE, HIGH, -379) */
9866#define ISO_RR_PATH_TOO_LONG 0xE830FE85
9867
9868/** Attribute name cannot be represented (FAILURE, HIGH, -380) */
9869#define ISO_AAIP_BAD_ATTR_NAME 0xE830FE84
9870
9871/** ACL text contains multiple entries of user::, group::, other::
9872 (FAILURE, HIGH, -381) */
9873#define ISO_AAIP_ACL_MULT_OBJ 0xE830FE83
9874
9875/** File sections do not form consecutive array of blocks
9876 (FAILURE, HIGH, -382) */
9877#define ISO_SECT_SCATTERED 0xE830FE82
9878
9879/** Too many Apple Partition Map entries requested (FAILURE, HIGH, -383) */
9880#define ISO_BOOT_TOO_MANY_APM 0xE830FE81
9881
9882/** Overlapping Apple Partition Map entries requested (FAILURE, HIGH, -384) */
9883#define ISO_BOOT_APM_OVERLAP 0xE830FE80
9884
9885/** Too many GPT entries requested (FAILURE, HIGH, -385) */
9886#define ISO_BOOT_TOO_MANY_GPT 0xE830FE7F
9887
9888/** Overlapping GPT entries requested (FAILURE, HIGH, -386) */
9889#define ISO_BOOT_GPT_OVERLAP 0xE830FE7E
9890
9891/** Too many MBR partition entries requested (FAILURE, HIGH, -387) */
9892#define ISO_BOOT_TOO_MANY_MBR 0xE830FE7D
9893
9894/** Overlapping MBR partition entries requested (FAILURE, HIGH, -388) */
9895#define ISO_BOOT_MBR_OVERLAP 0xE830FE7C
9896
9897/** Attempt to use an MBR partition entry twice (FAILURE, HIGH, -389) */
9898#define ISO_BOOT_MBR_COLLISION 0xE830FE7B
9899
9900/** No suitable El Torito EFI boot image for exposure as GPT partition
9901 (FAILURE, HIGH, -390) */
9902#define ISO_BOOT_NO_EFI_ELTO 0xE830FE7A
9903
9904/** Not a supported HFS+ or APM block size (FAILURE, HIGH, -391) */
9905#define ISO_BOOT_HFSP_BAD_BSIZE 0xE830FE79
9906
9907/** APM block size prevents coexistence with GPT (FAILURE, HIGH, -392) */
9908#define ISO_BOOT_APM_GPT_BSIZE 0xE830FE78
9909
9910/** Name collision in HFS+, mangling not possible (FAILURE, HIGH, -393) */
9911#define ISO_HFSP_NO_MANGLE 0xE830FE77
9912
9913/** Symbolic link cannot be resolved (FAILURE, HIGH, -394) */
9914#define ISO_DEAD_SYMLINK 0xE830FE76
9915
9916/** Too many chained symbolic links (FAILURE, HIGH, -395) */
9917#define ISO_DEEP_SYMLINK 0xE830FE75
9918
9919/** Unrecognized file type in ISO image (FAILURE, HIGH, -396) */
9920#define ISO_BAD_ISO_FILETYPE 0xE830FE74
9921
9922/** Filename not suitable for character set UCS-2 (WARNING, HIGH, -397) */
9923#define ISO_NAME_NOT_UCS2 0xD030FE73
9924
9925/** File name collision during ISO image import (WARNING, HIGH, -398) */
9926#define ISO_IMPORT_COLLISION 0xD030FE72
9927
9928/** Incomplete HP-PA PALO boot parameters (FAILURE, HIGH, -399) */
9929#define ISO_HPPA_PALO_INCOMPL 0xE830FE71
9930
9931/** HP-PA PALO boot address exceeds 2 GB (FAILURE, HIGH, -400) */
9932#define ISO_HPPA_PALO_OFLOW 0xE830FE70
9933
9934/** HP-PA PALO file is not a data file (FAILURE, HIGH, -401) */
9935#define ISO_HPPA_PALO_NOTREG 0xE830FE6F
9936
9937/** HP-PA PALO command line too long (FAILURE, HIGH, -402) */
9938#define ISO_HPPA_PALO_CMDLEN 0xE830FE6E
9939
9940/** Problems encountered during inspection of System Area (WARN, HIGH, -403) */
9941#define ISO_SYSAREA_PROBLEMS 0xD030FE6D
9942
9943/** Unrecognized inquiry for system area property (FAILURE, HIGH, -404) */
9944#define ISO_INQ_SYSAREA_PROP 0xE830FE6C
9945
9946/** DEC Alpha Boot Loader file is not a data file (FAILURE, HIGH, -405) */
9947#define ISO_ALPHA_BOOT_NOTREG 0xE830FE6B
9948
9949/** No data source of imported ISO image available (WARNING, HIGH, -406) */
9950#define ISO_NO_KEPT_DATA_SRC 0xD030FE6A
9951
9952/** Malformed description string for interval reader (FAILURE, HIGH, -407) */
9953#define ISO_MALFORMED_READ_INTVL 0xE830FE69
9954
9955/** Unreadable file, premature EOF, or failure to seek for interval reader
9956 (WARNING, HIGH, -408) */
9957#define ISO_INTVL_READ_PROBLEM 0xD030FE68
9958
9959/** Cannot arrange content of data files in surely reproducible way
9960 (NOTE, HIGH, -409) */
9961#define ISO_NOT_REPRODUCIBLE 0xB030FE67
9962
9963/** May not write boot info into filtered stream of boot image
9964 (FAILURE, HIGH, -410) */
9965#define ISO_PATCH_FILTERED_BOOT 0xE830FE66
9966
9967/** Boot image to large to buffer for writing boot info
9968 (FAILURE, HIGH, -411) */
9969#define ISO_PATCH_OVERSIZED_BOOT 0xE830FE65
9970
9971/** File name had to be truncated and MD5 marked (WARNING, HIGH, -412) */
9972#define ISO_RR_NAME_TRUNCATED 0xD030FE64
9973
9974/** File name truncation length changed by loaded image info
9975 (NOTE, HIGH, -413) */
9976#define ISO_TRUNCATE_ISOFSNT 0xB030FE63
9977
9978/** General note (NOTE, HIGH, -414) */
9979#define ISO_GENERAL_NOTE 0xB030FE62
9980
9981/** Unrecognized file type of IsoFileSrc object (SORRY, HIGH, -415) */
9982#define ISO_BAD_FSRC_FILETYPE 0xE030FE61
9983
9984/** Cannot derive GPT GUID from undefined pseudo-UUID volume timestamp
9985 (FAILURE, HIGH, -416) */
9986#define ISO_GPT_NO_VOL_UUID 0xE830FE60
9987
9988/** Unrecognized GPT disk GUID setup mode
9989 (FAILURE, HIGH, -417) */
9990#define ISO_BAD_GPT_GUID_MODE 0xE830FE5F
9991
9992/** Unable to obtain root directory (FATAL,HIGH, -418) */
9993#define ISO_NO_ROOT_DIR 0xF030FE5E
9994
9995/** Zero sized, oversized, or mislocated SUSP CE area found
9996 (FAILURE, HIGH, -419) */
9997#define ISO_SUSP_WRONG_CE_SIZE 0xE830FE5D
9998
9999/** Multi-session would overwrite imported_iso interval
10000 (FAILURE, HIGH, -420) */
10001#define ISO_MULTI_OVER_IMPORTED 0xE830FE5C
10002
10003/** El-Torito EFI image is hidden (NOTE,HIGH, -421) */
10004#define ISO_ELTO_EFI_HIDDEN 0xB030FE5B
10005
10006/** Too many files in HFS+ directory tree (FAILURE, HIGH, -422) */
10007#define ISO_HFSPLUS_TOO_MANY_FILES 0xE830FE5A
10008
10009/** Too many zisofs block pointers needed overall (FAILURE, HIGH, -423) */
10010#define ISO_ZISOFS_TOO_MANY_PTR 0xE830FE59
10011
10012/** Prevented zisofs block pointer counter underrun (WARNING,MEDIUM, -424) */
10013#define ISO_ZISOFS_BPT_UNDERRUN 0xD020FE58
10014
10015/** Cannot obtain size of zisofs compressed stream (FAILURE, HIGH, -425) */
10016#define ISO_ZISOFS_UNKNOWN_SIZE 0xE830FE57
10017
10018/** Undefined IsoReadImageFeatures name (SORRY, HIGH, -426) */
10019#define ISO_UNDEF_READ_FEATURE 0xE030FE56
10020
10021/** Too many CE entries for single file (FAILURE,HIGH, -427) */
10022#define ISO_TOO_MANY_CE 0xE830FE55
10023
10024/** Too many CE entries for single file when mounted by Linux
10025 (WARNING,HIGH, -428) */
10026#define ISO_TOO_MANY_CE_FOR_LINUX 0xD030FE54
10027
10028/** Too many CE entries for single file, omitting attributes
10029 (WARNING,HIGH, -429) */
10030#define ISO_CE_REMOVING_ATTR 0xD030FE53
10031
10032/** Unknown Linux-like chattr letter encountered during conversion
10033 (WARNING,HIGH, -430) */
10034#define ISO_LFA_UNKNOWN_LETTER 0xD030FE52
10035
10036/** Unknown Linux-like file attribute flag bit encountered during conversion
10037 (WARNING,HIGH, -431) */
10038#define ISO_LFA_UNKNOWN_BIT 0xD030FE51
10039
10040/** Local Linux-like file attribute processing not enabled at compile time
10041 (SORRY,HIGH, -432) */
10042#define ISO_LFA_NOT_ENABLED 0xE030FE50
10043
10044/** Error with getting Linux-like file attributes of local file
10045 (SORRY,HIGH, -433) */
10046#define ISO_LFA_NO_GET_LOCAL 0xE030FE4F
10047
10048/** Error with setting Linux-like file attributes of local file
10049 (SORRY,HIGH, -434) */
10050#define ISO_LFA_NO_SET_LOCAL 0xE030FE4E
10051
10052/** Failure to open local file for Linux-like file attributes
10053 (SORRY,HIGH, -435) */
10054#define ISO_LFA_NO_OPEN_LOCAL 0xE030FE4D
10055
10056/** Local XFS-style file project id processing not enabled at compile time
10057 (SORRY,HIGH, -436) */
10058#define ISO_PROJID_NOT_ENABLED 0xE030FE4C
10059
10060/** Error with getting XFS-style project id of local file
10061 (SORRY,HIGH, -437) */
10062#define ISO_PROJID_NO_GET_LOCAL 0xE030FE4B
10063
10064/** Error with setting XFS-style project id of local file
10065 (SORRY,HIGH, -438) */
10066#define ISO_PROJID_NO_SET_LOCAL 0xE030FE4A
10067
10068/** Failure to open local file for XFS-style project id
10069 (SORRY,HIGH, -439) */
10070#define ISO_PROJID_NO_OPEN_LOCAL 0xE030FE49
10071
10072/** Size calculation mismatch with directory record or continuation area
10073 (WARNING,HIGH, -440) */
10074#define ISO_DIR_REC_SIZE_MISMATCH 0xD030FE48
10075
10076/** More than 4294967295 bytes of Continuation area (WARNING,HIGH, -441) */
10077#define ISO_INSANE_CE_SIZE 0xD030FE47
10078
10079/** Creation of device file in local filesystem failed (FAILURE,HIGH, -442) */
10080#define ISO_DEV_NOT_CREATED 0xE830FE46
10081
10082/** Creation of device file type in local filesystem is not enabled
10083 (FAILURE,HIGH, -443) */
10084#define ISO_DEV_NO_CREATION 0xE830FE45
10085
10086
10087/* Internal developer note:
10088 Place new error codes directly above this comment.
10089 Newly introduced errors must get a message entry in
10090 libisofs/messages.c, function iso_error_to_msg()
10091*/
10092
10093/* ! PLACE NEW ERROR CODES ABOVE. NOT AFTER THIS LINE ! */
10094
10095
10096/** Read error occurred with IsoDataSource (SORRY,HIGH, -513) */
10097#define ISO_DATA_SOURCE_SORRY 0xE030FCFF
10098
10099/** Read error occurred with IsoDataSource (MISHAP,HIGH, -513) */
10100#define ISO_DATA_SOURCE_MISHAP 0xE430FCFF
10101
10102/** Read error occurred with IsoDataSource (FAILURE,HIGH, -513) */
10103#define ISO_DATA_SOURCE_FAILURE 0xE830FCFF
10104
10105/** Read error occurred with IsoDataSource (FATAL,HIGH, -513) */
10106#define ISO_DATA_SOURCE_FATAL 0xF030FCFF
10107
10108
10109/* ! PLACE NEW ERROR CODES SEVERAL LINES ABOVE. NOT HERE ! */
10110
10111
10112/* ------------------------------------------------------------------------- */
10113
10114#ifdef LIBISOFS_WITHOUT_LIBBURN
10115
10116/**
10117 This is a copy from the API of libburn-0.6.0 (under GPL).
10118 It is supposed to be as stable as any overall include of libburn.h.
10119 I.e. if this definition is out of sync then you cannot rely on any
10120 contract that was made with libburn.h.
10121
10122 Libisofs does not need to be linked with libburn at all. But if it is
10123 linked with libburn then it must be libburn-0.4.2 or later.
10124
10125 An application that provides own struct burn_source objects and does not
10126 include libburn/libburn.h has to define LIBISOFS_WITHOUT_LIBBURN before
10127 including libisofs/libisofs.h in order to make this copy available.
10128*/
10129
10130
10131/** Data source interface for tracks.
10132 This allows to use arbitrary program code as provider of track input data.
10133
10134 Objects compliant to this interface are either provided by the application
10135 or by API calls of libburn: burn_fd_source_new(), burn_file_source_new(),
10136 and burn_fifo_source_new().
10137
10138 libisofs acts as "application" and implements an own class of burn_source.
10139 Instances of that class are handed out by iso_image_create_burn_source().
10140
10141*/
10142struct burn_source {
10143
10144 /** Reference count for the data source. MUST be 1 when a new source
10145 is created and thus the first reference is handed out. Increment
10146 it to take more references for yourself. Use burn_source_free()
10147 to destroy your references to it. */
10148 int refcount;
10149
10150
10151 /** Read data from the source. Semantics like with read(2), but MUST
10152 either deliver the full buffer as defined by size or MUST deliver
10153 EOF (return 0) or failure (return -1) at this call or at the
10154 next following call. I.e. the only incomplete buffer may be the
10155 last one from that source.
10156 libburn will read a single sector by each call to (*read).
10157 The size of a sector depends on BURN_MODE_*. The known range is
10158 2048 to 2352.
10159
10160 If this call is reading from a pipe then it will learn
10161 about the end of data only when that pipe gets closed on the
10162 feeder side. So if the track size is not fixed or if the pipe
10163 delivers less than the predicted amount or if the size is not
10164 block aligned, then burning will halt until the input process
10165 closes the pipe.
10166
10167 IMPORTANT:
10168 If this function pointer is NULL, then the struct burn_source is of
10169 version >= 1 and the job of .(*read)() is done by .(*read_xt)().
10170 See below, member .version.
10171 */
10172 int (*read)(struct burn_source *, unsigned char *buffer, int size);
10173
10174
10175 /** Read subchannel data from the source (NULL if lib generated)
10176 WARNING: This is an obscure feature with CD raw write modes.
10177 Unless you checked the libburn code for correctness in that aspect
10178 you should not rely on raw writing with own subchannels.
10179 ADVICE: Set this pointer to NULL.
10180 */
10181 int (*read_sub)(struct burn_source *, unsigned char *buffer, int size);
10182
10183
10184 /** Get the size of the source's data. Return 0 means unpredictable
10185 size. If application provided (*get_size) allows return 0, then
10186 the application MUST provide a fully functional (*set_size).
10187 */
10188 off_t (*get_size)(struct burn_source *);
10189
10190
10191 /* @since 0.3.2 */
10192 /** Program the reply of (*get_size) to a fixed value. It is advised
10193 to implement this by a attribute off_t fixed_size; in *data .
10194 The read() function does not have to take into respect this fake
10195 setting. It is rather a note of libburn to itself. Possibly
10196 necessary truncation or padding is done in libburn. Truncation
10197 is usually considered a misburn. Padding is considered ok.
10198
10199 libburn is supposed to work even if (*get_size) ignores the
10200 setting by (*set_size). But your application will not be able to
10201 enforce fixed track sizes by burn_track_set_size() and possibly
10202 even padding might be left out.
10203 */
10204 int (*set_size)(struct burn_source *source, off_t size);
10205
10206
10207 /** Clean up the source specific data. This function will be called
10208 once by burn_source_free() when the last referer disposes the
10209 source.
10210 */
10211 void (*free_data)(struct burn_source *);
10212
10213
10214 /** Next source, for when a source runs dry and padding is disabled
10215 WARNING: This is an obscure feature. Set to NULL at creation and
10216 from then on leave untouched and uninterpreted.
10217 */
10218 struct burn_source *next;
10219
10220
10221 /** Source specific data. Here the various source classes express their
10222 specific properties and the instance objects store their individual
10223 management data.
10224 E.g. data could point to a struct like this:
10225 struct app_burn_source
10226 {
10227 struct my_app *app_handle;
10228 ... other individual source parameters ...
10229 off_t fixed_size;
10230 };
10231
10232 Function (*free_data) has to be prepared to clean up and free
10233 the struct.
10234 */
10235 void *data;
10236
10237
10238 /* @since 0.4.2 */
10239 /** Valid only if above member .(*read)() is NULL. This indicates a
10240 version of struct burn_source younger than 0.
10241 From then on, member .version tells which further members exist
10242 in the memory layout of struct burn_source. libburn will only touch
10243 those announced extensions.
10244
10245 Versions:
10246 0 has .(*read)() != NULL, not even .version is present.
10247 1 has .version, .(*read_xt)(), .(*cancel)()
10248 */
10249 int version;
10250
10251 /** This substitutes for (*read)() in versions above 0. */
10252 int (*read_xt)(struct burn_source *, unsigned char *buffer, int size);
10253
10254 /** Informs the burn_source that the consumer of data prematurely
10255 ended reading. This call may or may not be issued by libburn
10256 before (*free_data)() is called.
10257 */
10258 int (*cancel)(struct burn_source *source);
10259};
10260
10261#endif /* LIBISOFS_WITHOUT_LIBBURN */
10262
10263/* ----------------------------- Bug Fixes ----------------------------- */
10264
10265/* currently none being tested */
10266
10267
10268/* ---------------------------- Improvements --------------------------- */
10269
10270/* currently none being tested */
10271
10272
10273/* ---------------------------- Experiments ---------------------------- */
10274
10275
10276/* Experiment: Write obsolete RR entries with Rock Ridge.
10277 I suspect Solaris wants to see them.
10278 DID NOT HELP: Solaris knows only RRIP_1991A.
10279
10280 #define Libisofs_with_rrip_rR yes
10281*/
10282
10283#ifdef __cplusplus
10284} /* extern "C" */
10285#endif
10286
10287#endif /*LIBISO_LIBISOFS_H_*/
int iso_image_get_all_boot_imgs(IsoImage *image, int *num_boots, ElToritoBootImage ***boots, IsoFile ***bootnodes, int flag)
Get all El-Torito boot images of an ISO image.
off_t iso_file_source_lseek(IsoFileSource *src, off_t offset, int flag)
Repositions the offset of the given IsoFileSource (must be opened) to the given offset according to t...
void iso_node_set_permissions(IsoNode *node, mode_t mode)
Set the permissions for the node.
int iso_write_opts_set_efi_bootp(IsoWriteOpts *opts, char *image_path, int flag)
Copy a data file from the local filesystem into the emerging ISO image.
int iso_write_opts_set_hfsplus(IsoWriteOpts *opts, int enable)
Whether to add a HFS+ filesystem to the image which points to the same file content as the other dire...
int iso_image_update_sizes(IsoImage *image)
Update the sizes of all files added to image.
int iso_file_get_md5(IsoImage *image, IsoFile *file, char md5[16], int flag)
Obtain the recorded MD5 checksum of a data file from the loaded ISO image.
int iso_file_get_old_image_lba(IsoFile *file, uint32_t *lba, int flag)
Get the block lba of a file node, if it was imported from an old image.
const char * iso_image_get_volume_id(const IsoImage *image)
Get the volume identifier of an image for ISO 9660 and Rock Ridge.
int iso_local_get_projid(char *disk_path, uint32_t *projid, int *os_errno, int flag)
Obtain the XFS-style project id of the given file.
int iso_image_report_el_torito(IsoImage *image, char ***reply, int *line_count, int flag)
Obtain an array of texts describing the detected properties of the possibly loaded El Torito boot inf...
struct Iso_Symlink IsoSymlink
A symbolic link in the iso tree.
Definition libisofs.h:193
void iso_tree_set_follow_symlinks(IsoImage *image, int follow)
Set whether to follow or not symbolic links when added a file from a source to IsoImage.
int iso_local_attr_support(int flag)
libisofs has an internal system dependent adapter to perform operations on ACL, xattr,...
IsoFindCondition * iso_new_find_conditions_mode(mode_t mask)
Create a new condition that checks the node mode against a mode mask.
const char * iso_image_fs_get_volume_id_v2(IsoImageFilesystem *fs, int fs_type)
Get the volume identifier of a loaded image from a particular filesystem superblock.
int iso_image_set_sparc_core(IsoImage *img, IsoFile *sparc_core, int flag)
Designate a data file in the ISO image of which the position and size shall be written after the SUN ...
int iso_sev_to_text(int severity_number, char **severity_name)
Convert a severity number into a severity name.
int iso_local_set_attrs(char *disk_path, size_t num_attrs, char **names, size_t *value_lengths, char **values, int flag)
Older version of iso_local_set_attrs_errno() without the errnos array.
void iso_tree_set_ignore_hidden(IsoImage *image, int skip)
Set whether to skip or not disk files with names beginning by '.
int iso_write_opts_set_default_uid(IsoWriteOpts *opts, uid_t uid)
Set the uid to use when you set the replace_uid to 2.
IsoFilesystem * iso_file_source_get_filesystem(IsoFileSource *src)
Get the filesystem for this source.
int iso_read_opts_auto_input_charset(IsoReadOpts *opts, int mode)
Enable or disable methods to automatically choose an input charset.
int iso_interval_reader_new(IsoImage *img, char *path, struct iso_interval_reader **ivr, off_t *byte_count, int flag)
Create an interval reader object.
int iso_write_opts_set_joliet_utf16(IsoWriteOpts *opts, int allow)
Use character set UTF-16BE with Joliet, which is a superset of the actually prescribed character set ...
int iso_interval_reader_read(struct iso_interval_reader *ivr, uint8_t *buf, int *buf_fill, int flag)
Read the next block of 2048 bytes from an interval reader object.
int iso_image_add_mips_boot_file(IsoImage *image, char *path, int flag)
Add a MIPS boot file path to the image.
void iso_lib_version(int *major, int *minor, int *micro)
Get version of the libisofs library at runtime.
int iso_node_lookup_attr(IsoNode *node, char *name, size_t *value_length, char **value, int flag)
Obtain the value of a particular xattr name.
int iso_image_path_to_node(IsoImage *image, const char *path, IsoNode **node)
Locate a node by its absolute path in the image.
struct iso_read_image_features IsoReadImageFeatures
Return information for image.
Definition libisofs.h:485
int iso_image_set_boot_catalog_hidden(IsoImage *image, int hide_attrs)
Hides the boot catalog file from directory trees.
int iso_assess_written_features(IsoDataSource *src, IsoReadOpts *opts, IsoReadImageFeatures **features, IsoWriteOpts **write_opts)
Assess features of the importable directory trees of src and an estimation of the write options which...
IsoFindCondition * iso_new_find_conditions_or(IsoFindCondition *a, IsoFindCondition *b)
Create a new condition that check if at least one the two given conditions is valid.
int iso_image_add_new_symlink(IsoImage *image, IsoDir *parent, const char *name, const char *dest, IsoSymlink **link)
Add a new symbolic link to the directory tree.
int iso_image_add_boot_image(IsoImage *image, const char *image_path, enum eltorito_boot_media_type type, int flag, ElToritoBootImage **boot)
Add a further boot image to the set of El-Torito bootable images.
int iso_write_opts_set_fifo_size(IsoWriteOpts *opts, size_t fifo_size)
Set the size, in number of blocks, of the ring buffer used between the writer thread and the burn_sou...
enum iso_replace_mode iso_tree_get_replace_mode(IsoImage *image)
Get current setting for replace_mode.
int iso_md5_clone(void *old_md5_context, void **new_md5_context)
Create a MD5 computation context as clone of an existing one.
int iso_conv_name_chars(IsoWriteOpts *opts, char *name, size_t name_len, char **result, size_t *result_len, int flag)
Convert the characters in name from local charset to another charset or convert name to the represent...
int iso_read_opts_set_no_rockridge(IsoReadOpts *opts, int norr)
Do not read Rock Ridge extensions.
int iso_write_opts_set_disc_label(IsoWriteOpts *opts, char *label)
Set a name for the system area.
int iso_file_source_lstat(IsoFileSource *src, struct stat *info)
Get information about the file.
int el_torito_set_boot_platform_id(ElToritoBootImage *bootimg, uint8_t id)
Sets the platform ID of the boot image.
int iso_write_opts_set_no_force_dots(IsoWriteOpts *opts, int no)
ISO-9660 forces filenames to have a ".", that separates file name from extension.
int iso_image_set_boot_image(IsoImage *image, const char *image_path, enum eltorito_boot_media_type type, const char *catalog_path, ElToritoBootImage **boot)
Create a new set of El-Torito bootable images by adding a boot catalog and the default boot image.
const char * iso_image_fs_get_application_id(IsoImageFilesystem *fs)
Get the application identifier for an existent image.
int iso_node_zf_by_magic(IsoNode *node, int flag)
Check for the given node or for its subtree whether the data file content effectively bears zisofs fi...
int iso_write_opts_set_allow_dir_id_ext(IsoWriteOpts *opts, int allow)
Convert directory names for ECMA-119 similar to other file names, but do not force a dot or add a ver...
int iso_image_get_truncate_mode(IsoImage *img, int *mode, int *length)
Inquire the current setting of iso_image_set_truncate_mode().
int iso_write_opts_set_rrip_tf_y1900(IsoWriteOpts *opts, int enable)
Enable curbing of of time values before year 1900 AD in RRIP field TF.
int iso_write_opts_set_part_offset(IsoWriteOpts *opts, uint32_t block_offset_2k, int secs_512_per_head, int heads_per_cyl)
int iso_file_source_get_aa_string(IsoFileSource *src, unsigned char **aa_string, int flag)
Get the AAIP string with encoded ACL and xattr.
int iso_md5_end(void **md5_context, char result[16])
Obtain the MD5 checksum from a MD5 computation context and dispose this context.
IsoFindCondition * iso_new_find_conditions_not(IsoFindCondition *negate)
Create a new condition that check if the given conditions is false.
int aaip_xinfo_cloner(void *old_data, void **new_data, int flag)
The iso_node_xinfo_cloner function which gets associated to aaip_xinfo_func by iso_init() or iso_init...
int el_torito_get_boot_platform_id(ElToritoBootImage *bootimg)
Get the platform ID value.
int iso_node_get_attrs(IsoNode *node, size_t *num_attrs, char ***names, size_t **value_lengths, char ***values, int flag)
Get the list of xattr which is associated with the node.
int iso_image_add_new_dir(IsoImage *image, IsoDir *parent, const char *name, IsoDir **dir)
Add a new directory to the iso tree.
void iso_node_unref(IsoNode *node)
Decrements the reference counting of the given node.
eltorito_boot_media_type
El-Torito bootable image type.
Definition libisofs.h:339
@ ELTORITO_HARD_DISC_EMUL
Definition libisofs.h:341
@ ELTORITO_FLOPPY_EMUL
Definition libisofs.h:340
@ ELTORITO_NO_EMUL
Definition libisofs.h:342
int iso_local_get_perms_wo_acl(char *disk_path, mode_t *st_mode, int flag)
Obtain permissions of a file in the local filesystem which shall reflect ACL entry "group::" in S_IRW...
int iso_write_opts_set_always_gmt(IsoWriteOpts *opts, int gmt)
Whether to always record timestamps in GMT.
int iso_file_source_read(IsoFileSource *src, void *buf, size_t count)
Attempts to read up to count bytes from the given source into the buffer starting at buf.
int iso_write_opts_new(IsoWriteOpts **opts, int profile)
Creates an IsoWriteOpts for writing an image.
struct Iso_File IsoFile
A regular file in the iso tree.
Definition libisofs.h:201
int iso_set_msgs_severities(char *queue_severity, char *print_severity, char *print_id)
Control queueing and stderr printing of messages from libisofs.
void iso_image_set_app_use(IsoImage *image, const char *app_use_data, int count)
Fill Application Use field of the Primary Volume Descriptor.
int iso_write_opts_set_appended_as_apm(IsoWriteOpts *opts, int apm)
Control whether partitions created by iso_write_opts_set_partition_img() are to be represented in App...
int iso_tree_get_ignore_special(IsoImage *image)
Get current setting for ignore_special.
struct IsoStream_Iface IsoStreamIface
Interface that defines the operations (methods) available for an IsoStream.
Definition libisofs.h:979
IsoFindCondition * iso_new_find_conditions_ctime(time_t time, enum iso_find_comparisons comparison)
Create a new condition that checks the time of last status change.
int iso_zisofs_set_params(struct iso_zisofs_ctrl *params, int flag)
Set the global parameters for zisofs filtering.
int iso_write_opts_set_joliet(IsoWriteOpts *opts, int enable)
Whether to add the non-standard Joliet extension to the image.
int iso_write_opts_set_default_file_mode(IsoWriteOpts *opts, mode_t file_mode)
Set the mode to use on files when you set the replace_mode of files to 2.
const char * iso_node_get_name(const IsoNode *node)
Get the name of a node.
int iso_image_tree_clone(IsoImage *image, IsoNode *node, IsoDir *new_parent, char *new_name, IsoNode **new_node, int flag)
Create a copy of the given node under a different path.
int iso_node_set_attrs(IsoNode *node, size_t num_attrs, char **names, size_t *value_lengths, char **values, int flag)
Set the list of xattr which is associated with the node.
int iso_write_opts_set_allow_deep_paths(IsoWriteOpts *opts, int allow)
Allow ISO-9660 directory hierarchy to be deeper than 8 levels.
int iso_error_get_severity(int e)
Get the severity of a given error code.
void * iso_get_messenger()
Return the messenger object handle used by libisofs.
int iso_image_set_volume_id_v2(IsoImage *image, int fs_type_mask, const char *volume_id)
Fill in the volume identifier for one or more filesystem superblocks in an image.
int iso_node_get_projid(IsoNode *node, uint32_t *projid, int flag)
Obtain the XFS-style project id of the given node.
int iso_read_opts_set_no_md5(IsoReadOpts *opts, int no_md5)
Control reading of an array of MD5 checksums which is possibly stored at the end of a session.
int iso_write_opts_set_replace_mode(IsoWriteOpts *opts, int dir_mode, int file_mode, int uid, int gid)
Whether to set default values for files and directory permissions, gid and uid.
void iso_image_unref(IsoImage *image)
Decrements the reference counting of the given image.
int iso_write_opts_set_output_charset(IsoWriteOpts *opts, const char *charset)
Set the charset to use for the RR names of the files that will be created on the image.
int iso_file_source_readdir(IsoFileSource *src, IsoFileSource **child)
Read a directory.
IsoNodeType
The type of an IsoNode.
Definition libisofs.h:230
@ LIBISO_BOOT
Definition libisofs.h:235
@ LIBISO_DIR
Definition libisofs.h:231
@ LIBISO_FILE
Definition libisofs.h:232
@ LIBISO_SYMLINK
Definition libisofs.h:233
@ LIBISO_SPECIAL
Definition libisofs.h:234
int iso_write_opts_set_dir_rec_mtime(IsoWriteOpts *opts, int allow)
Store as ECMA-119 Directory Record timestamp the mtime of the source node rather than the image creat...
void iso_data_source_unref(IsoDataSource *src)
Decrements the reference counting of the given IsoDataSource, freeing it if refcount reach 0.
int iso_tree_add_new_special(IsoDir *parent, const char *name, mode_t mode, dev_t dev, IsoSpecial **special)
int iso_write_opts_set_iso_level(IsoWriteOpts *opts, int level)
Set the ISO-9960 level to write at.
int el_torito_get_boot_media_type(ElToritoBootImage *bootimg, enum eltorito_boot_media_type *media_type)
Get the boot media type as of parameter "type" of iso_image_set_boot_image() or iso_image_add_boot_im...
struct iso_read_opts IsoReadOpts
Options for image reading or import.
Definition libisofs.h:393
IsoFindCondition * iso_new_find_conditions_gid(gid_t gid)
Create a new condition that checks the node gid.
int iso_write_opts_set_tail_blocks(IsoWriteOpts *opts, uint32_t num_blocks)
Cause a number of blocks with zero bytes to be written after the payload data, but before the possibl...
int iso_dir_get_node(IsoDir *dir, const char *name, IsoNode **node)
int iso_image_add_new_special(IsoImage *image, IsoDir *parent, const char *name, mode_t mode, dev_t dev, IsoSpecial **special)
Add a new special file to the directory tree.
const char * iso_image_fs_get_system_id(IsoImageFilesystem *fs)
Get the system identifier for an existent image.
struct Iso_Dir IsoDir
A directory in the iso tree.
Definition libisofs.h:185
int el_torito_set_id_string(ElToritoBootImage *bootimg, uint8_t id_string[28])
Set the id_string of the Validation Entry or Sector Header Entry which will govern the boot image Sec...
int iso_stream_update_size(IsoStream *stream)
Updates the size of the IsoStream with the current size of the underlying source.
int iso_dir_get_children(const IsoDir *dir, IsoDirIter **iter)
Get an iterator for the children of the given dir.
int iso_image_add_new_file(IsoImage *image, IsoDir *parent, const char *name, IsoStream *stream, IsoFile **file)
Add a new regular file to the iso tree.
off_t iso_file_get_size(IsoFile *file)
Get the size of the file, in bytes.
void iso_data_source_ref(IsoDataSource *src)
Increments the reference counting of the given IsoDataSource.
int iso_tree_add_new_file(IsoDir *parent, const char *name, IsoStream *stream, IsoFile **file)
const char * iso_error_to_msg(int errcode)
Get a textual description of a libisofs error.
int iso_write_opts_set_scdbackup_tag(IsoWriteOpts *opts, char *name, char *timestamp, char *tag_written)
Set the parameters "name" and "timestamp" for a scdbackup checksum tag.
int iso_write_opts_set_rrip_version_1_10(IsoWriteOpts *opts, int oldvers)
Write Rock Ridge info as of specification RRIP-1.10 rather than RRIP-1.12: signature "RRIP_1991A" rat...
int iso_read_image_features_has_eltorito(IsoReadImageFeatures *f)
Whether El-Torito boot record is present present in the image imported.
struct el_torito_boot_image ElToritoBootImage
It represents an El-Torito boot image.
Definition libisofs.h:286
void iso_filesystem_ref(IsoFilesystem *fs)
Take a ref to the given IsoFilesystem.
int iso_read_opts_set_no_iso1999(IsoReadOpts *opts, int noiso1999)
Do not read the tree of an Enhanced Volume Descriptor (aka ISO 9660:1999) as of ECMA-119 4th Edition.
int iso_image_create_burn_source(IsoImage *image, IsoWriteOpts *opts, struct burn_source **burn_src)
Create a burn_source and a thread which immediately begins to generate the image.
int iso_stream_clone(IsoStream *old_stream, IsoStream **new_stream, int flag)
Produce a copy of a stream.
int iso_write_opts_set_appended_as_gpt(IsoWriteOpts *opts, int gpt)
Control whether partitions created by iso_write_opts_set_partition_img() are to be represented in MBR...
uint64_t iso_util_get_effective_lfa_mask(uint64_t change_mask, int flag)
Return the effective change mask which will be used by iso_local_set_lfa_flags() with the same input ...
void iso_file_source_unref(IsoFileSource *src)
Drop your ref to the given IsoFileSource, freeing the associated system resources if not still needed...
struct iso_filesystem IsoFilesystem
Abstract for source filesystems.
Definition libisofs.h:501
unsigned int iso_fs_global_id
See IsoFilesystem->get_id() for info about this.
int iso_node_remove_xinfo(IsoNode *node, iso_node_xinfo_func proc)
Remove the given extended info (defined by the proc function) from the given node.
int iso_image_generator_is_running(IsoImage *image)
Inquire whether the image generator thread is still at work.
int iso_nowtime(time_t *now, int flag)
Inquire and maybe define the time which is considered to be "now" and used for timestamps of freshly ...
int iso_read_image_features_has_rockridge(IsoReadImageFeatures *f)
Whether RockRidge extensions are present in the image imported.
int iso_stream_open(IsoStream *stream)
Opens the given stream.
int iso_image_set_hppa_palo(IsoImage *img, char *cmdline, char *bootloader, char *kernel_32, char *kernel_64, char *ramdisk, int flag)
Define a command line and submit the paths of four mandatory files for production of a HP-PA PALO boo...
int iso_write_opts_set_gpt_with_gaps(IsoWriteOpts *opts, int with_gaps, int with_gaps_no_sort, int with_gaps_no_iso)
Control whether the GPT partition table is allowed to leave some parts of the emerging ISO image unco...
int iso_write_opts_set_hfsp_block_size(IsoWriteOpts *opts, int hfsp_block_size, int apm_block_size)
Set the block size for Apple Partition Map and for HFS+.
int iso_util_decode_md5_tag(char data[2048], int *tag_type, uint32_t *pos, uint32_t *range_start, uint32_t *range_size, uint32_t *next_tag, char md5[16], int flag)
Check a data block whether it is a libisofs checksum tag and if so, obtain its recorded parameters.
int iso_write_opts_set_relaxed_vol_atts(IsoWriteOpts *opts, int allow)
Allow all characters to be part of Volume and Volset identifiers on the Primary Volume Descriptor whi...
int iso_init_with_flag(int flag)
Initialize libisofs.
int iso_file_remove_filter(IsoFile *file, int flag)
Delete the top filter stream from a data file.
int iso_write_opts_set_prep_img(IsoWriteOpts *opts, char *image_path, int flag)
Copy a data file from the local filesystem into the emerging ISO image.
const char * iso_image_get_data_preparer_id(const IsoImage *image)
Get the data preparer of a image.
const char * iso_image_fs_get_copyright_file_id(IsoImageFilesystem *fs)
Get the copyright file identifier for an existent image.
mode_t iso_node_get_mode(const IsoNode *node)
Get the mode of the node, both permissions and file type, as specified in 'man 2 stat'.
int iso_tree_get_follow_symlinks(IsoImage *image)
Get current setting for follow_symlinks.
int iso_write_opts_set_joliet_longer_paths(IsoWriteOpts *opts, int allow)
Allow paths in the Joliet tree to have more than 240 characters.
int iso_tree_add_dir_rec(IsoImage *image, IsoDir *parent, const char *dir)
Add the contents of a dir to a given directory of the iso tree.
int iso_image_report_system_area(IsoImage *image, char ***reply, int *line_count, int flag)
Obtain an array of texts describing the detected properties of the possibly loaded System Area.
int iso_write_opts_set_hfsp_serial_number(IsoWriteOpts *opts, uint8_t serial_number[8])
Supply a serial number for the HFS+ extension of the emerging image.
int iso_node_get_xinfo(IsoNode *node, iso_node_xinfo_func proc, void **data)
Get the given extended info (defined by the proc function) from the given node.
int(* iso_node_xinfo_func)(void *data, int flag)
Class of functions to handle particular extended information.
Definition libisofs.h:5195
const char * iso_image_fs_get_publisher_id(IsoImageFilesystem *fs)
Get the publisher identifier for an existent image.
int iso_file_add_gzip_filter(IsoFile *file, int flag)
Install a gzip or gunzip filter on top of the content stream of a data file.
void iso_image_set_copyright_file_id(IsoImage *image, const char *copyright_file_id)
Fill copyright information for the image.
int iso_node_set_acl_text(IsoNode *node, char *access_text, char *default_text, int flag)
Set the ACLs of the given node to the lists in parameters access_text and default_text or delete them...
int iso_image_get_pvd_times(IsoImage *image, char **creation_time, char **modification_time, char **expiration_time, char **effective_time)
Get the four timestamps from the Primary Volume Descriptor of the imported ISO image.
int iso_image_get_system_area(IsoImage *img, char data[32768], int *options, int flag)
Obtain a copy of the possibly loaded first 32768 bytes of the imported session, the System Area.
int iso_read_opts_set_no_joliet(IsoReadOpts *opts, int nojoliet)
Do not read Joliet extensions.
int iso_image_get_boot_image(IsoImage *image, ElToritoBootImage **boot, IsoFile **imgnode, IsoBoot **catnode)
Get the El-Torito boot catalog and the default boot image of an ISO image.
int iso_file_source_access(IsoFileSource *src)
Check if the process has access to read file contents.
int iso_memory_stream_new(unsigned char *buf, size_t size, IsoStream **stream)
Create an IsoStream object from content which is stored in a dynamically allocated memory buffer.
const char * iso_image_get_system_id(const IsoImage *image)
Get the system id of a image.
void iso_read_image_features_destroy(IsoReadImageFeatures *f)
Destroy an IsoReadImageFeatures object obtained with iso_image_import() or iso_assess_written_feature...
int el_torito_get_full_load(ElToritoBootImage *bootimg)
Inquire the setting of el_torito_set_full_load().
int iso_write_opts_set_default_dir_mode(IsoWriteOpts *opts, mode_t dir_mode)
Set the mode to use on dirs when you set the replace_mode of dirs to 2.
int el_torito_get_load_seg(ElToritoBootImage *bootimg)
Get the load segment value.
int iso_node_xinfo_make_clonable(iso_node_xinfo_func proc, iso_node_xinfo_cloner cloner, int flag)
Associate a iso_node_xinfo_cloner to a particular class of extended information in order to make it c...
int iso_tree_add_exclude(IsoImage *image, const char *path)
Add a excluded path.
void iso_finish()
Finalize libisofs.
void iso_image_set_biblio_file_id(IsoImage *image, const char *biblio_file_id)
Fill biblio information for the image.
struct iso_write_opts IsoWriteOpts
Options for image writing.
Definition libisofs.h:386
int iso_file_add_external_filter(IsoFile *file, IsoExternalFilterCommand *cmd, int flag)
Install an external filter command on top of the content stream of a data file.
void iso_tree_set_ignore_special(IsoImage *image, int skip)
Set whether to skip or not special files.
int iso_write_opts_set_default_gid(IsoWriteOpts *opts, gid_t gid)
Set the gid to use when you set the replace_gid to 2.
int iso_node_take(IsoNode *node)
Removes a child from a directory.
int iso_zisofs_ctrl_susp_z2(int enable)
Enable or disable the production of "Z2" SUSP entries instead of "ZF" entries for zisofs2 compressed ...
void iso_tree_set_replace_mode(IsoImage *image, enum iso_replace_mode mode)
Set the replace mode, that defines the behavior of libisofs when adding a node whit the same name tha...
void iso_filesystem_unref(IsoFilesystem *fs)
Drop your ref to the given IsoFilesystem, evetually freeing associated resources.
int iso_local_set_attrs_errno(char *disk_path, size_t num_attrs, char **names, size_t *value_lengths, char **values, int *errnos, int flag)
Attach a list of xattr and ACLs to the given file in the local filesystem.
int iso_tree_get_ignore_hidden(IsoImage *image)
Get current setting for ignore_hidden.
off_t iso_stream_get_size(IsoStream *stream)
Get the size of a given stream.
int iso_text_to_sev(char *severity_name, int *severity_number)
Convert a severity name into a severity number, which gives the severity rank of the name.
int iso_node_set_projid(IsoNode *node, uint32_t projid, int flag)
Set the Linux-like XFS-style project id of the given node.
void iso_node_set_gid(IsoNode *node, gid_t gid)
Set the group id for the node.
int iso_file_source_close(IsoFileSource *src)
Close a previously opened file.
int iso_node_remove_tree(IsoNode *node, IsoDirIter *boss_iter)
Removes a node by iso_node_remove() or iso_dir_iter_remove().
int el_torito_get_selection_crit(ElToritoBootImage *bootimg, uint8_t crit[20])
Get the Selection Criteria bytes as of el_torito_set_selection_crit().
struct iso_external_filter_command IsoExternalFilterCommand
Definition libisofs.h:8688
int iso_dir_add_node(IsoDir *dir, IsoNode *child, enum iso_replace_mode replace)
Add a new node to a dir.
int iso_write_opts_set_replace_timestamps(IsoWriteOpts *opts, int replace)
0 to use IsoNode timestamps, 1 to use recording time, 2 to use values from timestamp field.
int iso_tree_add_new_dir(IsoDir *parent, const char *name, IsoDir **dir)
int iso_dir_iter_remove(IsoDirIter *iter)
Removes a child from a directory during an iteration and unref() it.
int iso_read_opts_set_default_uid(IsoReadOpts *opts, uid_t uid)
Set default uid for files when RR extensions are not present.
int iso_local_get_acl_text(char *disk_path, char **text, int flag)
Get an ACL of the given file in the local filesystem in long text form.
const char * iso_image_get_copyright_file_id(const IsoImage *image)
Get the copyright information of a image.
int iso_write_opts_set_omit_version_numbers(IsoWriteOpts *opts, int omit)
Omit the version number (";1") at the end of the ISO-9660 identifiers.
const char * iso_image_fs_get_data_preparer_id(IsoImageFilesystem *fs)
Get the data preparer identifier for an existent image.
int iso_local_create_dev(char *disk_path, mode_t st_mode, dev_t dev, int *os_errno, int flag)
Create a device file in the local filesystem.
int iso_file_source_stat(IsoFileSource *src, struct stat *info)
Get information about the file.
int iso_read_opts_set_default_gid(IsoReadOpts *opts, gid_t gid)
Set default gid for files when RR extensions are not present.
int iso_set_abort_severity(char *severity)
Set the minimum error severity that causes a libisofs operation to be aborted as soon as possible.
void iso_image_set_abstract_file_id(IsoImage *image, const char *abstract_file_id)
Fill abstract information for the image.
int iso_write_opts_set_iso1999(IsoWriteOpts *opts, int enable)
Whether to create an additional tree starting at Enhanced Volume Descriptor (aka ISO 9660:1999) as of...
int iso_write_opts_get_data_start(IsoWriteOpts *opts, uint32_t *data_start, int flag)
Inquire the start address of the file data blocks after having used IsoWriteOpts with iso_image_creat...
int iso_write_opts_set_max_ce_entries(IsoWriteOpts *opts, uint32_t num, int flag)
Set the maximum number of SUSP CE entries and thus continuation areas.
void iso_node_set_ctime(IsoNode *node, time_t time)
Set the time of last status change of the file.
int iso_tree_clone(IsoNode *node, IsoDir *new_parent, char *new_name, IsoNode **new_node, int flag)
int iso_stream_get_external_filter(IsoStream *stream, IsoExternalFilterCommand **cmd, int flag)
Obtain the IsoExternalFilterCommand which is associated with the given stream.
iso_replace_mode
Replace mode used when adding a node to a directory.
Definition libisofs.h:352
@ ISO_REPLACE_IF_SAME_TYPE_AND_NEWER
Replace with the new node if it is the same file type and its ctime is newer than the old one.
Definition libisofs.h:370
@ ISO_REPLACE_ALWAYS
Always replace the old node with the new.
Definition libisofs.h:361
@ ISO_REPLACE_IF_NEWER
Replace with the new node if its ctime is newer than the old one.
Definition libisofs.h:374
@ ISO_REPLACE_IF_SAME_TYPE
Replace with the new node if it is the same file type.
Definition libisofs.h:365
@ ISO_REPLACE_NEVER
Never replace an existing node, and instead fail with ISO_NODE_NAME_NOT_UNIQUE.
Definition libisofs.h:357
int iso_write_opts_set_gpt_guid(IsoWriteOpts *opts, uint8_t guid[16], int mode)
Control whether the emerging GPT gets a pseudo-randomly generated disk GUID or whether it gets a user...
int iso_write_opts_set_part_like_isohybrid(IsoWriteOpts *opts, int alike)
Control whether bits 2 to 8 of el_torito_set_isolinux_options() shall apply even if not isohybrid MBR...
int iso_write_opts_set_iso_type_guid(IsoWriteOpts *opts, uint8_t guid[16], int valid)
Set the GPT Type GUID for the partition which represents the ISO 9660 filesystem, if such a partition...
int iso_interval_reader_destroy(struct iso_interval_reader **ivr, int flag)
Dispose an interval reader object.
int iso_write_opts_set_untranslated_name_len(IsoWriteOpts *opts, int len)
Caution: This option breaks any assumptions about names that are supported by ECMA-119 specifications...
int iso_dir_iter_take(IsoDirIter *iter)
Removes a child from a directory during an iteration, without freeing it.
int iso_image_get_hppa_palo(IsoImage *img, char **cmdline, char **bootloader, char **kernel_32, char **kernel_64, char **ramdisk)
Inquire the current settings of iso_image_set_hppa_palo().
int iso_tree_remove_exclude(IsoImage *image, const char *path)
Remove a previously added exclude.
int iso_image_get_session_md5(IsoImage *image, uint32_t *start_lba, uint32_t *end_lba, char md5[16], int flag)
Obtain the recorded MD5 checksum of the session which was loaded as ISO image.
int iso_image_import(IsoImage *image, IsoDataSource *src, IsoReadOpts *opts, IsoReadImageFeatures **features)
Import a previous session or image, for growing or modify.
int iso_write_opts_set_fat(IsoWriteOpts *opts, int enable)
void iso_file_source_ref(IsoFileSource *src)
Take a ref to the given IsoFileSource.
int iso_lib_is_compatible(int major, int minor, int micro)
Check at runtime if the library is ABI compatible with the given version.
void iso_node_set_hidden(IsoNode *node, int hide_attrs)
Set whether the node will be hidden in the directory trees of RR/ISO 9660, or of Joliet (if enabled a...
time_t iso_node_get_atime(const IsoNode *node)
Get the time of last access to the file.
int iso_local_set_acl_text(char *disk_path, char *text, int flag)
Set the ACL of the given file in the local filesystem to a given list in long text form.
void el_torito_set_load_seg(ElToritoBootImage *bootimg, short segment)
Sets the load segment for the initial boot image.
char * iso_get_local_charset(int flag)
Obtain the local charset as currently assumed by libisofs.
int el_torito_set_selection_crit(ElToritoBootImage *bootimg, uint8_t crit[20])
Set the Selection Criteria of a boot image.
const char * iso_image_fs_get_biblio_file_id(IsoImageFilesystem *fs)
Get the biblio file identifier for an existent image.
IsoStream * iso_stream_get_input_stream(IsoStream *stream, int flag)
Obtain the input stream of a filter stream.
int iso_node_set_name(IsoNode *node, const char *name)
int iso_write_opts_set_appendable(IsoWriteOpts *opts, int append)
Set the type of image creation in case there was already an existing image imported.
void iso_node_set_mtime(IsoNode *node, time_t time)
Set the time of last modification of the file.
int iso_ring_buffer_get_status(struct burn_source *b, size_t *size, size_t *free_bytes)
Get the status of the buffer used by a burn_source.
uint32_t iso_crc32_gpt(unsigned char *data, int count, int flag)
Compute a CRC number as expected in the GPT main and backup header blocks.
int iso_zisofs_get_refcounts(off_t *ziso_count, off_t *osiz_count, int flag)
Inquire the number of zisofs compression and uncompression filters which are in use.
struct Iso_Boot IsoBoot
An special type of IsoNode that acts as a placeholder for an El-Torito boot catalog.
Definition libisofs.h:294
int iso_node_get_next_xinfo(IsoNode *node, void **handle, iso_node_xinfo_func *proc, void **data)
Get the next pair of function pointer and data of an iteration of the list of extended information.
char * iso_tree_get_node_path(IsoNode *node)
Get the absolute path on image of the given node.
const char * iso_symlink_get_dest(const IsoSymlink *link)
Get the destination of a node.
struct iso_data_source IsoDataSource
Source for image reading.
Definition libisofs.h:401
int iso_image_get_msg_id(IsoImage *image)
Get the id of an IsoImage, used for message reporting.
int iso_read_image_features_tree_loaded(IsoReadImageFeatures *f)
Tells what directory tree was loaded: 0 = ISO 9660 , 1 = Joliet , 2 = Enhanced Volume Descriptor tree...
int iso_error_get_code(int e)
Get the message queue code of a libisofs error.
IsoFindCondition * iso_new_find_conditions_mtime(time_t time, enum iso_find_comparisons comparison)
Create a new condition that checks the time of last modification.
int iso_write_opts_set_pvd_times(IsoWriteOpts *opts, time_t vol_creation_time, time_t vol_modification_time, time_t vol_expiration_time, time_t vol_effective_time, char *vol_uuid)
Explicitly set the four timestamps of the emerging Primary Volume Descriptor, in the volume descripto...
void iso_image_set_volset_id(IsoImage *image, const char *volset_id)
Fill in the volset identifier for a image.
int iso_stream_get_zisofs_par(IsoStream *stream, int *stream_type, uint8_t zisofs_algo[2], uint8_t *algo_num, int *block_size_log2, int flag)
Obtain the parameters of a zisofs filter stream.
IsoDir * iso_node_get_parent(IsoNode *node)
int iso_read_opts_set_joliet_map(IsoReadOpts *opts, int joliet_map)
How to convert Joliet file names.
int iso_write_opts_attach_jte(IsoWriteOpts *opts, void *libjte_handle)
Associate a libjte environment object to the upcoming write run.
int iso_md5_match(char first_md5[16], char second_md5[16])
Inquire whether two MD5 checksums match.
int iso_write_opts_set_joliet_long_names(IsoWriteOpts *opts, int allow)
Allow leaf names in the Joliet tree to have up to 103 characters.
void iso_image_set_publisher_id(IsoImage *image, const char *publisher_id)
Fill in the publisher for a image.
void iso_util_get_lfa_masks(uint64_t *user_settable, uint64_t *su_settable, uint64_t *non_settable, uint64_t *unknown)
Return the bit patterns of four classes of Linux-like file attribute flags.
int iso_error_get_priority(int e)
Get the priority of a given error.
int iso_read_opts_set_preferjoliet(IsoReadOpts *opts, int preferjoliet)
Whether to prefer Joliet over RR.
int iso_write_opts_set_aaip(IsoWriteOpts *opts, int enable)
Control writing of AAIP information for ACL and xattr.
int iso_init()
Initialize libisofs.
void iso_stream_get_id(IsoStream *stream, unsigned int *fs_id, dev_t *dev_id, ino_t *ino_id)
Get an unique identifier for a given IsoStream.
int iso_util_encode_lfa_flags(uint64_t lfa_flags, char **flags_text, int flag)
Convert the known set bits of the given Linux-like file attribute flags to a string of flag letters l...
time_t iso_node_get_ctime(const IsoNode *node)
Get the time of last status change of the file.
int el_torito_get_id_string(ElToritoBootImage *bootimg, uint8_t id_string[28])
Get the id_string as of el_torito_set_id_string().
int iso_stream_read(IsoStream *stream, void *buf, size_t count)
Attempts to read up to count bytes from the given stream into the buffer starting at buf.
int iso_write_opts_set_relaxed_nonvol_atts(IsoWriteOpts *opts, int allow)
Like iso_write_opts_set_relaxed_vol_atts() but for all other text attributes in the Primary Volume De...
int el_torito_get_isolinux_options(ElToritoBootImage *bootimg, int flag)
Get the options as of el_torito_set_isolinux_options().
void iso_tree_set_report_callback(IsoImage *image, int(*report)(IsoImage *, IsoFileSource *))
Set a callback function that libisofs will call for each file that is added to the given image by a r...
int iso_write_opts_set_aaip_susp_1_10(IsoWriteOpts *opts, int oldvers)
Write AAIP as extension according to SUSP 1.10 rather than SUSP 1.12.
void iso_node_ref(IsoNode *node)
Increments the reference counting of the given node.
int iso_file_get_sort_weight(IsoFile *file)
Get the sort weight of a file.
char * iso_file_source_get_path(IsoFileSource *src)
Get the absolute path in the filesystem this file source belongs to.
int iso_util_decode_lfa_flags(char *flags_text, uint64_t *lfa_flags, int flag)
Convert the given string of flag letters to a bit array usable by iso_*_set_lfa_flags().
int aaip_xinfo_func(void *data, int flag)
Function to identify and manage AAIP strings as xinfo of IsoNode.
int iso_image_set_boot_catalog_weight(IsoImage *image, int sort_weight)
Sets the sort weight of the boot catalog that is attached to an IsoImage.
void el_torito_set_no_bootable(ElToritoBootImage *bootimg)
Marks the specified boot image as not bootable.
int(* iso_node_xinfo_cloner)(void *old_data, void **new_data, int flag)
Class of functions to clone extended information.
Definition libisofs.h:5325
int iso_node_add_xinfo(IsoNode *node, iso_node_xinfo_func proc, void *data)
Add extended information to the given node.
int iso_dir_iter_next(IsoDirIter *iter, IsoNode **node)
Get the next child.
int iso_zisofs_get_params(struct iso_zisofs_ctrl *params, int flag)
Get the current global parameters for zisofs filtering.
int iso_dir_find_children(IsoDir *dir, IsoFindCondition *cond, IsoDirIter **iter)
Find all directory children that match the given condition.
int iso_msgs_submit(int error_code, char msg_text[], int os_errno, char severity[], int origin)
Submit a message to the libisofs queueing system.
int iso_image_get_ignore_aclea(IsoImage *image)
Obtain the current setting of iso_image_set_ignore_aclea().
const char * iso_image_get_volume_id_v2(const IsoImage *image, int fs_type)
Get the current volume identifier of an image for a particular filesystem superblock.
int iso_write_opts_set_hardlinks(IsoWriteOpts *opts, int enable)
Control generation of non-unique inode numbers for the emerging image.
uint32_t iso_read_image_features_get_size(IsoReadImageFeatures *f)
Get the size (in 2048 byte block) of the image, as reported in the PVM.
int iso_read_opts_new(IsoReadOpts **opts, int profile)
Creates an IsoReadOpts for reading an existent image.
int el_torito_seems_boot_info_table(ElToritoBootImage *bootimg, int flag)
Makes a guess whether the boot image was patched by a boot information table.
struct iso_stream IsoStream
Representation of file contents.
Definition libisofs.h:970
int iso_set_local_charset(char *name, int flag)
Override the reply of libc function nl_langinfo(CODESET) which may or may not give the name of the ch...
IsoFindCondition * iso_new_find_conditions_atime(time_t time, enum iso_find_comparisons comparison)
Create a new condition that checks the time of last access.
ino_t serial_id
Serial number to be used when you can't get a valid id for a Stream by other means.
IsoHideNodeFlag
Flag used to hide a file in the RR/ISO or Joliet tree.
Definition libisofs.h:302
@ LIBISO_HIDE_ON_JOLIET
Hide the node in the Joliet tree, if Joliet extension are enabled.
Definition libisofs.h:306
@ LIBISO_HIDE_BUT_WRITE
With IsoNode and IsoBoot: Write data content even if the node is not visible in any tree.
Definition libisofs.h:331
@ LIBISO_HIDE_ON_1999
Hide the node in the tree of an Enhanced Volume Descriptor (aka ISO 9660:1999) as of ECMA-119 4th Edi...
Definition libisofs.h:311
@ LIBISO_HIDE_ON_HFSPLUS
Hide the node in the HFS+ tree, if that format is enabled.
Definition libisofs.h:316
@ LIBISO_HIDE_ON_RR
Hide the node in the ECMA-119 / RR tree.
Definition libisofs.h:304
@ LIBISO_HIDE_ON_FAT
Hide the node in the FAT tree, if that format is enabled.
Definition libisofs.h:321
void * iso_image_get_attached_data(IsoImage *image)
The the data previously attached with iso_image_attach_data()
int iso_image_attach_data(IsoImage *image, void *data, void(*give_up)(void *))
Attach user defined data to the image.
int iso_stream_cmp_ino(IsoStream *s1, IsoStream *s2, int flag)
Compare two streams whether they are based on the same input and will produce the same output.
mode_t iso_node_get_permissions(const IsoNode *node)
Get the permissions for the node.
int iso_write_opts_set_overwrite_buf(IsoWriteOpts *opts, uint8_t *overwrite)
Sets the buffer where to store the descriptors which shall be written at the beginning of an overwrit...
int iso_image_dir_get_node(IsoImage *image, IsoDir *dir, const char *name, IsoNode **node, int flag)
Locate a node inside a given dir.
int iso_local_set_lfa_flags(char *disk_path, uint64_t lfa_flags, int max_bit, uint64_t change_mask, int *os_errno, int flag)
Bring the given Linux-like file attribute flags (chattr) into effect with the given file.
int el_torito_get_bootable(ElToritoBootImage *bootimg)
Get the bootability flag.
void el_torito_patch_isolinux_image(ElToritoBootImage *bootimg)
Deprecated: Specifies that this image needs to be patched.
int iso_tree_add_new_symlink(IsoDir *parent, const char *name, const char *dest, IsoSymlink **link)
const char * iso_image_get_biblio_file_id(const IsoImage *image)
Get the biblio information of a image.
int iso_write_opts_set_record_md5(IsoWriteOpts *opts, int session, int files)
Whether to compute and record MD5 checksums for the whole session and/or for each single IsoFile obje...
const char * iso_image_fs_get_volume_id(IsoImageFilesystem *fs)
Get the volume identifier for an existent image.
int iso_node_get_lfa_flags(IsoNode *node, uint64_t *lfa_flags, int *max_bit, int flag)
Obtain the Linux-like file attribute flags (chattr) as bit array.
int iso_node_remove_all_xinfo(IsoNode *node, int flag)
Remove all extended information from the given node.
int iso_image_get_bootcat(IsoImage *image, IsoBoot **catnode, uint32_t *lba, char **content, off_t *size)
Get detailed information about the boot catalog that was loaded from an ISO image.
const char * iso_image_get_application_id(const IsoImage *image)
Get the application id of a image.
int iso_local_get_attrs(char *disk_path, size_t *num_attrs, char ***names, size_t **value_lengths, char ***values, int flag)
Get xattr, non-trivial ACLs, possible Linux-like file attribute flags (chattr), and XFS-style project...
struct iso_file_source IsoFileSource
POSIX abstraction for source files.
Definition libisofs.h:493
mode_t iso_node_get_perms_wo_acl(const IsoNode *node)
Like iso_node_get_permissions but reflecting ACL entry "group::" in S_IRWXG rather than ACL entry "ma...
const char * iso_image_get_publisher_id(const IsoImage *image)
Get the publisher of a image.
int iso_read_opts_set_no_aaip(IsoReadOpts *opts, int noaaip)
Control reading of AAIP information about ACL and xattr when loading existing images.
void iso_generate_gpt_guid(uint8_t guid[16])
Generate a pseudo-random GUID suitable for iso_write_opts_set_gpt_guid().
int iso_image_hfsplus_bless(IsoImage *img, enum IsoHfsplusBlessings blessing, IsoNode *node, int flag)
Issue a blessing to a particular IsoNode.
int iso_read_image_features_has_joliet(IsoReadImageFeatures *f)
Whether Joliet extensions are present in the image imported.
int iso_tree_resolve_symlink(IsoImage *img, IsoSymlink *sym, IsoNode **res, int *depth, int flag)
Get the destination node of a symbolic link within the IsoImage.
int iso_write_opts_set_max_37_char_filenames(IsoWriteOpts *opts, int allow)
Allow a single file or directory identifier to have up to 37 characters.
const char * iso_image_get_app_use(IsoImage *image)
Get the current setting for the Application Use field of the Primary Volume Descriptor.
int iso_image_filesystem_new(IsoDataSource *src, IsoReadOpts *opts, int msgid, IsoImageFilesystem **fs)
Create a new IsoFilesystem to access a existent ISO image.
int iso_write_opts_set_iso_mbr_part_type(IsoWriteOpts *opts, int part_type)
Set the partition type of the MBR partition which represents the ISO filesystem or at least protects ...
gid_t iso_node_get_gid(const IsoNode *node)
Get the group id of the node.
int iso_tree_path_to_node(IsoImage *image, const char *path, IsoNode **node)
int iso_image_give_up_mips_boot(IsoImage *image, int flag)
Clear the list of MIPS Big Endian boot file paths.
void iso_stream_unref(IsoStream *stream)
Decrement reference count of an IsoStream, and free it if reference count reaches 0.
void iso_node_set_atime(IsoNode *node, time_t time)
Set the time of last access to the file.
int iso_write_opts_set_old_empty(IsoWriteOpts *opts, int enable)
Use this only if you need to reproduce a suboptimal behavior of older versions of libisofs.
void iso_dir_iter_free(IsoDirIter *iter)
Free a dir iterator.
int iso_image_get_alpha_boot(IsoImage *img, char **boot_loader_path)
Inquire the path submitted by iso_image_set_alpha_boot() Do not free() the returned pointer.
IsoFindCondition * iso_new_find_conditions_and(IsoFindCondition *a, IsoFindCondition *b)
Create a new condition that check if the two given conditions are valid.
void iso_image_set_application_id(IsoImage *image, const char *application_id)
Fill in the application id for a image.
enum IsoNodeType iso_node_get_type(IsoNode *node)
Get the type of an IsoNode.
const char * iso_image_fs_get_abstract_file_id(IsoImageFilesystem *fs)
Get the abstract file identifier for an existent image.
int iso_gzip_get_refcounts(off_t *gzip_count, off_t *gunzip_count, int flag)
Inquire the number of gzip compression and uncompression filters which are in use.
int iso_read_opts_set_start_block(IsoReadOpts *opts, uint32_t block)
Set the block where the image begins.
int iso_read_opts_load_system_area(IsoReadOpts *opts, int mode)
Enable or disable loading of the first 32768 bytes of the session.
int iso_tree_add_node(IsoImage *image, IsoDir *parent, const char *path, IsoNode **node)
Add a new node to the image tree, from an existing file.
int iso_md5_start(void **md5_context)
Create a MD5 computation context and hand out an opaque handle.
int el_torito_get_load_size(ElToritoBootImage *bootimg)
Get the load size.
struct Iso_Node IsoNode
Definition libisofs.h:177
int iso_dir_iter_has_next(IsoDirIter *iter)
Check if there're more children.
int iso_file_get_old_image_sections(IsoFile *file, int *section_count, struct iso_file_section **sections, int flag)
Get the start addresses and the sizes of the data extents of a file node if it was imported from an o...
void el_torito_set_full_load(ElToritoBootImage *bootimg, int mode)
State that the load size shall be the size of the boot image automatically.
int iso_write_opts_set_allow_longer_paths(IsoWriteOpts *opts, int allow)
Allow path in the ISO-9660 tree to have more than 255 characters.
int iso_write_opts_set_part_type_guid(IsoWriteOpts *opts, int partition_number, uint8_t guid[16], int valid)
Set the GPT Type GUID for a partition defined by iso_write_opts_set_partition_img().
int iso_write_opts_set_system_area(IsoWriteOpts *opts, char data[32768], int options, int flag)
void iso_image_set_volume_id(IsoImage *image, const char *volume_id)
Fill in the volume identifier for all filesystem superblocks in an image.
int iso_local_set_projid(char *disk_path, uint32_t projid, int *os_errno, int flag)
Bring the given XFS-style project id into effect with the given file.
int iso_node_get_hidden(IsoNode *node)
Get the hide_attrs as possibly set by iso_node_set_hidden().
int iso_node_get_old_image_lba(IsoNode *node, uint32_t *lba, int flag)
int iso_write_opts_set_rrip_1_10_px_ino(IsoWriteOpts *opts, int enable)
Write field PX with file serial number (i.e.
int iso_read_image_features_rr_loaded(IsoReadImageFeatures *f)
Tells whether Rock Ridge information was used while loading the tree: 1= yes, 0= no.
int iso_read_opts_set_new_inos(IsoReadOpts *opts, int new_inos)
Control discarding of inode numbers from existing images.
int iso_file_source_open(IsoFileSource *src)
Opens the source.
int iso_symlink_set_dest(IsoSymlink *link, const char *dest)
Set the destination of a symbolic.
void iso_node_set_uid(IsoNode *node, uid_t uid)
Set the user id for the node.
int iso_node_xinfo_get_cloner(iso_node_xinfo_func proc, iso_node_xinfo_cloner *cloner, int flag)
Inquire the registered cloner function for a particular class of extended information.
int iso_write_opts_set_allow_full_ascii(IsoWriteOpts *opts, int allow)
Allow all 8-bit characters to appear on an ISO-9660 filename.
int iso_data_source_new_from_file(const char *path, IsoDataSource **src)
Create a new IsoDataSource from a local file.
void el_torito_set_load_size(ElToritoBootImage *bootimg, short sectors)
Sets the number of sectors (512b) to be load at load segment during the initial boot procedure.
IsoHfsplusBlessings
HFS+ blessings are relationships between HFS+ enhanced ISO images and particular files in such images...
Definition libisofs.h:9342
@ ISO_HFSPLUS_BLESS_SHOWFOLDER
Definition libisofs.h:9350
@ ISO_HFSPLUS_BLESS_OSX_FOLDER
Definition libisofs.h:9352
@ ISO_HFSPLUS_BLESS_PPC_BOOTDIR
Definition libisofs.h:9344
@ ISO_HFSPLUS_BLESS_MAX
Definition libisofs.h:9355
@ ISO_HFSPLUS_BLESS_INTEL_BOOTFILE
Definition libisofs.h:9347
@ ISO_HFSPLUS_BLESS_OS9_FOLDER
Definition libisofs.h:9351
void iso_image_ref(IsoImage *image)
Increments the reference counting of the given image.
struct IsoFileSource_Iface IsoFileSourceIface
Interface that defines the operations (methods) available for an IsoFileSource.
Definition libisofs.h:510
const char * iso_image_get_abstract_file_id(const IsoImage *image)
Get the abstract information of a image.
void iso_image_set_ignore_aclea(IsoImage *image, int what)
Control whether ACL and xattr will be imported from external filesystems (typically the local POSIX f...
int iso_read_image_feature_named(IsoReadImageFeatures *f, char *name, char **text, int *type, int64_t *num_value, void **pt_value, size_t *pt_size)
Get a named feature as text, num_value, or pt_value depending on its type.
int iso_image_new(const char *name, IsoImage **image)
Create a new image, empty.
int iso_dir_get_children_count(IsoDir *dir)
Get the number of children of a directory.
int iso_file_source_readlink(IsoFileSource *src, char *buf, size_t bufsiz)
Read the destination of a symlink.
int iso_node_remove(IsoNode *node)
Removes a child from a directory and free (unref) it.
IsoFilesystem IsoImageFilesystem
IsoFilesystem implementation to deal with ISO images, and to offer a way to access specific informati...
Definition libisofs.h:519
int iso_stream_close(IsoStream *stream)
Close a previously opened IsoStream.
void iso_image_set_system_id(IsoImage *image, const char *system_id)
Fill in the system id for a image.
void iso_image_remove_boot_image(IsoImage *image)
Removes all El-Torito boot images from the ISO image.
struct Iso_Dir_Iter IsoDirIter
Context for iterate on directory children.
Definition libisofs.h:279
int iso_image_zisofs_discard_bpt(IsoImage *image, int flag)
Discard all buffered zisofs compression block pointers of streams in the given image,...
int iso_file_add_zisofs_filter(IsoFile *file, int flag)
Install a zisofs filter on top of the content stream of a data file.
int iso_write_opts_set_default_timestamp(IsoWriteOpts *opts, time_t timestamp)
Set the timestamp to use when you set the replace_timestamps to 2.
int iso_md5_compute(void *md5_context, char *data, int datalen)
Advance the computation of a MD5 checksum by a chunk of data bytes.
int el_torito_set_isolinux_options(ElToritoBootImage *bootimg, int options, int flag)
Specifies options for ISOLINUX or GRUB boot images.
int iso_hfsplus_xinfo_func(void *data, int flag)
The function that is used to mark struct iso_hfsplus_xinfo_data at IsoNodes and finally disposes such...
IsoDir * iso_image_get_root(const IsoImage *image)
Get the root directory of the image.
IsoFindCondition * iso_new_find_conditions_name(const char *wildcard)
Create a new condition that checks if the node name matches the given wildcard.
int iso_image_hfsplus_get_blessed(IsoImage *img, IsoNode ***blessed_nodes, int *bless_max, int flag)
Get the array of nodes which are currently blessed.
int iso_stream_zisofs_discard_bpt(IsoStream *stream, int flag)
Discard the buffered zisofs compression block pointers of a stream, if the stream is a zisofs compres...
time_t iso_node_get_mtime(const IsoNode *node)
Get the time of last modification of the file.
int iso_image_set_node_name(IsoImage *image, IsoNode *node, const char *name, int flag)
Set the name of a node.
int iso_tree_add_new_node(IsoImage *image, IsoDir *parent, const char *name, const char *path, IsoNode **node)
This is a more versatile form of iso_tree_add_node which allows to set the node name in ISO image alr...
int iso_image_get_mips_boot_files(IsoImage *image, char *paths[15], int flag)
Obtain the number of added MIPS Big Endian boot files and pointers to their paths in the ISO 9660 Roc...
int iso_truncate_leaf_name(int mode, int length, char *name, int flag)
Immediately apply the given truncate mode and length to the given string.
IsoFindCondition * iso_new_find_conditions_uid(uid_t uid)
Create a new condition that checks the node uid.
dev_t iso_special_get_dev(IsoSpecial *special)
Get the device id (major/minor numbers) of the given block or character device file.
int iso_write_opts_detach_jte(IsoWriteOpts *opts, void **libjte_handle)
Remove association to a libjte environment handle.
iso_find_comparisons
Possible comparison between IsoNode and given conditions.
Definition libisofs.h:5911
@ ISO_FIND_COND_LESS
Definition libisofs.h:5915
@ ISO_FIND_COND_EQUAL
Definition libisofs.h:5914
@ ISO_FIND_COND_LESS_OR_EQUAL
Definition libisofs.h:5916
@ ISO_FIND_COND_GREATER_OR_EQUAL
Definition libisofs.h:5913
@ ISO_FIND_COND_GREATER
Definition libisofs.h:5912
int iso_read_opts_set_default_permissions(IsoReadOpts *opts, mode_t file_perm, mode_t dir_perm)
Set default permissions for files when RR extensions are not present.
int iso_write_opts_set_partition_img(IsoWriteOpts *opts, int partition_number, uint8_t partition_type, char *image_path, int flag)
Cause an arbitrary data file to be appended to the ISO image and to be described by a partition table...
int iso_image_was_blind_attrs(IsoImage *image, int flag)
Inquire whether some local filesystem xattr namespace could not be explored during node building....
char * iso_file_source_get_name(IsoFileSource *src)
Get the name of the file, with the dir component of the path.
int iso_read_image_features_has_iso1999(IsoReadImageFeatures *f)
Whether the image is recorded with an Enhanced Volume Descriptor (aka ISO 9660:1999) as of ECMA-119 4...
struct Iso_Special IsoSpecial
An special file in the iso tree.
Definition libisofs.h:211
int iso_write_opts_set_rr_reloc(IsoWriteOpts *opts, char *name, int flags)
This call describes the directory where to store Rock Ridge relocated directories.
int iso_read_opts_set_ecma119_map(IsoReadOpts *opts, int ecma119_map)
How to convert file names if neither Rock Ridge nor Joliet names are present and acceptable.
int iso_image_set_truncate_mode(IsoImage *img, int mode, int length)
Set the name truncation mode and the maximum name length for nodes from image importing,...
void iso_image_set_data_preparer_id(IsoImage *image, const char *data_preparer_id)
Fill in the data preparer for a image.
void iso_read_opts_free(IsoReadOpts *opts)
Free an IsoReadOpts previously allocated with iso_read_opts_new().
int iso_write_opts_set_allow_7bit_ascii(IsoWriteOpts *opts, int allow)
If not iso_write_opts_set_allow_full_ascii() is set to 1: Allow all 7-bit characters that would be al...
int iso_node_set_lfa_flags(IsoNode *node, uint64_t lfa_flags, int flag)
Set the Linux-like file attribute flags (chattr) which are associated with the node.
int iso_obtain_msgs(char *minimum_severity, int *error_code, int *imgid, char msg_text[], char severity[])
Obtain the oldest pending libisofs message from the queue which has at least the given minimum_severi...
const char * iso_image_fs_get_volset_id(IsoImageFilesystem *fs)
Get the volset identifier for an existent image.
int iso_local_get_lfa_flags(char *disk_path, uint64_t *lfa_flags, int *max_bit, int *os_errno, int flag)
Obtain the Linux-like file attribute flags (chattr) of the given file as bit array.
void iso_write_opts_free(IsoWriteOpts *opts)
Free an IsoWriteOpts previously allocated with iso_write_opts_new().
int iso_write_opts_set_allow_lowercase(IsoWriteOpts *opts, int allow)
Allow lowercase characters in ISO-9660 filenames.
const char * iso_image_get_volset_id(const IsoImage *image)
Get the volset identifier.
int iso_node_get_acl_text(IsoNode *node, char **access_text, char **default_text, int flag)
Get the ACLs which are associated with the node.
int iso_write_opts_set_will_cancel(IsoWriteOpts *opts, int will_cancel)
Announce that only the image size is desired, that the struct burn_source which is set to consume the...
void iso_stream_ref(IsoStream *stream)
Increment reference count of an IsoStream.
char * iso_stream_get_source_path(IsoStream *stream, int flag)
Try to get the source path string of a stream.
int iso_file_make_md5(IsoFile *file, int flag)
Read the content of an IsoFile object, compute its MD5 and attach it to the IsoFile.
int iso_node_cmp_ino(IsoNode *n1, IsoNode *n2, int flag)
Compare two nodes whether they are based on the same input and can be considered as hardlinks to the ...
struct iso_hfsplus_xinfo_data * iso_hfsplus_xinfo_new(int flag)
Create an instance of struct iso_hfsplus_xinfo_new().
int iso_image_set_alpha_boot(IsoImage *img, char *boot_loader_path, int flag)
Submit the path of the DEC Alpha Secondary Bootstrap Loader file.
struct Iso_Image IsoImage
Context for image creation.
Definition libisofs.h:166
void iso_node_set_sort_weight(IsoNode *node, int w)
Sets the order in which a node will be written on image.
int iso_stream_is_repeatable(IsoStream *stream)
Whether the given IsoStream can be read several times, with the same results.
int iso_write_opts_set_ms_block(IsoWriteOpts *opts, uint32_t ms_block)
Set the start block of the image.
int iso_read_opts_keep_import_src(IsoReadOpts *opts, int mode)
Control whether to keep a reference to the IsoDataSource object which allows access to the blocks of ...
int iso_tree_add_new_cut_out_node(IsoImage *image, IsoDir *parent, const char *name, const char *path, off_t offset, off_t size, IsoNode **node)
Add a new node to the image tree with the given name that must not exist on dir.
int iso_read_image_features_text(IsoReadImageFeatures *f, int with_values, char **feature_text)
Get all validly assessed named features as one single 0-terminated string consisting of single lines ...
struct iso_find_condition IsoFindCondition
Definition libisofs.h:5849
int iso_write_opts_set_rockridge(IsoWriteOpts *opts, int enable)
Whether to use or not Rock Ridge extensions.
int iso_read_opts_set_input_charset(IsoReadOpts *opts, const char *charset)
Set the input charset of the file names on the image.
int iso_write_opts_set_rrip_tf_long(IsoWriteOpts *opts, int enable)
Force writing of RRIP field TF with LONG FORM timestamps of 17 bytes instead of 7-byte timestamps.
uid_t iso_node_get_uid(const IsoNode *node)
Get the user id of the node.
int iso_image_get_sparc_core(IsoImage *img, IsoFile **sparc_core, int flag)
Obtain the current setting of iso_image_set_sparc_core().
IsoStream * iso_file_get_stream(IsoFile *file)
Get the IsoStream that represents the contents of the given IsoFile.
int iso_write_opts_set_sort_files(IsoWriteOpts *opts, int sort)
Whether to sort files based on their weight.
Interface definition for an IsoFileSource.
Definition libisofs.h:639
void(* free)(IsoFileSource *src)
Free implementation specific data.
Definition libisofs.h:828
int(* access)(IsoFileSource *src)
Check if the process has access to read file contents.
Definition libisofs.h:718
int(* close)(IsoFileSource *src)
Close a previously opened file.
Definition libisofs.h:742
int(* stat)(IsoFileSource *src, struct stat *info)
Get information about the file.
Definition libisofs.h:697
int(* open)(IsoFileSource *src)
Opens the source.
Definition libisofs.h:732
off_t(* lseek)(IsoFileSource *src, off_t offset, int flag)
Repositions the offset of the IsoFileSource (must be opened) to the given offset according to the val...
Definition libisofs.h:848
int(* get_aa_string)(IsoFileSource *src, unsigned char **aa_string, int flag)
Valid only if .version is > 0.
Definition libisofs.h:894
int(* read)(IsoFileSource *src, void *buf, size_t count)
Attempts to read up to count bytes from the given source into the buffer starting at buf.
Definition libisofs.h:764
int(* readlink)(IsoFileSource *src, char *buf, size_t bufsiz)
Read the destination of a symlink.
Definition libisofs.h:813
int version
Tells the version of the interface: Version 0 provides functions up to (*lseek)().
Definition libisofs.h:649
int(* readdir)(IsoFileSource *src, IsoFileSource **child)
Read a directory.
Definition libisofs.h:789
int(* lstat)(IsoFileSource *src, struct stat *info)
Get information about the file.
Definition libisofs.h:681
int(* clone_src)(IsoFileSource *old_src, IsoFileSource **new_src, int flag)
Produce a copy of a source.
Definition libisofs.h:912
Interface definition for IsoStream methods.
Definition libisofs.h:1001
void(* get_id)(IsoStream *stream, unsigned int *fs_id, dev_t *dev_id, ino_t *ino_id)
Get an unique identifier for the IsoStream.
Definition libisofs.h:1087
int(* cmp_ino)(IsoStream *s1, IsoStream *s2)
Compare two streams whether they are based on the same input and will produce the same output.
Definition libisofs.h:1167
int(* clone_stream)(IsoStream *old_stream, IsoStream **new_stream, int flag)
Produce a copy of a stream.
Definition libisofs.h:1186
char type[4]
Type of Stream.
Definition libisofs.h:1032
int(* is_repeatable)(IsoStream *stream)
Tell whether this IsoStream can be read several times, with the same results.
Definition libisofs.h:1082
off_t(* get_size)(IsoStream *stream)
Get the size (in bytes) of the stream.
Definition libisofs.h:1055
int(* update_size)(IsoStream *stream)
Update the size of the IsoStream with the current size of the underlying source, if the source is pro...
Definition libisofs.h:1111
int(* close)(IsoStream *stream)
Close the Stream.
Definition libisofs.h:1048
void(* free)(IsoStream *stream)
Free implementation specific data.
Definition libisofs.h:1094
int(* open)(IsoStream *stream)
Opens the stream.
Definition libisofs.h:1041
int(* read)(IsoStream *stream, void *buf, size_t count)
Attempt to read up to count bytes from the given stream into the buffer starting at buf.
Definition libisofs.h:1071
Data source used by libisofs for reading an existing image.
Definition libisofs.h:418
int(* close)(IsoDataSource *src)
Close a given source, freeing all system resources previously grabbed in open().
Definition libisofs.h:447
int(* open)(IsoDataSource *src)
Opens the given source.
Definition libisofs.h:438
int(* read_block)(IsoDataSource *src, uint32_t lba, uint8_t *buffer)
Read an arbitrary block (2048 bytes) of data from the source.
Definition libisofs.h:464
unsigned int refcount
Reference count for the data source.
Definition libisofs.h:428
void * data
Source specific data.
Definition libisofs.h:474
void(* free_data)(IsoDataSource *src)
Clean up the source specific data.
Definition libisofs.h:471
Representation of an external program that shall serve as filter for an IsoStream.
Definition libisofs.h:8638
File section in an imported or emerging image.
Definition libisofs.h:259
uint32_t size
Definition libisofs.h:261
uint32_t block
Definition libisofs.h:260
An IsoFile Source is a POSIX abstraction of a file.
Definition libisofs.h:930
An IsoFilesystem is a handler for a source of files, or a "filesystem".
Definition libisofs.h:547
unsigned int(* get_id)(IsoFilesystem *fs)
Get filesystem identifier.
Definition libisofs.h:598
int(* open)(IsoFilesystem *fs)
Opens the filesystem for several read operations.
Definition libisofs.h:610
unsigned int refcount
Definition libisofs.h:628
int(* get_root)(IsoFilesystem *fs, IsoFileSource **root)
Get the root of a filesystem.
Definition libisofs.h:564
int(* get_by_path)(IsoFilesystem *fs, const char *path, IsoFileSource **file)
Retrieve a file from its absolute path inside the filesystem.
Definition libisofs.h:582
int(* close)(IsoFilesystem *fs)
Close the filesystem, thus freeing all system resources.
Definition libisofs.h:619
void(* free)(IsoFilesystem *fs)
Free implementation specific data.
Definition libisofs.h:625
char type[4]
Type of filesystem.
Definition libisofs.h:553
HFS+ attributes which may be attached to IsoNode objects as data parameter of iso_node_add_xinfo().
Definition libisofs.h:9296
uint8_t creator_code[4]
Definition libisofs.h:9305
Representation of file contents as a stream of bytes.
Definition libisofs.h:1200
void * data
Definition libisofs.h:1203
Parameter set for iso_zisofs_set_params().
Definition libisofs.h:8839
uint64_t max_total_blocks
Definition libisofs.h:8886
uint64_t current_total_blocks
Definition libisofs.h:8892
uint8_t v2_block_size_log2
Definition libisofs.h:8880
int64_t bpt_discard_file_blocks
Definition libisofs.h:8925
double bpt_discard_free_ratio
Definition libisofs.h:8937
uint64_t max_file_blocks
Definition libisofs.h:8898
int64_t block_number_target
Definition libisofs.h:8913
uint8_t block_size_log2
Definition libisofs.h:8859

Generated for libisofs by  doxygen 1.14.0