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

Generated for libisofs by  doxygen 1.8.17