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