"Fossies" - the Fresh Open Source Software Archive

Member "xorriso-1.5.4/libisoburn/isoburn.h" (30 Jan 2021, 29365 Bytes) of package /linux/misc/xorriso-1.5.4.pl02.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "isoburn.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 1.5.2_vs_1.5.4.

    1 
    2 /*
    3   Class struct of libisoburn.
    4 
    5   Copyright 2007 - 2009 Vreixo Formoso Lopes <metalpain2002@yahoo.es>
    6   Copyright 2007 - 2020 Thomas Schmitt <scdbackup@gmx.net>
    7 
    8   Provided under GPL version 2 or later.
    9 */
   10 
   11 #ifndef Isoburn_includeD
   12 #define Isoburn_includeD
   13 
   14 
   15 /* for uint8_t */
   16 #ifdef HAVE_STDINT_H
   17 #include <stdint.h>
   18 #else
   19 #ifdef HAVE_INTTYPES_H
   20 #include <inttypes.h>
   21 #endif
   22 #endif
   23 
   24 /* For emulated TOC of overwritable media.
   25    Provides minimal info for faking a struct burn_toc_entry.
   26 */
   27 struct isoburn_toc_entry {
   28  int session;
   29  int track_no; /* point */
   30  int start_lba;
   31  int track_blocks;
   32  char *volid; /* For caching a volume id from emulated toc on overwritables */
   33 
   34  struct isoburn_toc_entry *next;
   35 };
   36 
   37 int isoburn_toc_entry_new(struct isoburn_toc_entry **objpt,
   38                           struct isoburn_toc_entry *boss, int flag);
   39 
   40 /* @param flag bit0= delete all subordinates too
   41 */
   42 int isoburn_toc_entry_destroy(struct isoburn_toc_entry **o, int flag);
   43 
   44 
   45 /* Minimal size of target_iso_head which is to be written during
   46    isoburn_activate_session().
   47    Within this size there is everything that is needed for image access with
   48    no partition offset. The actual target_iso_head buffer must be larger by
   49    the evential partition offset.
   50 */
   51 #define Libisoburn_target_head_sizE (32*2048)
   52 
   53 
   54 /* Maximum number of appended partitions. Effectively usable number depends
   55    on system area type.
   56 */
   57 #define Libisoburn_max_appended_partitionS 8
   58 
   59 /*
   60   Maximum length of a disc label text plus 1.
   61 */
   62 #define Libisoburn_disc_label_sizE 129
   63 
   64 
   65 struct isoburn {
   66 
   67 
   68  /* The libburn drive to which this isoburn object is related
   69     Most isoburn calls will use a burn_drive as object handle */
   70  struct burn_drive *drive;
   71 
   72  /* -1= inappropriate medium state detected
   73     0= libburn multi-session medium, resp. undecided yet
   74     1= random access medium */
   75  int emulation_mode;
   76 
   77  /* Although rarely used, libburn can operate on several
   78     drives simultaneously. */
   79  struct isoburn *prev;
   80  struct isoburn *next;
   81 
   82 
   83  /* If >= 0, this address is used as reply for isoburn_disc_get_msc1()
   84  */
   85  int fabricated_msc1;
   86 
   87  /* If >= 0, this address is used in isoburn_disc_track_lba_nwa()
   88     as reply parameter nwa.
   89     (The other nwa parameters below apply only to the effective write address
   90      on random access media. msc2 is handed to libisofs but not to libburn.)
   91  */
   92  int fabricated_msc2;
   93  
   94 
   95  /* The nwa to be used for a first session on the present kind of overwritable
   96     media (usually Libisoburn_overwriteable_starT, but might be forced to 0)
   97  */
   98  int zero_nwa;
   99 
  100  /* Start address as given by image examination (bytes, not blocks) */
  101  off_t min_start_byte;
  102 
  103  /* Aligned start address to be used for processing (counted in blocks) */
  104  int nwa;
  105 
  106 
  107  /* Truncate to .nwa an eventual regular file serving as output drive */
  108  int truncate;
  109 
  110  /* Eventual freely fabricated isoburn_disc_get_status().
  111     BURN_DISC_UNREADY means that this variable is disabled
  112     and normally emulated status is in effect.
  113  */
  114  enum burn_disc_status fabricated_disc_status;
  115 
  116  /* To be set if read errors occurred during media evaluation.
  117  */
  118  int media_read_error;
  119 
  120  /* Eventual emulated table of content read from the chain of ISO headers
  121     on overwritable media.
  122  */ 
  123  struct isoburn_toc_entry *toc;
  124 
  125  /* Indicator whether the most recent burn run worked :
  126     -1 = undetermined, ask libburn , 0 = failure , 1 = success
  127     To be inquired by isoburn_drive_wrote_well()
  128  */
  129  int wrote_well;
  130 
  131  
  132  /* ISO head buffer to be filled by write run */
  133  int target_iso_head_size;
  134  uint8_t *target_iso_head;
  135 
  136  /* The 2k offset which was read from a loaded image.
  137  */
  138  uint32_t loaded_partition_offset;
  139  
  140 
  141  /* Libisofs image context */
  142  IsoImage *image;
  143 
  144  /* The start LBA of the image */
  145  int image_start_lba;
  146 
  147  /* The block data source from which the existing image is read.
  148  */
  149  IsoDataSource *iso_data_source;
  150 
  151  /* The burn source which transfers data from libisofs to libburn.
  152     It has its own fifo.
  153  */
  154  struct burn_source *iso_source;
  155 
  156  /* For iso_tree_set_report_callback() */
  157  int (*read_pacifier)(IsoImage*, IsoFileSource*);
  158 
  159  /* For iso_image_attach_data() */
  160  void *read_pacifier_handle;
  161 
  162  /* An application provided method to immediately deliver messages */
  163  int (*msgs_submit)(void *handle, int error_code, char msg_text[],
  164                     int os_errno, char severity[], int flag);
  165  void *msgs_submit_handle;  /* specific to application method */
  166  int msgs_submit_flag;      /* specific to application method */
  167 
  168  /* Forwarding an image generation option to the burn wrapper */
  169  int do_tao;
  170 
  171  /* Forwarding an image generation option to the burn wrapper */
  172  int do_fsync;
  173  
  174 };
  175 
  176 
  177 /* Creation and disposal function */
  178 int isoburn_new(struct isoburn **objpt, int flag);
  179 int isoburn_destroy(struct isoburn **objpt, int flag);
  180 
  181 /* Eventual readers for public attributes */
  182 /* ( put into separate .h file then ) */
  183 int isoburn_get_emulation_mode(struct isoburn *o, int *pt, int flag);
  184 int isoburn_get_target_volset(struct isoburn *o, IsoImage **pt, int flag);
  185 
  186 /* List management */
  187 int isoburn_get_prev(struct isoburn *o, struct isoburn **pt, int flag);
  188 int isoburn_get_next(struct isoburn *o, struct isoburn **pt, int flag);
  189 int isoburn_destroy_all(struct isoburn **objpt, int flag);
  190 int isoburn_link(struct isoburn *o, struct isoburn *link, int flag);
  191 int isoburn_count(struct isoburn *o, int flag);
  192 int isoburn_by_idx(struct isoburn *o, int idx, struct isoburn **pt, int flag);
  193 int isoburn_find_by_drive(struct isoburn **pt, struct burn_drive *d, int flag);
  194 
  195 
  196 /* Non API inner interfaces */
  197 
  198 /* Submit a libisofs error to the libburn messenger. An application message
  199    reader shall recognize the error code range and attribute it to the
  200    libisofs message channel to which one cannot submit via API.
  201    @param iso_error_code   return value <= 0 from a libisofs API call.
  202    @param default_msg_text is to be put out if iso_error_code leads to no
  203                            error message
  204    @param os_errno         operating system errno, submit 0 if none is known
  205    @param min_severity     minimum severity, might be be increased if libisofs
  206                            error severity surpasses min_severity.
  207    @param flag             Bitfield, submit 0 for now
  208 */
  209 int isoburn_report_iso_error(int iso_error_code, char default_msg_text[],
  210                              int os_errno, char min_severity[], int flag);
  211 
  212 /* Calls from burn_wrap.c into isofs_wrap.c */ 
  213 
  214 int isoburn_start_emulation(struct isoburn *o, int flag);
  215 int isoburn_invalidate_iso(struct isoburn *o, int flag);
  216 
  217 
  218 /* Calls from isofs_wrap.c into burn_wrap.c */
  219 
  220 /** Get an eventual isoburn object which is wrapped around the drive.
  221     @param pt    Eventually returns a pointer to the found object.
  222                  It is allowed to become NULL if return value is -1 or 0.
  223                  In this case, the drive is a genuine libburn drive
  224                  with no emulation activated by isoburn.
  225     @param drive The drive to be searched for
  226     @param flag  unused yet
  227     @return -1 unsuitable medium, 0 generic medium, 1 emulated medium.
  228 */
  229 int isoburn_find_emulator(struct isoburn **pt,
  230                           struct burn_drive *drive, int flag);
  231 
  232 /* Deliver an event message. Either via a non-NULL o->msgs_submit() method 
  233    or via burn_msgs_submit() of libburn.
  234 */
  235 int isoburn_msgs_submit(struct isoburn *o, int error_code, char msg_text[], 
  236                         int os_errno, char severity[], int flag);
  237 
  238 /** Set the start address for an emulated add-on session. The value will
  239     be rounded up to the alignment necessary for the medium. The aligned
  240     value will be divided by 2048 and then put into  o->nwa .
  241     @param o     The isoburn object to be programmed.
  242     @param value The start address in bytes
  243     @param flag  unused yet
  244     @return <=0 is failure , >0 success
  245 */
  246 int isoburn_set_start_byte(struct isoburn *o, off_t value, int flag);
  247 
  248 /** Obtains the image address offset to be used with image generation.
  249     This is either the (emulated) drive nwa or a value set by
  250     isoburn_prepare_blind_grow().
  251     In any case this is the address to tell to iso_write_opts_set_ms_block().
  252     @param o     The isoburn object to be inquired
  253     @param opts  If not NULL: write parameters to be set on drive before query
  254     @param msc2  The value to be used with iso_write_opts_set_ms_block()
  255     @param flag  unused yet
  256     @return <=0 is failure , >0 success
  257 */
  258 int isoburn_get_msc2(struct isoburn *o,
  259                      struct burn_write_opts *opts, int *msc2, int flag);
  260 
  261 /** Get a data source suitable for read from a drive using burn_read_data()
  262     function.
  263     @param d drive to read from. Must be grabbed.
  264     @param displacement will be added or subtracted to any block address
  265     @param displacement_sign  +1 = add , -1= subtract , else keep unaltered
  266     @return the data source, NULL on error. Must be freed with libisofs
  267             iso_data_source_unref() function. Note: this doesn't release
  268             the drive.
  269 */
  270 IsoDataSource *
  271 isoburn_data_source_new(struct burn_drive *d,
  272                          uint32_t displacement, int displacement_sign,
  273                          int cache_tiles, int tile_blocks);
  274 
  275 /** Default settings for above cache_tiles, tile_blocks in newly created
  276     struct isoburn_read_opts.
  277 */
  278 #define Libisoburn_default_cache_tileS 32
  279 #define Libisoburn_default_tile_blockS 32
  280 
  281 /** Maximum size of the cache in 2 kB blocks (1 GB)
  282 */
  283 #define Libisoburn_cache_max_sizE (1024 * 512)
  284 
  285 
  286 /** Disable read capabilities of a data source which was originally created
  287     by isoburn_data_source_new(). After this any attempt to read will yield
  288     a FATAL programming error event.
  289     This is usually done to allow libburn to release the drive while libisofs
  290     still holds a reference to the data source object. libisofs is not supposed
  291     to use this object for reading any more, nevertheless. The disabled state
  292     of the data source is a safety fence around this daring situation.
  293     @param src The data source to be disabled
  294     @param flag  unused yet
  295     @return <=0 is failure , >0 success
  296 */
  297 int isoburn_data_source_shutdown(IsoDataSource *src, int flag);
  298 
  299 
  300 /** Check whether the size of target_iso_head matches the given partition
  301     offset. Eventually adjust size.
  302 */
  303 int isoburn_adjust_target_iso_head(struct isoburn *o,
  304                                    uint32_t offst, int flag);
  305 
  306 
  307 /** Initialize the root directory attributes of a freshly created image.
  308 */
  309 int isoburn_root_defaults(IsoImage *image, int flag);
  310 
  311 
  312 /**
  313  * Options for image reading.
  314    (Comments here may be outdated. API getter/setter function descriptions
  315     may override the descriptions here. Any difference is supposed to be a
  316     minor correction only.)
  317  */
  318 struct isoburn_read_opts {
  319     int cache_tiles; /* number of cache tiles */
  320     int cache_tile_blocks;
  321 
  322     unsigned int norock:1; /*< Do not read Rock Ridge extensions */
  323     unsigned int nojoliet:1; /*< Do not read Joliet extensions */
  324     unsigned int noiso1999:1; /*< Do not read ISO 9660:1999 enhanced tree */
  325 
  326     unsigned int do_ecma119_map:1; /* call iso_read_opts_set_ecma119_map() */
  327     unsigned int map_mode:2;       /* argument for do_ecma119_map */
  328 
  329     unsigned int do_joliet_map:1;   /* call iso_read_opts_set_joliet_map() */
  330     unsigned int joliet_map_mode:1; /* for iso_read_opts_set_joliet_map */ 
  331 
  332     /* ts A90121 */
  333     unsigned int noaaip:1;   /* Do not read AAIP for ACL and EA */
  334     unsigned int noacl:1;    /* Do not read ACL from external file objects */
  335     unsigned int noea:1;     /* Do not read XFS-style EA from externals */
  336 
  337     /* ts A90508 */
  338     unsigned int noino:1;    /* Discard eventual PX inode numbers */
  339 
  340     /* ts A90810 */
  341     unsigned int nomd5:2;    /* Do not read eventual MD5 array */
  342 
  343     unsigned int preferjoliet:1; 
  344                 /*< When both Joliet and RR extensions are present, the RR
  345                  *  tree is used. If you prefer using Joliet, set this to 1. */
  346     uid_t uid; /**< Default uid when no RR */
  347     gid_t gid; /**< Default uid when no RR */
  348     mode_t mode; /**< Default mode when no RR (only permissions) */
  349     mode_t dirmode; /**< Default mode for directories 
  350                          when no RR (only permissions) */
  351 
  352     /**
  353      * Input charset for RR file names. NULL to use default locale charset.
  354      */
  355     char *input_charset;
  356 
  357     /**
  358      * Enable or disable methods to automatically choose an input charset.
  359      * This eventually overrides input_charset.
  360      *
  361      * bit0= set the input character set automatically from
  362      *       attribute "isofs.cs" of root directory
  363      */
  364     int auto_input_charset;
  365 
  366     /**
  367      * What to do in case of name longer than truncate_length:
  368      *  0= throw FAILURE
  369      *  1= truncate to truncate_length with MD5 of whole name at end
  370      */
  371     int truncate_mode;
  372     int truncate_length;
  373 
  374     /* modified by the function isoburn_read_image */
  375     unsigned int hasRR:1; /*< It will be set to 1 if RR extensions are present,
  376                              to 0 if not. */
  377     unsigned int hasJoliet:1; /*< It will be set to 1 if Joliet extensions are 
  378                                   present, to 0 if not. */
  379 
  380     /**
  381      * It will be set to 1 if the image is an ISO 9660:1999, i.e. it has
  382      * a version 2 Enhanced Volume Descriptor.
  383      */
  384     unsigned int hasIso1999:1;
  385 
  386     /** It will be set to 1 if El-Torito boot record is present, to 0 if not.*/
  387     unsigned int hasElTorito:1;
  388 
  389     uint32_t size; /**< Will be filled with the size (in 2048 byte block) of 
  390                     *   the image, as reported in the PVM. */
  391 
  392     int tree_loaded; /* from iso_read_image_features_tree_loaded() */
  393     int rr_loaded;   /* from iso_read_image_features_rr_loaded */
  394 
  395 
  396     unsigned int pretend_blank:1; /* always create empty image */
  397 
  398     uint32_t displacement;
  399     int displacement_sign;
  400 };
  401 
  402 
  403 /**
  404  * Options for image generation by libisofs and image transport to libburn.
  405    (Comments here may be outdated. API getter/setter function descriptions
  406     may override the descriptions here. Any difference is supposed to be a
  407     minor correction only.)
  408  */
  409 struct isoburn_imgen_opts {
  410 
  411     /* Options for image generation */
  412 
  413     int will_cancel :1;
  414 
  415     int level;  /**< ISO level to write at. */
  416     
  417     /** Which extensions to support. */
  418     unsigned int rockridge :1;
  419     unsigned int joliet :1;
  420     unsigned int iso1999 :1;
  421     unsigned int hfsplus :1;
  422     unsigned int fat :1;
  423 
  424     /* Whether to mark suitable IsoNode as hardlinks in RRIP PX */
  425     unsigned int hardlinks :1;
  426 
  427     /* Write eventual AAIP info containing ACL and EA */
  428     unsigned int aaip :1;
  429 
  430     /* Produce and write a MD5 checksum of the whole session stream. */
  431     unsigned int session_md5 :1;
  432 
  433     /* Produce and write MD5 checksums for each single IsoFile.
  434        See parameter "files" of iso_write_opts_set_record_md5().
  435      */
  436     unsigned int file_md5 :2;
  437 
  438     /* On overwritable media or random access files do not write the first
  439        session to LBA 32, but rather to LBA 0 directly.
  440      */
  441     unsigned int no_emul_toc :1;
  442 
  443     /* For empty files, symbolic links, and devices use the old ECMA-119 block
  444        addresses in the range [0,31] rather than the address of the dedicated
  445        empty block.
  446     */
  447     unsigned int old_empty :1;
  448 
  449 
  450     /* relaxed constraints */
  451 
  452     /*
  453      * Relaxed constraints. Setting any of these to 1 break the specifications,
  454      * but it is supposed to work on most moderns systems. Use with caution.
  455      */
  456 
  457     /*
  458      * Extra Caution: This option breaks any assumptions about names that
  459      *                are supported by ECMA-119 specifications.
  460      * Omit any translation which would make a file name compliant to the
  461      * ECMA-119 rules. This includes and exceeds omit_version_numbers,
  462      * max_37_char_filenames, no_force_dots bit0, allow_lowercase.
  463      */
  464     unsigned int untranslated_name_len;
  465 
  466     /*
  467      * Convert directory names for ECMA-119 similar to other file names, but do
  468      * not force a dot or add a version number.
  469      * This violates ECMA-119 by allowing one "." and especially ISO level 1
  470      * by allowing DOS style 8.3 names rather than only 8 characters.
  471      * (mkisofs and its clones seem to do this violation.)
  472      */
  473     unsigned int allow_dir_id_ext :1;
  474 
  475     /**
  476      * Omit the version number (";1") at the end of the ISO-9660 identifiers.
  477      * Version numbers are usually not used.
  478      *      bit0= omit version number with ECMA-119 and Joliet
  479      *      bit1= omit version number with Joliet alone
  480      */
  481     unsigned int omit_version_numbers :2;
  482 
  483     /**
  484      * Allow ISO-9660 directory hierarchy to be deeper than 8 levels.
  485      */
  486     unsigned int allow_deep_paths :1;
  487 
  488     /**
  489      * If not allow_deep_paths is in effect, then it may become
  490      * necessary to relocate directories so that no ECMA-119 file path
  491      * has more than 8 components. These directories are grafted into either
  492      * the root directory of the ISO image or into a dedicated relocation
  493      * directory. For details see libisofs.h, iso_write_opts_set_rr_reloc().
  494      */
  495     char *rr_reloc_dir;       /* IsoNode name in root directory. NULL or
  496                                  empty text means root itself. */
  497     int rr_reloc_flags;       /* bit0= mark auto-created rr_reloc_dir by RE
  498                                  bit1= not settable via API (used internally)
  499                               */
  500 
  501 
  502 
  503     /**
  504      * Allow path in the ISO-9660 tree to have more than 255 characters.
  505      */
  506     unsigned int allow_longer_paths :1;
  507 
  508     /**
  509      * Allow a single file or directory hierarchy to have up to 37 characters.
  510      * This is larger than the 31 characters allowed by ISO level 2, and the
  511      * extra space is taken from the version number, so this also forces
  512      * omit_version_numbers.
  513      */
  514     unsigned int max_37_char_filenames :1;
  515 
  516     /**
  517      * ISO-9660 forces filenames to have a ".", that separates file name from
  518      * extension. libisofs adds it if original filename doesn't has one. Set
  519      * this to 1 to prevent this behavior
  520      *      bit0= no forced dot with ECMA-119
  521      *      bit1= no forced dot with Joliet
  522      */
  523     unsigned int no_force_dots :2;
  524 
  525     /**
  526      * Allow lowercase characters in ISO-9660 filenames. By default, only
  527      * uppercase characters, numbers and a few other characters are allowed.
  528      */
  529     unsigned int allow_lowercase :1;
  530 
  531     /**
  532      * Allow all ASCII characters to be appear on an ISO-9660 filename. Note
  533      * that "/" and "\0" characters are never allowed, even in RR names.
  534      */
  535     unsigned int allow_full_ascii :1;
  536 
  537     /**
  538      * Like allow_full_ascii, but only allowing 7-bit characters.
  539      * Lowercase letters get mapped to uppercase if not allow_lowercase is set.
  540      * Gets overridden if allow_full_ascii is enabled.
  541      */
  542     unsigned int allow_7bit_ascii :1;
  543 
  544     /**
  545      * Allow paths in the Joliet tree to have more than 240 characters.
  546      */
  547     unsigned int joliet_longer_paths :1;
  548 
  549     /**
  550      * Allow leaf names in the Joliet tree to have up to 103 characters
  551      * rather than 64.
  552      */
  553     unsigned int joliet_long_names :1;
  554 
  555     /**
  556      * Use UTF-16BE rather than its subset UCS-2
  557      */
  558     unsigned int joliet_utf16 :1;
  559 
  560     /**
  561      * Store timestamps as GMT rather than in local time.
  562      */
  563     unsigned int always_gmt :1;
  564 
  565     /**
  566      * Write Rock Ridge info as of specification RRIP-1.10 rather than
  567      * RRIP-1.12: signature "RRIP_1991A" rather than "IEEE_1282",
  568      *            field PX without file serial number
  569      */
  570     unsigned int rrip_version_1_10 :1;
  571 
  572     /**
  573      * Store as ECMA-119 Directory Record timestamp the mtime
  574      * of the source rather than the image creation time.
  575      * The same can be ordered for Joliet and ISO 9660:1999
  576      */
  577     unsigned int dir_rec_mtime :1;
  578     unsigned int joliet_rec_mtime :1;
  579     unsigned int iso1999_rec_mtime :1;
  580 
  581     /**
  582      * Write AAIP as extension according to SUSP 1.10 rather than SUSP 1.12.
  583      * I.e. without announcing it by an ER field and thus without the need
  584      * to precede the RRIP fields by an ES and to precede the AA field by ES.
  585      */
  586     unsigned int aaip_susp_1_10 :1;
  587 
  588     unsigned int sort_files:1;
  589                 /**< If files should be sorted based on their weight. */
  590 
  591     /**
  592      * The following options set the default values for files and directory
  593      * permissions, gid and uid. All these take one of three values: 0, 1 or 2.
  594      * If 0, the corresponding attribute will be kept as set in the IsoNode.
  595      * Unless you have changed it, it corresponds to the value on disc, so it
  596      * is suitable for backup purposes. If set to 1, the corresponding attrib.
  597      * will be changed by a default suitable value. Finally, if you set it to
  598      * 2, the attrib. will be changed with the value specified in the options
  599      * below. Note that for mode attributes, only the permissions are set, the
  600      * file type remains unchanged.
  601      */
  602     unsigned int replace_dir_mode :2; 
  603     unsigned int replace_file_mode :2;
  604     unsigned int replace_uid :2;
  605     unsigned int replace_gid :2;
  606     
  607     mode_t dir_mode; /** Mode to use on dirs when replace_dir_mode == 2. */
  608     mode_t file_mode; /** Mode to use on files when replace_file_mode == 2. */
  609     uid_t uid; /** uid to use when replace_uid == 2. */
  610     gid_t gid; /** gid to use when replace_gid == 2. */
  611 
  612     char *output_charset; /**< NULL to use default charset */
  613 
  614 
  615     /* Options for image transport */
  616 
  617     /** The number of bytes to be used for the fifo which decouples libisofs
  618         and libburn for better throughput and for reducing the risk of
  619         interrupting signals hitting the libburn thread which operates the
  620         MMC drive.
  621         The size will be rounded up to the next full 2048.
  622         Minimum is 64kiB, maximum is 1 GiB (but that is too much anyway).
  623     */
  624     int fifo_size;
  625 
  626 
  627     /** Output value: Block address of session start as evaluated from medium
  628                       and other options by libisoburn and libburn.
  629         If <0 : Invalid
  630         If >=0: Valid block number. Block size is always 2 KiB.
  631     */
  632     int effective_lba;
  633 
  634     /** Output value: Block address of data section start as predicted by
  635                       libisofs.
  636         If < 16: Invalid
  637         If >=16: Valid block number. Block size is always 2 KiB.
  638     */
  639     int data_start_lba;
  640 
  641     /**
  642      * If not empty: Parameters "name" and "timestamp" for a scdbackup stream
  643      * checksum tag. See scdbackup/README appendix VERIFY.
  644      * It makes sense only for single session images which start at LBA 0.
  645      * Such a tag may be part of a libisofs checksum tag block after the
  646      * session tag line. It then covers the whole session up to its own start
  647      * position.
  648      * If scdbackup_tag_written is not NULL then it is a pointer to an
  649      * application provided array with at least 512 characters. The effectively
  650      * written scdbackup tag will be copied to this memory location.
  651      */
  652     char scdbackup_tag_name[81];
  653     char scdbackup_tag_time[19];
  654     char *scdbackup_tag_written;
  655 
  656 
  657     /* Content of an embedded boot image. Valid if not NULL.
  658      * In that case it must point to a memory buffer at least 32 kB.
  659      */
  660     char *system_area_data;
  661     /*
  662      * bit0= make bytes 446 - 512 of the system area a partition
  663      *       table which reserves partition 1 from byte 63*512 to the
  664      *       end of the ISO image. Assumed are 63 secs/hed, 255 head/cyl.
  665      *       (GRUB protective msdos label.)
  666      *       This works with and without system_area_data.
  667      */
  668     int system_area_options;
  669 
  670     /* User settable PVD time stamps */
  671     time_t vol_creation_time;
  672     time_t vol_modification_time;
  673     time_t vol_expiration_time;
  674     time_t vol_effective_time;
  675     /* To eventually override vol_modification_time by unconverted string
  676        and timezone 0 */
  677     char vol_uuid[17];
  678 
  679     /* The number of unclaimed 2K blocks before start of partition 1 as of
  680        the MBR in system area. If not 0 this will cause double volume
  681        descriptor sets and double tree.
  682     */
  683     uint32_t partition_offset;
  684     /* Partition table parameter: 1 to 63, 0= disabled/default */
  685     int partition_secs_per_head; 
  686     /* 1 to 255, 0= disabled/default */
  687     int partition_heads_per_cyl;
  688 
  689     /* Parameters and state of Jigdo Template Export environment.
  690     */
  691     void *libjte_handle;
  692 
  693     /* A trailing padding of zero bytes which belongs to the image
  694     */
  695     uint32_t tail_blocks;
  696 
  697     /* Disk file paths of content of PreP partition and EFI system partition */
  698     char *prep_partition;
  699     int prep_part_flag;
  700     char *efi_boot_partition;
  701     int efi_boot_part_flag;
  702 
  703     /* Disk file paths of prepared images which shall be appended
  704        after the ISO image and described by partition table entries in a MBR.
  705        NULL means unused.
  706     */
  707     char *appended_partitions[Libisoburn_max_appended_partitionS];
  708     uint8_t appended_part_types[Libisoburn_max_appended_partitionS];
  709     int appended_part_flags[Libisoburn_max_appended_partitionS];
  710     uint8_t appended_part_type_guids[Libisoburn_max_appended_partitionS][16];
  711 
  712     /* Flags in case that appended partitions show up in GPT:
  713        bit0= appended_part_type_guids[same_index] is valid
  714     */
  715     uint8_t appended_part_gpt_flags[Libisoburn_max_appended_partitionS];
  716 
  717     /* If 1: With appended partitions: create protective MBR and mark by GPT
  718     */
  719     int appended_as_gpt;
  720 
  721     /* If 1: With appended partitions: mark by APM
  722     */
  723     int appended_as_apm;
  724 
  725     /* If 1: Apply isohybrid gestures to non-isohybrid situations
  726     */
  727     int part_like_isohybrid;
  728 
  729     /* isoburn_igopt_set_iso_mbr_part_type()
  730     */
  731     int iso_mbr_part_type;
  732 
  733     /* isoburn_igopt_set_iso_type_guid()
  734     */
  735     uint8_t iso_gpt_type_guid[16];
  736     /* bit0= iso_gpt_type_guid is valid
  737     */
  738     int iso_gpt_flag;
  739 
  740     /* See libisoburn.h isoburn_igopt_set_gpt_guid()
  741     */
  742     uint8_t gpt_guid[16];
  743     int gpt_guid_mode;
  744 
  745     /* Eventual name of the non-ISO aspect of the image. E.g. SUN ASCII label.
  746      */
  747     char ascii_disc_label[Libisoburn_disc_label_sizE];
  748 
  749     /* HFS+ image serial number.
  750      * 00...00 means that it shall be generated by libisofs.
  751      */
  752     uint8_t hfsp_serial_number[8];
  753 
  754     /* Allocation block size of HFS+ : 0= auto , 512, or 2048
  755      */
  756     int hfsp_block_size;
  757 
  758     /* Block size of and in APM : 0= auto , 512, or 2048
  759      */
  760     int apm_block_size;
  761 
  762     /* Write mode for optical media:
  763      *   0 = auto
  764      *   1 = TAO, Incremental, no RESERVE TRACK
  765      *  -1 = SAO, DAO, RESERVE TRACK
  766      */
  767     int do_tao;
  768 
  769     /* Whether to fsync() stdio_drives after isoburn_activate_session() */
  770     int do_fsync;
  771 
  772 };
  773 
  774 
  775 /* Alignment for session starts on overwritable media.
  776    (Increased from 16 to 32 blocks for aligning to BD-RE clusters.)
  777 */
  778 #define Libisoburn_nwa_alignemenT 32
  779 
  780 
  781 /* Alignment for outer session scanning with -ROM drives.
  782    (E.g. my DVD-ROM drive shows any DVD type as 0x10 "DVD-ROM" with
  783     more or less false capacity and TOC.)
  784 */
  785 #define Libisoburn_toc_scan_alignemenT 16
  786 
  787 /* Maximum gap to be bridged during a outer TOC scan. Gaps appear between the
  788    end of a session and the start of the next session.
  789    The longest gap found so far was about 38100 after the first session of a
  790    DVD-R.
  791 */
  792 #define Libisoburn_toc_scan_max_gaP 65536
  793 
  794 
  795 /* Creating a chain of image headers which form a TOC:
  796 
  797    The header of the first session is written after the LBA 0 header.
  798    So it persists and can give the end of its session. By help of
  799    Libisoburn_nwa_alignemenT it should be possible to predict the start
  800    of the next session header.
  801    The LBA 0 header is written by isoburn_activate_session() already
  802    with the first session. So the medium is mountable.
  803    A problem arises with DVD-RW in Intermediate State. They cannot be
  804    written by random access before they were written sequentially.
  805    In this case, no copy of the session  1 header is maintained and no TOC
  806    will be possible. Thus writing begins sequentially at LBA 0.
  807 
  808    IMPORTANT: This macro gives the minimal size of an image header. 
  809               It has to be enlarged by the eventual partition offset.
  810 */
  811 #define Libisoburn_overwriteable_starT \
  812                                    ((off_t) (Libisoburn_target_head_sizE/2048))
  813 
  814 
  815 /* Wrappers for emulation of TOC on overwritable media */
  816 
  817 struct isoburn_toc_track {
  818  /* Either track or toc_entry are supposed to be NULL */
  819  struct burn_track *track;
  820  struct isoburn_toc_entry *toc_entry;
  821 };
  822 
  823 struct isoburn_toc_session {
  824  /* Either session or tracks and toc_entry are supposed to be NULL */
  825  struct burn_session *session;
  826  struct isoburn_toc_track **track_pointers;
  827  int track_count;
  828  struct isoburn_toc_entry *toc_entry;
  829 };
  830 
  831 struct isoburn_toc_disc {
  832  /* Either disc or sessions and toc are supposed to be NULL */
  833  struct burn_disc *disc; 
  834  struct isoburn_toc_session *sessions;           /* storage array */
  835  struct isoburn_toc_session **session_pointers;  /* storage array */
  836  struct isoburn_toc_track *tracks;               /* storage array */
  837  struct isoburn_toc_track **track_pointers;      /* storage array */
  838  int session_count;
  839  int incomplete_session_count;
  840  int track_count;
  841  struct isoburn_toc_entry *toc;
  842 };
  843 
  844 #endif /* Isoburn_includeD */
  845