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