libisoburn-0.4.8.pl00/libisoburn/isoburn.c File Reference

#include <sys/types.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <libburn/libburn.h>
#include <libisofs/libisofs.h>
#include "libisoburn.h"
#include "isoburn.h"
Include dependency graph for isoburn.c:

Go to the source code of this file.

Functions

int isoburn_toc_entry_new (struct isoburn_toc_entry **objpt, struct isoburn_toc_entry *boss, int flag)
int isoburn_toc_entry_destroy (struct isoburn_toc_entry **o, int flag)
int isoburn_new (struct isoburn **objpt, int flag)
int isoburn_destroy (struct isoburn **objpt, int flag)
int isoburn_destroy_all (struct isoburn **objpt, int flag)
int isoburn_get_target_image (struct isoburn *o, IsoImage **pt, int flag)
int isoburn_get_prev (struct isoburn *o, struct isoburn **pt, int flag)
int isoburn_get_next (struct isoburn *o, struct isoburn **pt, int flag)
int isoburn_link (struct isoburn *o, struct isoburn *link, int flag)
int isoburn_count (struct isoburn *o, int flag)
int isoburn_by_idx (struct isoburn *o, int idx, struct isoburn **pt, int flag)
int isoburn_find_by_drive (struct isoburn **pt, struct burn_drive *d, int flag)
int isoburn_msgs_submit (struct isoburn *o, int error_code, char msg_text[], int os_errno, char severity[], int flag)
static int isoburn_prepare_disc_aux (struct burn_drive *in_d, struct burn_drive *out_d, struct burn_disc **disc, struct isoburn_imgen_opts *opts, int flag)
int isoburn_prepare_disc (struct burn_drive *d, struct burn_disc **disc, struct isoburn_imgen_opts *opts)
 To choose the expansion method of Growing: Create a disc object for writing the new session from the created or loaded iso_volset which has been manipulated via libisofs, to the same media from where the image was eventually loaded.
int isoburn_prepare_new_image (struct burn_drive *d, struct burn_disc **disc, struct isoburn_imgen_opts *opts, struct burn_drive *out_drive)
 To choose the expansion method of Modifying: Create a disc object for producing a new image from a previous image plus the changes made by user.
int isoburn_prepare_blind_grow (struct burn_drive *d, struct burn_disc **disc, struct isoburn_imgen_opts *opts, struct burn_drive *out_drive, int nwa)
 To choose the expansion method of Blind Growing: Create a disc object for writing an add-on session from the created or loaded IsoImage which has been manipulated via libisofs, to a different drive than the one from where it was loaded.
int isoburn_cancel_prepared_write (struct burn_drive *d, struct burn_drive *output_drive, int flag)
 Revoke isoburn_prepare_*() instead of running isoburn_disc_write().
int isoburn_sync_after_write (struct burn_drive *d, struct burn_drive *output_drive, int flag)
 Wait after normal end of operations until libisofs ended all write threads and freed resource reservations.
void isoburn_version (int *major, int *minor, int *micro)
 Obtain the three release version numbers of the library.
int isoburn_is_compatible (int major, int minor, int micro, int flag)
 Check whether all features of header file libisoburn.h from the given major.minor.micro revision triple can be delivered by the library version which is performing this call.
int isoburn_ropt_new (struct isoburn_read_opts **new_o, int flag)
 Produces a set of image read options, initialized with default values.
int isoburn_ropt_destroy (struct isoburn_read_opts **o, int flag)
 Deletes an option set which was created by isoburn_ropt_new().
int isoburn_ropt_set_extensions (struct isoburn_read_opts *o, int ext)
int isoburn_ropt_get_extensions (struct isoburn_read_opts *o, int *ext)
int isoburn_ropt_set_default_perms (struct isoburn_read_opts *o, uid_t uid, gid_t gid, mode_t mode)
 Default attributes to use if no RockRidge extension gets loaded.
int isoburn_ropt_get_default_perms (struct isoburn_read_opts *o, uid_t *uid, gid_t *gid, mode_t *mode)
int isoburn_ropt_set_default_dirperms (struct isoburn_read_opts *o, mode_t mode)
 Default attributes to use on directories if no RockRidge extension gets loaded.
int isoburn_ropt_get_default_dirperms (struct isoburn_read_opts *o, mode_t *mode)
int isoburn_ropt_set_input_charset (struct isoburn_read_opts *o, char *input_charset)
 Set the character set for reading RR file names from ISO images.
int isoburn_ropt_get_input_charset (struct isoburn_read_opts *o, char **input_charset)
int isoburn_ropt_set_auto_incharset (struct isoburn_read_opts *o, int mode)
 Enable or disable methods to automatically choose an input charset.
int isoburn_ropt_get_auto_incharset (struct isoburn_read_opts *o, int *mode)
int isoburn_ropt_get_size_what (struct isoburn_read_opts *o, uint32_t *size, int *has_what)
int isoburn_igopt_new (struct isoburn_imgen_opts **new_o, int flag)
 Produces a set of generation and transfer options, initialized with default values.
int isoburn_igopt_destroy (struct isoburn_imgen_opts **o, int flag)
 Deletes an option set which was created by isoburn_igopt_new().
int isoburn_igopt_set_level (struct isoburn_imgen_opts *o, int level)
 ISO level to write at.
int isoburn_igopt_get_level (struct isoburn_imgen_opts *o, int *level)
int isoburn_igopt_set_extensions (struct isoburn_imgen_opts *o, int ext)
int isoburn_igopt_get_extensions (struct isoburn_imgen_opts *o, int *ext)
int isoburn_igopt_set_relaxed (struct isoburn_imgen_opts *o, int relax)
int isoburn_igopt_get_relaxed (struct isoburn_imgen_opts *o, int *relax)
int isoburn_igopt_set_sort_files (struct isoburn_imgen_opts *o, int value)
int isoburn_igopt_get_sort_files (struct isoburn_imgen_opts *o, int *value)
int isoburn_igopt_set_over_mode (struct isoburn_imgen_opts *o, int replace_dir_mode, int replace_file_mode, mode_t dir_mode, mode_t file_mode)
 Set the override values for files and directory permissions.
int isoburn_igopt_get_over_mode (struct isoburn_imgen_opts *o, int *replace_dir_mode, int *replace_file_mode, mode_t *dir_mode, mode_t *file_mode)
int isoburn_igopt_set_over_ugid (struct isoburn_imgen_opts *o, int replace_uid, int replace_gid, uid_t uid, gid_t gid)
 Set the override values values for group id and user id.
int isoburn_igopt_get_over_ugid (struct isoburn_imgen_opts *o, int *replace_uid, int *replace_gid, uid_t *uid, gid_t *gid)
int isoburn_igopt_set_out_charset (struct isoburn_imgen_opts *o, char *output_charset)
 Set the charcter set to use for representing filenames in the image.
int isoburn_igopt_get_out_charset (struct isoburn_imgen_opts *o, char **output_charset)
int isoburn_igopt_set_fifo_size (struct isoburn_imgen_opts *o, int fifo_size)
 The number of bytes to be used for the fifo which decouples libisofs and libburn for better throughput and for reducing the risk of interrupting signals hitting the libburn thread which operates the MMC drive.
int isoburn_igopt_get_fifo_size (struct isoburn_imgen_opts *o, int *fifo_size)
int isoburn_igopt_get_effective_lba (struct isoburn_imgen_opts *o, int *lba)
 Obtain after image preparation the block address where the session will start on media.
int isoburn_igopt_get_data_start (struct isoburn_imgen_opts *o, int *lba)
 Obtain after image preparation the lowest block address of file content data.
int isoburn_igopt_set_scdbackup_tag (struct isoburn_imgen_opts *o, char *name, char *timestamp, char *tag_written)
 Set resp.
int isoburn_igopt_get_scdbackup_tag (struct isoburn_imgen_opts *o, char name[81], char timestamp[19], char **tag_written)

Variables

int(* libisoburn_default_msgs_submit )(void *handle, int error_code, char msg_text[], int os_errno, char severity[], int flag) = NULL
void * libisoburn_default_msgs_submit_handle = NULL
int libisoburn_default_msgs_submit_flag = 0
struct isoburnisoburn_list_start = NULL

Function Documentation

int isoburn_by_idx ( struct isoburn o,
int  idx,
struct isoburn **  pt,
int  flag 
)

Definition at line 280 of file isoburn.c.

References isoburn::next, and isoburn::prev.

00281        : bit0= fetch first (idx<0) or last (idx>0) item in list
00282          bit1= address from start of list */
00283 {
00284  int i,abs_idx;
00285  struct isoburn *npt;
00286 
00287  if(flag&2)
00288    for(;o->prev!=NULL;o= o->prev);
00289  abs_idx= (idx>0?idx:-idx);
00290  *pt= o;
00291  for(i= 0;(i<abs_idx || (flag&1)) && *pt!=NULL;i++) {
00292    if(idx>0)
00293      npt= o->next;
00294    else
00295      npt= o->prev;
00296    if(npt==NULL && (flag&1))
00297  break;
00298    *pt= npt;
00299  }
00300  return(*pt!=NULL);
00301 }

int isoburn_cancel_prepared_write ( struct burn_drive *  input_drive,
struct burn_drive *  output_drive,
int  flag 
)

Revoke isoburn_prepare_*() instead of running isoburn_disc_write().

libisofs reserves resources and maybe already starts generating the image stream when one of above three calls is performed. It is mandatory to either run isoburn_disc_write() or to revoke the preparations by the call described here.

Since:
0.1.0
Parameters:
input_drive The drive resp. in_drive which was used with the preparation call.
output_drive The out_drive used with isoburn_prepare_new_image(), NULL if none.
flag Bitfield, submit 0 for now. bit0= -reserved for internal use-
Returns:
<0 error, 0= no pending preparations detectable, 1 = canceled

Definition at line 571 of file isoburn.c.

References isoburn::iso_source, and isoburn_find_emulator().

Referenced by isoburn_sync_after_write().

00573 {
00574  int ret;
00575  struct isoburn *o= NULL;
00576 
00577  if(output_drive!=NULL) {
00578    ret= isoburn_find_emulator(&o, output_drive, 0);
00579    if(ret<0 || o==NULL)
00580      o= NULL;
00581    else if(o->iso_source==NULL)
00582      o= NULL;
00583  }
00584  if(o==NULL) {
00585    ret= isoburn_find_emulator(&o, d, 0);
00586    if(ret<0)
00587      return(-1);
00588    if(o==NULL)
00589      return(0);
00590    if(o->iso_source==NULL)
00591      return(0);
00592  }
00593  if(o->iso_source->read!=NULL)
00594    return(0);
00595  if(o->iso_source->version<1)
00596    return(0);
00597  o->iso_source->cancel(o->iso_source);
00598  burn_source_free(o->iso_source);
00599  o->iso_source= NULL;
00600  return(1);
00601 }

int isoburn_count ( struct isoburn o,
int  flag 
)

Definition at line 267 of file isoburn.c.

References isoburn::next, and isoburn::prev.

00268        : bit1= count from start of list */
00269 {
00270  int counter= 0;
00271 
00272  if(flag&2)
00273    for(;o->prev!=NULL;o= o->prev);
00274  for(;o!=NULL;o= o->next)
00275    counter++;
00276  return(counter);
00277 }

int isoburn_destroy ( struct isoburn **  objpt,
int  flag 
)

Definition at line 158 of file isoburn.c.

References isoburn::image, isoburn::iso_data_source, isoburn::iso_source, isoburn_toc_entry_destroy(), isoburn::next, isoburn::prev, and isoburn::toc.

Referenced by isoburn_destroy_all(), isoburn_drive_aquire(), isoburn_drive_grab(), isoburn_drive_release(), and isoburn_new().

00159 {
00160  struct isoburn *o;
00161 
00162  o= *objpt;
00163  if(o==NULL)
00164    return(0);
00165 
00166  /* >>> mutex */
00167 
00168  if(o==isoburn_list_start)
00169    isoburn_list_start= o->next;
00170  if(o->prev!=NULL)
00171    o->prev->next= o->next;
00172  if(o->next!=NULL)
00173    o->next->prev= o->prev;
00174 
00175  /* >>> end mutex */
00176 
00177  if(o->image!=NULL)
00178    iso_image_unref(o->image);
00179  if(o->toc!=NULL)
00180    isoburn_toc_entry_destroy(&(o->toc), 1); /* all */
00181  if(o->iso_source!=NULL)
00182    burn_source_free(o->iso_source);
00183  if(o->iso_data_source!=NULL)
00184    iso_data_source_unref(o->iso_data_source);
00185  free((char *) o);
00186  *objpt= NULL;
00187  return(1);
00188 }

int isoburn_destroy_all ( struct isoburn **  objpt,
int  flag 
)

Definition at line 191 of file isoburn.c.

References isoburn_destroy(), isoburn::next, and isoburn::prev.

Referenced by isoburn_finish(), and isoburn_initialize().

00192 {
00193  struct isoburn *o,*n;
00194 
00195  o= *objpt;
00196  if(o==NULL)
00197    return(0);
00198  for(;o->prev!=NULL;o= o->prev);
00199  for(;o!=NULL;o= n) {
00200    n= o->next;
00201    isoburn_destroy(&o,0);
00202  }
00203  *objpt= NULL;
00204  return(1);
00205 }

int isoburn_find_by_drive ( struct isoburn **  pt,
struct burn_drive *  d,
int  flag 
)

Definition at line 304 of file isoburn.c.

References isoburn::drive, and isoburn::next.

Referenced by isoburn_find_emulator().

00305 {
00306  struct isoburn *o;
00307 
00308  *pt= NULL;
00309  for(o= isoburn_list_start;o!=NULL;o= o->next)
00310    if(o->drive==d) {
00311      *pt= o;
00312      return(1);
00313    }
00314  return(0);
00315 }

int isoburn_get_next ( struct isoburn o,
struct isoburn **  pt,
int  flag 
)

Definition at line 222 of file isoburn.c.

References isoburn::next.

00223 {
00224  *pt= o->next;
00225  return(1);
00226 }

int isoburn_get_prev ( struct isoburn o,
struct isoburn **  pt,
int  flag 
)

Definition at line 215 of file isoburn.c.

References isoburn::prev.

00216 {
00217  *pt= o->prev;
00218  return(1);
00219 }

int isoburn_get_target_image ( struct isoburn o,
IsoImage **  pt,
int  flag 
)

Definition at line 208 of file isoburn.c.

References isoburn::image.

00209 {
00210  *pt= o->image;
00211  return(1);
00212 }

int isoburn_igopt_destroy ( struct isoburn_imgen_opts **  o,
int  flag 
)

Deletes an option set which was created by isoburn_igopt_new().

Since:
0.1.0
Parameters:
o The option set to give up
flag Bitfield for control purposes. Submit 0 for now.
Returns:
1= **o destroyed , 0= *o was already NULL (harmless)

Definition at line 855 of file isoburn.c.

00856 {
00857  if(*o==NULL)
00858    return(0);
00859  free(*o);
00860  *o= NULL;
00861  return(1);
00862 }

int isoburn_igopt_get_data_start ( struct isoburn_imgen_opts o,
int *  lba 
)

Obtain after image preparation the lowest block address of file content data.

Failure can occur if libisofs is too old to provide this information, if the result exceeds 31 bit, or if the call is made before image preparation. This value cannot be set by the application but only be inquired.

Since:
0.3.6
Parameters:
o The option set to work on
lba The block number of the session start on media. <0 means that no address has been determined yet.
Returns:
1 success, <=0 failure

Definition at line 1029 of file isoburn.c.

References isoburn_imgen_opts::data_start_lba.

01030 {
01031  *lba= o->data_start_lba;
01032  return(1);
01033 }

int isoburn_igopt_get_effective_lba ( struct isoburn_imgen_opts o,
int *  lba 
)

Obtain after image preparation the block address where the session will start on media.

This value cannot be set by the application but only be inquired.

Since:
0.1.4
Parameters:
o The option set to work on
lba The block number of the session start on media. <0 means that no address has been determined yet.
Returns:
1 success, <=0 failure

Definition at line 1022 of file isoburn.c.

References isoburn_imgen_opts::effective_lba.

01023 {
01024  *lba= o->effective_lba;
01025  return(1);
01026 }

int isoburn_igopt_get_extensions ( struct isoburn_imgen_opts o,
int *  ext 
)

Definition at line 892 of file isoburn.c.

References isoburn_imgen_opts::aaip, isoburn_imgen_opts::file_md5, isoburn_imgen_opts::hardlinks, isoburn_imgen_opts::iso1999, isoburn_imgen_opts::joliet, isoburn_imgen_opts::rockridge, and isoburn_imgen_opts::session_md5.

00893 {
00894  *ext= (!!o->rockridge) | ((!!o->joliet)<<1) | ((!!o->iso1999)<<2) |
00895        ((!!o->hardlinks) << 3) | ((!!o->aaip) << 5) |
00896        ((!!o->session_md5) << 6) | ((o->file_md5 & 3) << 7);
00897  return(1);
00898 }

int isoburn_igopt_get_fifo_size ( struct isoburn_imgen_opts o,
int *  fifo_size 
)

Definition at line 1015 of file isoburn.c.

References isoburn_imgen_opts::fifo_size.

01016 {
01017  *fifo_size= o->fifo_size;
01018  return(1);
01019 }

int isoburn_igopt_get_level ( struct isoburn_imgen_opts o,
int *  level 
)

Definition at line 872 of file isoburn.c.

References isoburn_imgen_opts::level.

00873 {
00874  *level= o->level;
00875  return(1);
00876 }

int isoburn_igopt_get_out_charset ( struct isoburn_imgen_opts o,
char **  output_charset 
)

Definition at line 1000 of file isoburn.c.

References isoburn_imgen_opts::output_charset.

01002 {
01003  *output_charset= o->output_charset;
01004  return(1);
01005 }

int isoburn_igopt_get_over_mode ( struct isoburn_imgen_opts o,
int *  replace_dir_mode,
int *  replace_file_mode,
mode_t *  dir_mode,
mode_t *  file_mode 
)

Definition at line 957 of file isoburn.c.

References isoburn_imgen_opts::dir_mode, isoburn_imgen_opts::file_mode, isoburn_imgen_opts::replace_dir_mode, and isoburn_imgen_opts::replace_file_mode.

00960 {
00961  *replace_dir_mode= o->replace_dir_mode%3;
00962  *replace_file_mode= o->replace_file_mode%3;
00963  *dir_mode= o->dir_mode;
00964  *file_mode= o->file_mode;
00965  return(1);
00966 }

int isoburn_igopt_get_over_ugid ( struct isoburn_imgen_opts o,
int *  replace_uid,
int *  replace_gid,
uid_t *  uid,
gid_t *  gid 
)

Definition at line 980 of file isoburn.c.

References isoburn_imgen_opts::gid, isoburn_imgen_opts::replace_gid, isoburn_imgen_opts::replace_uid, and isoburn_imgen_opts::uid.

00983 {
00984  *replace_uid= o->replace_uid%3;
00985  *replace_gid= o->replace_gid%3;
00986  *uid= o->uid;
00987  *gid= o->gid;
00988  return(1);
00989 }

int isoburn_igopt_get_relaxed ( struct isoburn_imgen_opts o,
int *  relax 
)
int isoburn_igopt_get_scdbackup_tag ( struct isoburn_imgen_opts o,
char  name[81],
char  timestamp[19],
char **  tag_written 
)

Definition at line 1050 of file isoburn.c.

References isoburn_imgen_opts::scdbackup_tag_name, isoburn_imgen_opts::scdbackup_tag_time, and isoburn_imgen_opts::scdbackup_tag_written.

01053 {
01054  strncpy(name, o->scdbackup_tag_name, 80);
01055  name[80]= 0;
01056  strncpy(timestamp, o->scdbackup_tag_time, 18);
01057  timestamp[18]= 0;
01058  *tag_written= o->scdbackup_tag_written;
01059  return(1);
01060 }

int isoburn_igopt_get_sort_files ( struct isoburn_imgen_opts o,
int *  value 
)

Definition at line 938 of file isoburn.c.

References isoburn_imgen_opts::sort_files.

00939 {
00940  *value= !!o->sort_files;
00941  return(1);
00942 }

int isoburn_igopt_new ( struct isoburn_imgen_opts **  o,
int  flag 
)

Produces a set of generation and transfer options, initialized with default values.

Since:
0.1.0
Parameters:
o the newly created option set object
flag Bitfield for control purposes. Submit 0 for now.
Returns:
1=ok , <0 = failure

Definition at line 809 of file isoburn.c.

References isoburn_imgen_opts::aaip, isoburn_imgen_opts::aaip_susp_1_10, isoburn_imgen_opts::allow_deep_paths, isoburn_imgen_opts::allow_full_ascii, isoburn_imgen_opts::allow_longer_paths, isoburn_imgen_opts::allow_lowercase, isoburn_imgen_opts::always_gmt, isoburn_imgen_opts::data_start_lba, isoburn_imgen_opts::dir_mode, isoburn_imgen_opts::dir_rec_mtime, isoburn_imgen_opts::effective_lba, isoburn_imgen_opts::fifo_size, isoburn_imgen_opts::file_mode, isoburn_imgen_opts::gid, isoburn_imgen_opts::hardlinks, isoburn_imgen_opts::iso1999, isoburn_msgs_submit(), isoburn_imgen_opts::joliet, isoburn_imgen_opts::joliet_longer_paths, isoburn_imgen_opts::level, isoburn_imgen_opts::max_37_char_filenames, isoburn_imgen_opts::no_force_dots, isoburn_imgen_opts::omit_version_numbers, isoburn_imgen_opts::output_charset, isoburn_imgen_opts::replace_dir_mode, isoburn_imgen_opts::replace_file_mode, isoburn_imgen_opts::replace_gid, isoburn_imgen_opts::replace_uid, isoburn_imgen_opts::rockridge, isoburn_imgen_opts::rrip_version_1_10, isoburn_imgen_opts::sort_files, and isoburn_imgen_opts::uid.

00810 {
00811  struct isoburn_imgen_opts *o;
00812 
00813  o= (*new_o)= calloc(1, sizeof(struct isoburn_imgen_opts));
00814  if(o==NULL) {
00815    isoburn_msgs_submit(NULL, 0x00060000,
00816                        "Cannot allocate memory for image generation options",
00817                        0, "FATAL", 0);
00818    return(-1);
00819  }
00820  o->level= 2;
00821  o->rockridge= 1;
00822  o->joliet= 0;
00823  o->iso1999= 0;
00824  o->hardlinks= 0;
00825  o->aaip = 0;
00826  o->omit_version_numbers= 0;
00827  o->allow_deep_paths= 1;
00828  o->allow_longer_paths= 0;
00829  o->max_37_char_filenames= 0;
00830  o->no_force_dots= 0;
00831  o->allow_lowercase= 0;
00832  o->allow_full_ascii= 0;
00833  o->joliet_longer_paths= 0;
00834  o->always_gmt= 0;
00835  o->rrip_version_1_10= 0;
00836  o->dir_rec_mtime= 0;
00837  o->aaip_susp_1_10= 0;
00838  o->sort_files= 0;
00839  o->replace_dir_mode= 0;
00840  o->replace_file_mode= 0;
00841  o->replace_uid= 0;
00842  o->replace_gid= 0;
00843  o->dir_mode= 0555;
00844  o->file_mode= 0444;
00845  o->uid= 0;
00846  o->gid= 0;
00847  o->output_charset= NULL;
00848  o->fifo_size= 4*1024*1024;
00849  o->effective_lba= -1;
00850  o->data_start_lba= -1;
00851  return(1);
00852 }

int isoburn_igopt_set_extensions ( struct isoburn_imgen_opts o,
int  ext 
)

Definition at line 879 of file isoburn.c.

References isoburn_imgen_opts::aaip, isoburn_imgen_opts::file_md5, isoburn_imgen_opts::hardlinks, isoburn_imgen_opts::iso1999, isoburn_imgen_opts::joliet, isoburn_imgen_opts::rockridge, and isoburn_imgen_opts::session_md5.

00880 {
00881  o->rockridge= !!(ext&1);
00882  o->joliet= !!(ext&2);
00883  o->iso1999= !!(ext&4);
00884  o->hardlinks= !!(ext & 8);
00885  o->aaip= !!(ext & 32);
00886  o->session_md5= !!(ext & 64);
00887  o->file_md5= (ext & (128 | 256)) >> 7;
00888  return(1);
00889 }

int isoburn_igopt_set_fifo_size ( struct isoburn_imgen_opts o,
int  fifo_size 
)

The number of bytes to be used for the fifo which decouples libisofs and libburn for better throughput and for reducing the risk of interrupting signals hitting the libburn thread which operates the MMC drive.

The size will be rounded up to the next full 2048. Minimum is 64kiB, maximum is 1 GiB (but that is too much anyway).

Since:
0.1.0
Parameters:
o The option set to work on
fifo_size Number of bytes to use
Returns:
1 success, <=0 failure

Definition at line 1008 of file isoburn.c.

References isoburn_imgen_opts::fifo_size.

01009 {
01010  o->fifo_size= fifo_size;
01011  return(1);
01012 }

int isoburn_igopt_set_level ( struct isoburn_imgen_opts o,
int  level 
)

ISO level to write at.

Since:
0.1.0
Parameters:
o The option set to work on
level is a term of the ISO 9660 standard. It should be one of: 1= filenames restricted to form 8.3 2= filenames allowed up to 31 characters
Returns:
1 success, <=0 failure

Definition at line 865 of file isoburn.c.

References isoburn_imgen_opts::level.

00866 {
00867  o->level= level;
00868  return(1);
00869 }

int isoburn_igopt_set_out_charset ( struct isoburn_imgen_opts o,
char *  output_charset 
)

Set the charcter set to use for representing filenames in the image.

Since:
0.1.0
Parameters:
o The option set to work on
output_charset Set this to NULL to use the default output charset. For selecting a particular character set, submit its name, e.g. as listed by program iconv -l. Example: "UTF-8".
Returns:
1 success, <=0 failure

Definition at line 992 of file isoburn.c.

References isoburn_imgen_opts::output_charset.

00994 {
00995  o->output_charset= output_charset;
00996  return(1);
00997 }

int isoburn_igopt_set_over_mode ( struct isoburn_imgen_opts o,
int  replace_dir_mode,
int  replace_file_mode,
mode_t  dir_mode,
mode_t  file_mode 
)

Set the override values for files and directory permissions.

The parameters replace_* these take one of three values: 0, 1 or 2. If 0, the corresponding attribute will be kept as set in the IsoNode at the time of image generation. If set to 1, the corresponding attrib. will be changed by a default suitable value. With value 2, the attrib. will be changed with the value specified in the corresponding *_mode options. Note that only the permissions are set, the file type remains unchanged.

Since:
0.1.0
Parameters:
o The option set to work on
replace_dir_mode whether and how to override directories
replace_file_mode whether and how to override files of other type
dir_mode Mode to use on dirs with replace_dir_mode == 2.
file_mode; Mode to use on files with replace_file_mode == 2.
Returns:
1 success, <=0 failure

Definition at line 945 of file isoburn.c.

References isoburn_imgen_opts::dir_mode, isoburn_imgen_opts::file_mode, isoburn_imgen_opts::replace_dir_mode, and isoburn_imgen_opts::replace_file_mode.

00948 {
00949  o->replace_dir_mode= replace_dir_mode%3;
00950  o->replace_file_mode= replace_file_mode%3;
00951  o->dir_mode= dir_mode;
00952  o->file_mode= file_mode;
00953  return(1);
00954 }

int isoburn_igopt_set_over_ugid ( struct isoburn_imgen_opts o,
int  replace_uid,
int  replace_gid,
uid_t  uid,
gid_t  gid 
)

Set the override values values for group id and user id.

The rules are like with above overriding of mode values. replace_* controls whether and how. The other two parameters provide values for eventual use.

Since:
0.1.0
Parameters:
o The option set to work on
replace_uid whether and how to override user ids
replace_gid whether and how to override group ids
uid User id to use with replace_uid == 2.
gid Group id to use on files with replace_gid == 2.
Returns:
1 success, <=0 failure

Definition at line 969 of file isoburn.c.

References isoburn_imgen_opts::gid, isoburn_imgen_opts::replace_gid, isoburn_imgen_opts::replace_uid, and isoburn_imgen_opts::uid.

00972 {
00973  o->replace_uid= replace_uid%3;
00974  o->replace_gid= replace_gid%3;
00975  o->uid= uid;
00976  o->gid= gid;
00977  return(1);
00978 }

int isoburn_igopt_set_relaxed ( struct isoburn_imgen_opts o,
int  relax 
)
int isoburn_igopt_set_scdbackup_tag ( struct isoburn_imgen_opts o,
char *  name,
char *  timestamp,
char *  tag_written 
)

Set resp.

get parameters "name" and "timestamp" for a scdbackup checksum tag. It will be appended to the libisofs session tag if the image starts at LBA 0. See isoburn_disc_track_lba_nwa. The scdbackup tag can be used to verify the image by command scdbackup_verify <device> -auto_end. See scdbackup/README appendix VERIFY for its inner details.

Since:
0.4.4
Parameters:
o The option set to work on
name The tag name. 80 characters max.
timestamp A string of up to 13 characters YYMMDD.hhmmss A9 = 2009, B0 = 2010, B1 = 2011, ... C0 = 2020, ...
tag_written Either NULL or the address of an array with at least 512 characters. In the latter case the eventually produced scdbackup tag will be copied to this array when the image gets written. This call sets scdbackup_tag_written[0] = 0 to mark its preliminary invalidity.
Returns:
1 success, <=0 failure

Definition at line 1036 of file isoburn.c.

References isoburn_imgen_opts::scdbackup_tag_name, isoburn_imgen_opts::scdbackup_tag_time, and isoburn_imgen_opts::scdbackup_tag_written.

01038 {
01039  strncpy(o->scdbackup_tag_name, name, 80);
01040  o->scdbackup_tag_name[80]= 0;
01041  strncpy(o->scdbackup_tag_time, timestamp, 18);
01042  o->scdbackup_tag_time[18]= 0;
01043  o->scdbackup_tag_written = tag_written;
01044  if(tag_written != NULL)
01045    tag_written[0]= 0;
01046  return(1);
01047 }

int isoburn_igopt_set_sort_files ( struct isoburn_imgen_opts o,
int  value 
)

Definition at line 931 of file isoburn.c.

References isoburn_imgen_opts::sort_files.

00932 {
00933  o->sort_files= !!(value&1);
00934  return(1);
00935 }

int isoburn_is_compatible ( int  major,
int  minor,
int  micro,
int  flag 
)

Check whether all features of header file libisoburn.h from the given major.minor.micro revision triple can be delivered by the library version which is performing this call.

An application of libisoburn can easily memorize the version of the libisofs.h header in its own code. Immediately after isoburn_initialize() it should simply do this check: if (! isoburn_is_compatible(isoburn_header_version_major, isoburn_header_version_minor, isoburn_header_version_micro, 0)) ...refuse to start the program with this dynamic library version...

Since:
0.1.0
Parameters:
major obtained at build time
minor obtained at build time
micro obtained at build time
flag Bitfield for control purposes. Unused yet. Submit 0.
Returns:
1= library can work for caller 0= library is not usable in some aspects. Caller must restrict itself to an earlier API version or must not use this libray at all.

Definition at line 628 of file isoburn.c.

References isoburn_version().

00629 {
00630  int own_major, own_minor, own_micro;
00631 
00632  isoburn_version(&own_major, &own_minor, &own_micro);
00633  return(own_major > major ||
00634         (own_major == major && (own_minor > minor ||
00635          (own_minor == minor && own_micro >= micro))));
00636 }

int isoburn_link ( struct isoburn o,
struct isoburn link,
int  flag 
)

Definition at line 229 of file isoburn.c.

References isoburn::next, and isoburn::prev.

Referenced by isoburn_new().

00233 {
00234 
00235  /* >>> mutex */
00236 
00237  if(isoburn_list_start==NULL ||
00238     (isoburn_list_start==link && (flag&1)))
00239    isoburn_list_start= o;
00240  if(o->prev!=NULL)
00241    o->prev->next= o->next;
00242  if(o->next!=NULL)
00243    o->next->prev= o->prev;
00244  o->prev= o->next= NULL;
00245  if(link==NULL)
00246    return(1);
00247  if(flag&1) {
00248    o->next= link;
00249    o->prev= link->prev;
00250    if(o->prev!=NULL)
00251      o->prev->next= o;
00252    link->prev= o;
00253  } else {
00254    o->prev= link;
00255    o->next= link->next;
00256    if(o->next!=NULL)
00257      o->next->prev= o;
00258    link->next= o;
00259  }
00260 
00261  /* >>> end mutex */
00262 
00263  return(1);
00264 }

int isoburn_msgs_submit ( struct isoburn o,
int  error_code,
char  msg_text[],
int  os_errno,
char  severity[],
int  flag 
)

Definition at line 318 of file isoburn.c.

References libisoburn_default_msgs_submit, libisoburn_default_msgs_submit_flag, libisoburn_default_msgs_submit_handle, isoburn::msgs_submit, isoburn::msgs_submit_flag, and isoburn::msgs_submit_handle.

Referenced by ds_read_block(), isoburn_attach_image(), isoburn_disc_get_msc1(), isoburn_disc_write(), isoburn_emulate_toc(), isoburn_find_emulator(), isoburn_igopt_new(), isoburn_make_toc_entry(), isoburn_new(), isoburn_prepare_disc_aux(), isoburn_read_image(), isoburn_read_iso_head_parse(), isoburn_ropt_new(), isoburn_set_msc1(), isoburn_set_start_byte(), isoburn_start_emulation(), isoburn_toc_entry_new(), and isoburn_welcome_media().

00320 {
00321  int ret, use_drive_method= 0;
00322 
00323  if(o!=NULL)
00324    if(o->msgs_submit!=NULL)
00325      use_drive_method= 1;
00326  if(use_drive_method) {
00327    ret= o->msgs_submit(o->msgs_submit_handle, error_code, msg_text, os_errno,
00328                        severity, o->msgs_submit_flag);
00329    return(ret);
00330  }
00331  if(libisoburn_default_msgs_submit != NULL) {
00332    ret= libisoburn_default_msgs_submit(libisoburn_default_msgs_submit_handle,
00333                                      error_code, msg_text, os_errno, severity,
00334                                      libisoburn_default_msgs_submit_flag);
00335    return(ret);
00336  }
00337  /* Fallback: use message queue of libburn */
00338  burn_msgs_submit(error_code, msg_text, os_errno, severity, NULL);
00339  return(1);
00340 }

int isoburn_new ( struct isoburn **  objpt,
int  flag 
)

Definition at line 109 of file isoburn.c.

References isoburn::drive, isoburn::emulation_mode, isoburn::fabricated_disc_status, isoburn::fabricated_msc1, isoburn::fabricated_msc2, isoburn::image, isoburn::iso_data_source, isoburn::iso_source, isoburn_destroy(), isoburn_link(), isoburn_msgs_submit(), isoburn_report_iso_error(), Libisoburn_overwriteable_starT, Libisoburn_target_head_sizE, isoburn::min_start_byte, isoburn::msgs_submit, isoburn::msgs_submit_flag, isoburn::msgs_submit_handle, isoburn::next, isoburn::nwa, isoburn::prev, isoburn::read_pacifier, isoburn::read_pacifier_handle, isoburn::target_iso_head, isoburn::toc, isoburn::truncate, isoburn::wrote_well, and isoburn::zero_nwa.

Referenced by isoburn_welcome_media().

00110 {
00111  struct isoburn *o;
00112  int i, ret;
00113 
00114  *objpt= o= (struct isoburn *) malloc(sizeof(struct isoburn));
00115  if(o==NULL) {
00116    isoburn_msgs_submit(NULL, 0x00060000,
00117                        "Cannot allocate memory for isoburn control object",
00118                        0, "FATAL", 0);
00119    return(-1);
00120  }
00121 
00122  o->drive= NULL;
00123  o->emulation_mode= 0;
00124  o->fabricated_msc1= -1;
00125  o->fabricated_msc2= -1;
00126  o->zero_nwa= Libisoburn_overwriteable_starT;
00127  o->min_start_byte= o->zero_nwa * 2048;
00128  o->nwa= o->zero_nwa;
00129  o->truncate= 0;
00130  o->iso_source= NULL;
00131  o->fabricated_disc_status= BURN_DISC_UNREADY;
00132  o->toc= NULL;
00133  o->wrote_well= -1;
00134  for(i=0;i<Libisoburn_target_head_sizE;i++)
00135    o->target_iso_head[i]= 0;
00136  o->image= NULL;
00137  o->iso_data_source= NULL;
00138  o->read_pacifier= NULL;
00139  o->read_pacifier_handle= NULL;
00140  o->msgs_submit= NULL;
00141  o->msgs_submit_handle= NULL;
00142  o->msgs_submit_flag= 0;
00143  o->prev= NULL;
00144  o->next= NULL;
00145  ret= iso_image_new("ISOIMAGE", &o->image);
00146  if(ret<0) {
00147    isoburn_report_iso_error(ret, "Cannot create image", 0, "FATAL", 0);
00148    goto failed;
00149  }
00150  isoburn_link(o, isoburn_list_start, 1);
00151  return(1);
00152 failed:;
00153  isoburn_destroy(objpt, 0);
00154  return(-1);
00155 }

int isoburn_prepare_blind_grow ( struct burn_drive *  in_drive,
struct burn_disc **  disc,
struct isoburn_imgen_opts opts,
struct burn_drive *  out_drive,
int  nwa 
)

To choose the expansion method of Blind Growing: Create a disc object for writing an add-on session from the created or loaded IsoImage which has been manipulated via libisofs, to a different drive than the one from where it was loaded.

Usually output will be stdio:/dev/fd/1 (i.e. stdout) being piped into some burn program like with this classic gesture: mkisofs -M $dev -C $msc1,$nwa | cdrecord -waiti dev=$dev Parameter translation into libisoburn: $dev is the address by which parameter in_drive of this call was aquired $msc1 was set by isoburn_set_msc1() before image reading or was detected from the in_drive media $nwa is a parameter of this call or can be used as detected from the in_drive media

This call waits for libisofs output to become available and then detaches the input drive object from the data source object by which libisofs was reading from the input drive. So, as far as libisofs is concerned, that drive may be released immediately after this call in order to allow the consumer to access the drive for writing. The consumer should wait for input to become available and only then open its burn drive. With cdrecord this is caused by option -waiti.

The resulting burn_disc object has to be disposed when all its writing is done and the drive is BURN_DRIVE_IDLE again after asynchronous burn_disc_write().

Since:
0.2.2
Parameters:
in_drive The input drive,grabbed with isoburn_drive_scan_and_grab().
disc Returns the newly created burn_disc object.
opts Options for image generation and data transport to media.
out_drive The output drive, from isoburn_drive_aquire() et.al.. typically stdio:/dev/fd/1 .
nwa The address (2048 byte block count) where the add-on session will be finally stored on a mountable media or in a mountable file. If nwa is -1 then the address is used as determined from the in_drive media.
Returns:
<=0 error , 1 = success

Definition at line 544 of file isoburn.c.

References isoburn::fabricated_msc2, isoburn_find_emulator(), isoburn_prepare_disc_aux(), isoburn::nwa, and isoburn::zero_nwa.

00547 {  
00548  int ret;
00549  struct isoburn *o= NULL;
00550 
00551  ret= isoburn_find_emulator(&o, out_drive, 0);
00552  if(ret<0 || o==NULL)
00553    return(-1);
00554  if(nwa >= 0)
00555    o->fabricated_msc2= nwa;
00556  if(o->nwa == o->zero_nwa)
00557    o->nwa= o->zero_nwa= 0;
00558  else
00559    o->zero_nwa= 0;
00560  ret= isoburn_prepare_disc_aux(d, out_drive, disc, opts, 2);
00561  if (ret<=0)
00562    return ret;
00563  return(1);
00564 }

int isoburn_prepare_disc ( struct burn_drive *  drive,
struct burn_disc **  disc,
struct isoburn_imgen_opts opts 
)

To choose the expansion method of Growing: Create a disc object for writing the new session from the created or loaded iso_volset which has been manipulated via libisofs, to the same media from where the image was eventually loaded.

This struct burn_disc is ready for use by a subsequent call to isoburn_disc_write(). After this asynchronous writing has ended and the drive is BURN_DRIVE_IDLE again, the burn_disc object has to be disposed by burn_disc_free().

Since:
0.1.0
Parameters:
drive The combined source and target drive, grabbed with isoburn_drive_scan_and_grab(). .
disc Returns the newly created burn_disc object.
opts Image generation options, see isoburn_igopt_*()
Returns:
<=0 error , 1 = success

Definition at line 523 of file isoburn.c.

References isoburn_prepare_disc_aux().

00525 {
00526  return isoburn_prepare_disc_aux(d, d, disc, opts, 0);
00527 }

static int isoburn_prepare_disc_aux ( struct burn_drive *  in_d,
struct burn_drive *  out_d,
struct burn_disc **  disc,
struct isoburn_imgen_opts opts,
int  flag 
) [static]

Definition at line 348 of file isoburn.c.

References isoburn_imgen_opts::aaip, isoburn_imgen_opts::aaip_susp_1_10, isoburn_imgen_opts::allow_deep_paths, isoburn_imgen_opts::allow_full_ascii, isoburn_imgen_opts::allow_longer_paths, isoburn_imgen_opts::allow_lowercase, isoburn_imgen_opts::always_gmt, isoburn_imgen_opts::data_start_lba, isoburn_imgen_opts::dir_mode, isoburn_imgen_opts::dir_rec_mtime, isoburn_imgen_opts::effective_lba, isoburn_imgen_opts::fifo_size, isoburn_imgen_opts::file_md5, isoburn_imgen_opts::file_mode, isoburn_imgen_opts::gid, isoburn_imgen_opts::hardlinks, isoburn::image, isoburn_imgen_opts::iso1999, isoburn::iso_data_source, isoburn::iso_source, isoburn_data_source_shutdown(), isoburn_disc_get_status(), isoburn_disc_track_lba_nwa(), isoburn_find_emulator(), isoburn_get_msc2(), isoburn_msgs_submit(), isoburn_report_iso_error(), isoburn_imgen_opts::joliet, isoburn_imgen_opts::joliet_longer_paths, isoburn_imgen_opts::level, isoburn_imgen_opts::max_37_char_filenames, isoburn_imgen_opts::no_force_dots, isoburn::nwa, isoburn_imgen_opts::omit_version_numbers, isoburn_imgen_opts::output_charset, isoburn_imgen_opts::replace_dir_mode, isoburn_imgen_opts::replace_file_mode, isoburn_imgen_opts::replace_gid, isoburn_imgen_opts::replace_uid, isoburn_imgen_opts::rockridge, isoburn_imgen_opts::rrip_version_1_10, isoburn_imgen_opts::scdbackup_tag_name, isoburn_imgen_opts::scdbackup_tag_time, isoburn_imgen_opts::scdbackup_tag_written, isoburn_imgen_opts::session_md5, isoburn_imgen_opts::sort_files, isoburn::target_iso_head, isoburn_imgen_opts::uid, and isoburn::wrote_well.

Referenced by isoburn_prepare_blind_grow(), isoburn_prepare_disc(), and isoburn_prepare_new_image().

00351 {
00352  struct burn_source *wsrc;
00353  struct burn_session *session;
00354  struct burn_track *track;
00355  struct isoburn *in_o, *out_o;
00356  IsoWriteOpts *wopts= NULL;
00357  enum burn_disc_status state;
00358  int ret, fifo_chunks, lba, nwa, i, new_img, early_indev_release;
00359  uint32_t data_start= -1;
00360  size_t buffer_size= 0, buffer_free= 0;
00361  char msg[160];
00362 
00363  new_img= flag&1;
00364  early_indev_release= flag&2;
00365 
00366  ret= isoburn_find_emulator(&in_o, in_d, 0);
00367  if(ret<0 || in_o==NULL)
00368    {ret= -1; goto ex;}
00369  ret= isoburn_find_emulator(&out_o, out_d, 0);
00370  if(ret<0 || out_o==NULL)
00371    {ret= -1; goto ex;}
00372  /* early end will be registered as failure */
00373  in_o->wrote_well= out_o->wrote_well= 0;
00374 
00375  if(new_img && early_indev_release) {
00376    isoburn_msgs_submit(in_o, 0x00060000,
00377       "Programming error: Wrong session setup: new_img && early_indev_release",
00378                        0, "FATAL", 0);
00379    {ret= -4; goto ex;}
00380  }
00381 
00382  state = isoburn_disc_get_status(in_d);
00383  if (state != BURN_DISC_BLANK && state != BURN_DISC_APPENDABLE &&
00384      state != BURN_DISC_FULL) {
00385    isoburn_msgs_submit(in_o, 0x00060000, "Unsuitable source media state",
00386                     0, "FAILURE", 0);
00387    {ret= -2; goto ex;}
00388  }
00389  state = isoburn_disc_get_status(out_d);
00390  if (state != BURN_DISC_BLANK && state != BURN_DISC_APPENDABLE) {
00391    isoburn_msgs_submit(out_o, 0x00060000, "Unsuitable target media state",
00392                     0, "FAILURE", 0);
00393    {ret= -2; goto ex;}
00394  }
00395  
00396  fifo_chunks= 32;
00397  if(opts->fifo_size >= 64*1024 && opts->fifo_size <= 1024.0 * 1024.0 * 1024.0){
00398    fifo_chunks= opts->fifo_size/2048;
00399    if(fifo_chunks*2048 < opts->fifo_size)
00400      fifo_chunks++;
00401  }
00402 
00403  ret = iso_write_opts_new(&wopts, 0);
00404  if (ret < 0) {
00405    isoburn_report_iso_error(ret, "Cannot create iso_write_opts", 0, "FATAL",0);
00406    goto ex;
00407  }
00408  iso_write_opts_set_iso_level(wopts, opts->level);
00409  iso_write_opts_set_rockridge(wopts, opts->rockridge);
00410  iso_write_opts_set_joliet(wopts, opts->joliet);
00411  iso_write_opts_set_iso1999(wopts, opts->iso1999);
00412 
00413  /* <<< #ifdef  shall be removed when libisofs-0.6.20 is released */
00414 #ifdef Libisofs_hardlink_prooF
00415 
00416  iso_write_opts_set_hardlinks(wopts, opts->hardlinks);
00417  if(opts->hardlinks)
00418    iso_write_opts_set_rrip_1_10_px_ino(wopts, 1);
00419 
00420 #endif
00421 
00422  iso_write_opts_set_aaip(wopts, opts->aaip);
00423  iso_write_opts_set_omit_version_numbers(wopts, opts->omit_version_numbers);
00424  iso_write_opts_set_allow_deep_paths(wopts, opts->allow_deep_paths);
00425  iso_write_opts_set_allow_longer_paths(wopts, opts->allow_longer_paths);
00426  iso_write_opts_set_max_37_char_filenames(wopts, opts->max_37_char_filenames);
00427  iso_write_opts_set_no_force_dots(wopts, opts->no_force_dots);
00428  iso_write_opts_set_allow_lowercase(wopts, opts->allow_lowercase);
00429  iso_write_opts_set_allow_full_ascii(wopts, opts->allow_full_ascii);
00430  iso_write_opts_set_relaxed_vol_atts(wopts, 1);
00431  iso_write_opts_set_joliet_longer_paths(wopts, opts->joliet_longer_paths);
00432  iso_write_opts_set_always_gmt(wopts, opts->always_gmt);
00433  iso_write_opts_set_rrip_version_1_10(wopts, opts->rrip_version_1_10);
00434  iso_write_opts_set_dir_rec_mtime(wopts, opts->dir_rec_mtime);
00435  iso_write_opts_set_aaip_susp_1_10(wopts, opts->aaip_susp_1_10);
00436  iso_write_opts_set_sort_files(wopts, opts->sort_files);
00437  iso_write_opts_set_record_md5(wopts, opts->session_md5, opts->file_md5 & 3);
00438  if(opts->scdbackup_tag_name[0] && opts->scdbackup_tag_time[0])
00439    iso_write_opts_set_scdbackup_tag(wopts, opts->scdbackup_tag_name,
00440                                     opts->scdbackup_tag_time,
00441                                     opts->scdbackup_tag_written);
00442  iso_write_opts_set_replace_mode(wopts, opts->replace_dir_mode,
00443                 opts->replace_file_mode, opts->replace_uid, opts->replace_gid);
00444  iso_write_opts_set_default_dir_mode(wopts, opts->dir_mode);
00445  iso_write_opts_set_default_file_mode(wopts, opts->file_mode);
00446  iso_write_opts_set_default_uid(wopts, opts->uid);
00447  iso_write_opts_set_default_gid(wopts, opts->gid);
00448  iso_write_opts_set_output_charset(wopts, opts->output_charset);
00449  iso_write_opts_set_fifo_size(wopts, fifo_chunks);
00450 
00451  ret = isoburn_disc_track_lba_nwa(out_d, NULL, 0, &lba, &nwa);
00452  opts->effective_lba= nwa;
00453  ret= isoburn_get_msc2(out_o, NULL, &nwa, 0);
00454  if (ret != 1) {
00455    isoburn_msgs_submit(out_o, 0x00060000,
00456                    "Cannot determine next writeable address", 0, "FAILURE", 0);
00457    {ret= -3; goto ex;}
00458  }
00459  iso_write_opts_set_ms_block(wopts, nwa);
00460  iso_write_opts_set_appendable(wopts, !new_img);
00461  iso_write_opts_set_overwrite_buf(wopts,
00462                                   nwa>0 ? out_o->target_iso_head : NULL);
00463 
00464  ret = iso_image_create_burn_source(in_o->image, wopts, &wsrc);
00465  if (ret < 0) {
00466    isoburn_report_iso_error(ret, "Cannot create burn source", 0, "FAILURE", 0);
00467    {ret= -1; goto ex;}
00468  }
00469  if (early_indev_release) {
00470    for(i= 0; i<300; i++) {
00471 
00472      /* <<< ??? */
00473      if((i%30) == 0) {
00474        sprintf(msg, "Waiting for data in fifo since %d seconds", i/30);
00475        isoburn_msgs_submit(in_o, 0x00060000, msg, 0, "DEBUG", 0);
00476      }
00477 
00478      usleep(100000);
00479      ret= iso_ring_buffer_get_status(wsrc, &buffer_size, &buffer_free);
00480      if(ret >0 && buffer_size != buffer_free)
00481    break;
00482    }
00483 
00484    /* <<< ??? */
00485    sprintf(msg,
00486            "After %.1f seconds: %d bytes of output available (fifo state=%d)",
00487            ((double) i+1) / 10.0, (int) (buffer_size - buffer_free), ret);
00488    isoburn_msgs_submit(in_o, 0x00060000, msg, 0, "DEBUG", 0);
00489 
00490    if(in_o->iso_data_source!=NULL)
00491      isoburn_data_source_shutdown(in_o->iso_data_source, 0);
00492  }
00493 
00494  ret= iso_write_opts_get_data_start(wopts, &data_start, 0);
00495  opts->data_start_lba= -1;
00496  if(ret > 0 && data_start <= 0x7FFFFFFF)
00497    opts->data_start_lba= data_start;
00498  
00499  /* TODO check return values for failure. propertly clean-up on error */
00500 
00501  out_o->iso_source= wsrc;
00502 
00503  *disc = burn_disc_create();
00504  session = burn_session_create();
00505  burn_disc_add_session(*disc, session, BURN_POS_END);
00506  track = burn_track_create();
00507  burn_track_set_source(track, out_o->iso_source);
00508  burn_session_add_track(session, track, BURN_POS_END);
00509 
00510  /* give up local references */
00511  burn_track_free(track);
00512  burn_session_free(session);
00513 
00514  in_o->wrote_well= out_o->wrote_well= -1; /* neutral */
00515  ret= 1;
00516 ex:
00517  if(wopts!=NULL)
00518    {iso_write_opts_free(wopts); wopts= NULL;}
00519  return ret;
00520 }

int isoburn_prepare_new_image ( struct burn_drive *  in_drive,
struct burn_disc **  disc,
struct isoburn_imgen_opts opts,
struct burn_drive *  out_drive 
)

To choose the expansion method of Modifying: Create a disc object for producing a new image from a previous image plus the changes made by user.

The generated burn_disc is suitable to be written to a grabbed drive with blank writeable media. But you must not use the same drive for input and output, because data will be read from the source drive while at the same time the target drive is already writing. The resulting burn_disc object has to be disposed when all its writing is done and the drive is BURN_DRIVE_IDLE again after asynchronous burn_disc_write().

Since:
0.1.0
Parameters:
in_drive The input drive, grabbed with isoburn_drive_aquire() or one of its alternatives.
disc Returns the newly created burn_disc object.
opts Options for image generation and data transport to media.
out_drive The output drive, from isoburn_drive_aquire() et.al..
Returns:
<=0 error , 1 = success

Definition at line 530 of file isoburn.c.

References isoburn_prepare_disc_aux().

00533 {
00534  int ret;
00535 
00536  ret= isoburn_prepare_disc_aux(d, out_drive, disc, opts, 1);
00537  if (ret<=0)
00538    return ret;
00539  return 1; 
00540 }

int isoburn_ropt_destroy ( struct isoburn_read_opts **  o,
int  flag 
)

Deletes an option set which was created by isoburn_ropt_new().

Since:
0.1.0
Parameters:
o The option set to work on
flag Bitfield for control purposes. Submit 0 for now.
Returns:
1= **o destroyed , 0= *o was already NULL (harmless)

Definition at line 680 of file isoburn.c.

00681 {
00682  if(*o==NULL)
00683    return(0);
00684  free(*o);
00685  *o= NULL;
00686  return(1);
00687 }

int isoburn_ropt_get_auto_incharset ( struct isoburn_read_opts o,
int *  mode 
)

Definition at line 785 of file isoburn.c.

References isoburn_read_opts::auto_input_charset.

00786 {
00787  *mode= o->auto_input_charset;
00788  return(1);
00789 }

int isoburn_ropt_get_default_dirperms ( struct isoburn_read_opts o,
mode_t *  mode 
)

Definition at line 754 of file isoburn.c.

References isoburn_read_opts::dirmode.

00756 {
00757  *mode= o->dirmode;
00758  return(1);
00759 }

int isoburn_ropt_get_default_perms ( struct isoburn_read_opts o,
uid_t *  uid,
gid_t *  gid,
mode_t *  mode 
)

Definition at line 736 of file isoburn.c.

References isoburn_read_opts::gid, isoburn_read_opts::mode, and isoburn_read_opts::uid.

00738 {
00739  *uid= o->uid;
00740  *gid= o->gid;
00741  *mode= o->mode;
00742  return(1);
00743 }

int isoburn_ropt_get_extensions ( struct isoburn_read_opts o,
int *  ext 
)

Definition at line 706 of file isoburn.c.

References isoburn_read_opts::noaaip, isoburn_read_opts::noacl, isoburn_read_opts::noea, isoburn_read_opts::noino, isoburn_read_opts::noiso1999, isoburn_read_opts::nojoliet, isoburn_read_opts::nomd5, isoburn_read_opts::norock, isoburn_read_opts::preferjoliet, and isoburn_read_opts::pretend_blank.

00707 {
00708  *ext= (!!o->norock) | ((!!o->nojoliet)<<1) | ((!!o->noiso1999)<<2) |
00709        ((!!o->preferjoliet)<<3) | ((!!o->pretend_blank)<<4) |
00710        ((!!o->noaaip) << 5) | ((!!o->noacl) << 6) | ((!!o->noea) << 7) |
00711        ((!!o->noino) << 8) | ((!!o->nomd5) << 9);
00712  return(1);
00713 }

int isoburn_ropt_get_input_charset ( struct isoburn_read_opts o,
char **  input_charset 
)

Definition at line 770 of file isoburn.c.

References isoburn_read_opts::input_charset.

00772 {
00773  *input_charset= o->input_charset;
00774  return(1);
00775 }

int isoburn_ropt_get_size_what ( struct isoburn_read_opts o,
uint32_t *  size,
int *  has_what 
)

Definition at line 792 of file isoburn.c.

References isoburn_read_opts::hasElTorito, isoburn_read_opts::hasIso1999, isoburn_read_opts::hasJoliet, isoburn_read_opts::hasRR, and isoburn_read_opts::size.

00794 {
00795  *size= o->size;
00796  *has_what= (!!o->hasRR) | ((!!o->hasJoliet)<<1) |
00797             ((!!o->hasIso1999)<<2) | ((!!o->hasElTorito)<<3); 
00798  return(1);
00799 }

int isoburn_ropt_new ( struct isoburn_read_opts **  o,
int  flag 
)

Produces a set of image read options, initialized with default values.

Since:
0.1.0
Parameters:
o the newly created option set object
flag Bitfield for control purposes. Submit 0 for now.
Returns:
1=ok , <0 = failure

Definition at line 646 of file isoburn.c.

References isoburn_read_opts::dirmode, isoburn_read_opts::gid, isoburn_read_opts::hasElTorito, isoburn_read_opts::hasIso1999, isoburn_read_opts::hasJoliet, isoburn_read_opts::hasRR, isoburn_read_opts::input_charset, isoburn_msgs_submit(), isoburn_read_opts::mode, isoburn_read_opts::noaaip, isoburn_read_opts::noacl, isoburn_read_opts::noea, isoburn_read_opts::noino, isoburn_read_opts::noiso1999, isoburn_read_opts::nojoliet, isoburn_read_opts::nomd5, isoburn_read_opts::norock, isoburn_read_opts::preferjoliet, isoburn_read_opts::pretend_blank, isoburn_read_opts::size, and isoburn_read_opts::uid.

00647 {
00648  struct isoburn_read_opts *o;
00649 
00650  o= (*new_o)= calloc(1, sizeof(struct isoburn_read_opts));
00651  if(o==NULL) {
00652    isoburn_msgs_submit(NULL, 0x00060000,
00653                      "Cannot allocate memory for read options", 0, "FATAL", 0);
00654    return(-1);
00655  }
00656  o->norock= 0;
00657  o->nojoliet= 0;
00658  o->noiso1999= 1;
00659  o->noaaip= 1;
00660  o->noacl= 1;
00661  o->noea= 1;
00662  o->noino= 1;
00663  o->nomd5= 1;
00664  o->preferjoliet= 0;
00665  o->uid= geteuid();
00666  o->gid= getegid();
00667  o->mode= 0444;
00668  o->dirmode= 0555;
00669  o->input_charset= NULL;
00670  o->hasRR= 0;
00671  o->hasJoliet= 0;
00672  o->hasIso1999= 0;
00673  o->hasElTorito= 0;
00674  o->size= 0;
00675  o->pretend_blank= 1;
00676  return(1);
00677 }

int isoburn_ropt_set_auto_incharset ( struct isoburn_read_opts o,
int  mode 
)

Enable or disable methods to automatically choose an input charset.

This eventually overrides the name set via isoburn_ropt_set_input_charset()

Since:
0.3.8
Parameters:
o The option set to work on
mode Bitfield for control purposes: bit0= allow to set the input character set automatically from attribute "isofs.cs" of root directory. Submit any other bits with value 0.
Returns:
1 success, <=0 failure

Definition at line 778 of file isoburn.c.

References isoburn_read_opts::auto_input_charset.

00779 {
00780  o->auto_input_charset= mode & 1;
00781  return(1);
00782 }

int isoburn_ropt_set_default_dirperms ( struct isoburn_read_opts o,
mode_t  mode 
)

Default attributes to use on directories if no RockRidge extension gets loaded.

Above call isoburn_ropt_set_default_perms() automatically adds x-permissions to r-permissions for directories. This call here may be done afterwards to set independend permissions for directories, especially to override the automatically added x-permissions.

Since:
0.1.0
Parameters:
o The option set to work on
mode permissions (not file type) as of man 2 stat.
Returns:
1 success, <=0 failure

Definition at line 746 of file isoburn.c.

References isoburn_read_opts::dirmode.

00748 {
00749  o->dirmode= mode;
00750  return(1);
00751 }

int isoburn_ropt_set_default_perms ( struct isoburn_read_opts o,
uid_t  uid,
gid_t  gid,
mode_t  mode 
)

Default attributes to use if no RockRidge extension gets loaded.

Since:
0.1.0
Parameters:
o The option set to work on
uid user id number (see /etc/passwd)
gid group id number (see /etc/group)
mode permissions (not file type) as of man 2 stat. With directories, r-permissions will automatically imply x-permissions. See isoburn_ropt_set_default_dirperms() below.
Returns:
1 success, <=0 failure

Definition at line 716 of file isoburn.c.

References isoburn_read_opts::dirmode, isoburn_read_opts::gid, isoburn_read_opts::mode, and isoburn_read_opts::uid.

00718 {
00719  mode_t dirmode;
00720 
00721  o->uid= uid;
00722  o->gid= gid;
00723  o->mode= mode;
00724  dirmode= mode;
00725  if(dirmode & S_IRUSR)
00726    dirmode|= S_IXUSR;
00727  if(dirmode & S_IRGRP)
00728    dirmode|= S_IXGRP;
00729  if(dirmode & S_IROTH)
00730    dirmode|= S_IXOTH;
00731  o->dirmode= dirmode;
00732  return(1);
00733 }

int isoburn_ropt_set_extensions ( struct isoburn_read_opts o,
int  ext 
)

Definition at line 690 of file isoburn.c.

References isoburn_read_opts::noaaip, isoburn_read_opts::noacl, isoburn_read_opts::noea, isoburn_read_opts::noino, isoburn_read_opts::noiso1999, isoburn_read_opts::nojoliet, isoburn_read_opts::nomd5, isoburn_read_opts::norock, isoburn_read_opts::preferjoliet, and isoburn_read_opts::pretend_blank.

00691 {
00692  o->norock= !!(ext&1);
00693  o->nojoliet= !!(ext&2);
00694  o->noiso1999= !!(ext&4);
00695  o->preferjoliet= !!(ext&8);
00696  o->pretend_blank= !!(ext&16);
00697  o->noaaip= !!(ext & 32);
00698  o->noacl= !!(ext & 64);
00699  o->noea= !!(ext & 128);
00700  o->noino= !!(ext & 256);
00701  o->nomd5= !!(ext & 512);
00702  return(1);
00703 }

int isoburn_ropt_set_input_charset ( struct isoburn_read_opts o,
char *  input_charset 
)

Set the character set for reading RR file names from ISO images.

Since:
0.1.0
Parameters:
o The option set to work on
input_charset Set this to NULL to use the default locale charset For selecting a particular character set, submit its name, e.g. as listed by program iconv -l. Example: "UTF-8".
Returns:
1 success, <=0 failure

Definition at line 762 of file isoburn.c.

References isoburn_read_opts::input_charset.

00764 {
00765  o->input_charset= input_charset;
00766  return(1);
00767 }

int isoburn_sync_after_write ( struct burn_drive *  input_drive,
struct burn_drive *  output_drive,
int  flag 
)

Wait after normal end of operations until libisofs ended all write threads and freed resource reservations.

This call is not mandatory. But without it, messages from the ending threads might appear after the application ended its write procedure.

Since:
0.1.0
Parameters:
input_drive The drive resp. in_drive which was used with the preparation call.
output_drive The out_drive used with isoburn_prepare_new_image(), NULL if none.
flag Bitfield, submit 0 for now.
Returns:
<=0 error , 1 = success

Definition at line 605 of file isoburn.c.

References isoburn_cancel_prepared_write().

00607 {
00608  return isoburn_cancel_prepared_write(d, output_drive, 1);
00609 }

int isoburn_toc_entry_destroy ( struct isoburn_toc_entry **  o,
int  flag 
)

Definition at line 83 of file isoburn.c.

References isoburn_toc_entry_destroy().

Referenced by isoburn_destroy(), isoburn_emulate_toc(), and isoburn_toc_entry_destroy().

00084 {
00085  if(*o==NULL)
00086    return(0);
00087  if(flag&1)
00088    isoburn_toc_entry_destroy(&((*o)->next), flag);
00089  if((*o)->volid != NULL)
00090    free((*o)->volid);
00091  free((char *) (*o));   
00092  *o= NULL;
00093  return(1);
00094 }

int isoburn_toc_entry_new ( struct isoburn_toc_entry **  objpt,
struct isoburn_toc_entry boss,
int  flag 
)

Definition at line 54 of file isoburn.c.

References isoburn_msgs_submit(), isoburn_toc_entry::next, isoburn_toc_entry::session, isoburn_toc_entry::start_lba, isoburn_toc_entry::track_blocks, isoburn_toc_entry::track_no, and isoburn_toc_entry::volid.

Referenced by isoburn_make_toc_entry().

00056 {
00057  struct isoburn_toc_entry *o, *s;
00058 
00059  *objpt= o= (struct isoburn_toc_entry *)
00060             malloc(sizeof(struct isoburn_toc_entry));
00061  if(o==NULL) {
00062    isoburn_msgs_submit(NULL, 0x00060000,
00063                        "Cannot allocate memory for isoburn toc entry",
00064                        0, "FATAL", 0);
00065    return(-1);
00066  }
00067  o->session= 0;
00068  o->track_no= 0;
00069  o->start_lba= -1;
00070  o->track_blocks= 0;
00071  o->volid= NULL;
00072  o->next= NULL;
00073  if(boss!=NULL) {
00074    for(s= boss; s->next!=NULL; s= s->next);
00075    s->next= o;
00076  }
00077  return(1);
00078 }

void isoburn_version ( int *  major,
int *  minor,
int *  micro 
)

Obtain the three release version numbers of the library.

These are the numbers encountered by the application when linking with libisoburn, i.e. possibly not before run time. Better do not base the fundamental compatibility decision of an application on these numbers. For a reliable check use isoburn_is_compatible().

Since:
0.1.0
Parameters:
major The maturity version (0 for now, as we are still learning)
minor The development goal version.
micro The development step version. This has an additional meaning:

Pare numbers indicate a version with frozen API. I.e. you can rely on the same set of features to be present in all published releases with that major.minor.micro combination. Features of a pare release will stay available and ABI compatible as long as the SONAME of libisoburn stays "1". Currently there are no plans to ever change the SONAME.

Odd numbers indicate that API upgrades are in progress. I.e. new features might be already present or they might be still missing. Newly introduced features may be changed incompatibly or even be revoked before release of a pare version. So micro revisions {1,3,5,7,9} should never be used for dynamic linking unless the proper library match can be guaranteed by external circumstances.

Returns:
1 success, <=0 might in future become an error indication

Definition at line 612 of file isoburn.c.

References isoburn_header_version_major, isoburn_header_version_micro, and isoburn_header_version_minor.

Referenced by isoburn_initialize(), and isoburn_is_compatible().

00613 {
00614  *major= isoburn_header_version_major;
00615  *minor= isoburn_header_version_minor;
00616  *micro= isoburn_header_version_micro;
00617 
00618 /* No more: values from version.h generated from version.h.in and
00619             macro values defined in configure.ac
00620 
00621  *major = ISOBURN_MAJOR_VERSION;
00622  *minor = ISOBURN_MINOR_VERSION;
00623  *micro = ISOBURN_MICRO_VERSION;
00624 */
00625 }


Variable Documentation

struct isoburn* isoburn_list_start = NULL

Definition at line 106 of file isoburn.c.

int(* libisoburn_default_msgs_submit)(void *handle, int error_code, char msg_text[], int os_errno, char severity[], int flag) = NULL

Definition at line 48 of file isoburn.c.

Referenced by isoburn_msgs_submit(), isoburn_set_msgs_submit(), and isoburn_welcome_media().

Definition at line 47 of file isoburn.c.

Referenced by isoburn_msgs_submit(), isoburn_set_msgs_submit(), and isoburn_welcome_media().


Generated by  doxygen 1.6.2