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