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

Generated for libisofs by  doxygen 1.8.10