libisoburn-0.3.4/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_igopt_get_in_charset (struct isoburn_read_opts *o, char **input_charset)
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.

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 277 of file isoburn.c.

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

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

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 557 of file isoburn.c.

References isoburn::iso_source, and isoburn_find_emulator().

Referenced by isoburn_sync_after_write().

00559 {
00560  int ret;
00561  struct isoburn *o= NULL;
00562 
00563  if(output_drive!=NULL) {
00564    ret= isoburn_find_emulator(&o, output_drive, 0);
00565    if(ret<0 || o==NULL)
00566      o= NULL;
00567    else if(o->iso_source==NULL)
00568      o= NULL;
00569  }
00570  if(o==NULL) {
00571    ret= isoburn_find_emulator(&o, d, 0);
00572    if(ret<0)
00573      return(-1);
00574    if(o==NULL)
00575      return(0);
00576    if(o->iso_source==NULL)
00577      return(0);
00578  }
00579  if(o->iso_source->read!=NULL)
00580    return(0);
00581  if(o->iso_source->version<1)
00582    return(0);
00583  o->iso_source->cancel(o->iso_source);
00584  burn_source_free(o->iso_source);
00585  o->iso_source= NULL;
00586  return(1);
00587 }

int isoburn_count ( struct isoburn o,
int  flag 
)

Definition at line 264 of file isoburn.c.

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

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

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

Definition at line 155 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().

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

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

Definition at line 188 of file isoburn.c.

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

Referenced by isoburn_finish(), and isoburn_initialize().

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

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

Definition at line 301 of file isoburn.c.

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

Referenced by isoburn_find_emulator().

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

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

Definition at line 219 of file isoburn.c.

References isoburn::next.

00220 {
00221  *pt= o->next;
00222  return(1);
00223 }

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

Definition at line 212 of file isoburn.c.

References isoburn::prev.

00213 {
00214  *pt= o->prev;
00215  return(1);
00216 }

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

Definition at line 205 of file isoburn.c.

References isoburn::image.

00206 {
00207  *pt= o->image;
00208  return(1);
00209 }

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 820 of file isoburn.c.

00821 {
00822  if(*o==NULL)
00823    return(0);
00824  free(*o);
00825  *o= NULL;
00826  return(1);
00827 }

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.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 990 of file isoburn.c.

References isoburn_imgen_opts::data_start_lba.

00991 {
00992  *lba= o->data_start_lba;
00993  return(1);
00994 }

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 983 of file isoburn.c.

References isoburn_imgen_opts::effective_lba.

00984 {
00985  *lba= o->effective_lba;
00986  return(1);
00987 }

int isoburn_igopt_get_extensions ( struct isoburn_imgen_opts o,
int *  ext 
)

Definition at line 854 of file isoburn.c.

References isoburn_imgen_opts::aaip, isoburn_imgen_opts::iso1999, isoburn_imgen_opts::joliet, and isoburn_imgen_opts::rockridge.

00855 {
00856  *ext= (!!o->rockridge) | ((!!o->joliet)<<1) | ((!!o->iso1999)<<2) |
00857        ((!!o->aaip) << 5);
00858  return(1);
00859 }

int isoburn_igopt_get_fifo_size ( struct isoburn_imgen_opts o,
int *  fifo_size 
)

Definition at line 976 of file isoburn.c.

References isoburn_imgen_opts::fifo_size.

00977 {
00978  *fifo_size= o->fifo_size;
00979  return(1);
00980 }

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

Definition at line 751 of file isoburn.c.

References isoburn_read_opts::input_charset.

00753 {
00754  *input_charset= o->input_charset;
00755  return(1);
00756 }

int isoburn_igopt_get_level ( struct isoburn_imgen_opts o,
int *  level 
)

Definition at line 837 of file isoburn.c.

References isoburn_imgen_opts::level.

00838 {
00839  *level= o->level;
00840  return(1);
00841 }

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

Definition at line 961 of file isoburn.c.

References isoburn_imgen_opts::output_charset.

00963 {
00964  *output_charset= o->output_charset;
00965  return(1);
00966 }

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 918 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.

00921 {
00922  *replace_dir_mode= o->replace_dir_mode%3;
00923  *replace_file_mode= o->replace_file_mode%3;
00924  *dir_mode= o->dir_mode;
00925  *file_mode= o->file_mode;
00926  return(1);
00927 }

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 941 of file isoburn.c.

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

00944 {
00945  *replace_uid= o->replace_uid%3;
00946  *replace_gid= o->replace_gid%3;
00947  *uid= o->uid;
00948  *gid= o->gid;
00949  return(1);
00950 }

int isoburn_igopt_get_relaxed ( struct isoburn_imgen_opts o,
int *  relax 
)

int isoburn_igopt_get_sort_files ( struct isoburn_imgen_opts o,
int *  value 
)

Definition at line 899 of file isoburn.c.

References isoburn_imgen_opts::sort_files.

00900 {
00901  *value= !!o->sort_files;
00902  return(1);
00903 }

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 776 of file isoburn.c.

References 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::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.

00777 {
00778  struct isoburn_imgen_opts *o;
00779 
00780  o= (*new_o)= calloc(1, sizeof(struct isoburn_imgen_opts));
00781  if(o==NULL) {
00782    isoburn_msgs_submit(NULL, 0x00060000,
00783                        "Cannot allocate memory for image generation options",
00784                        0, "FATAL", 0);
00785    return(-1);
00786  }
00787  o->level= 2;
00788  o->rockridge= 1;
00789  o->joliet= 0;
00790  o->iso1999= 0;
00791  o->omit_version_numbers= 0;
00792  o->allow_deep_paths= 1;
00793  o->allow_longer_paths= 0;
00794  o->max_37_char_filenames= 0;
00795  o->no_force_dots= 0;
00796  o->allow_lowercase= 0;
00797  o->allow_full_ascii= 0;
00798  o->joliet_longer_paths= 0;
00799  o->always_gmt= 0;
00800  o->rrip_version_1_10= 0;
00801  o->dir_rec_mtime= 0;
00802  o->aaip_susp_1_10= 0;
00803  o->sort_files= 0;
00804  o->replace_dir_mode= 0;
00805  o->replace_file_mode= 0;
00806  o->replace_uid= 0;
00807  o->replace_gid= 0;
00808  o->dir_mode= 0555;
00809  o->file_mode= 0444;
00810  o->uid= 0;
00811  o->gid= 0;
00812  o->output_charset= NULL;
00813  o->fifo_size= 4*1024*1024;
00814  o->effective_lba= -1;
00815  o->data_start_lba= -1;
00816  return(1);
00817 }

int isoburn_igopt_set_extensions ( struct isoburn_imgen_opts o,
int  ext 
)

Definition at line 844 of file isoburn.c.

References isoburn_imgen_opts::aaip, isoburn_imgen_opts::iso1999, isoburn_imgen_opts::joliet, and isoburn_imgen_opts::rockridge.

00845 {
00846  o->rockridge= !!(ext&1);
00847  o->joliet= !!(ext&2);
00848  o->iso1999= !!(ext&4);
00849  o->aaip= !!(ext & 32);
00850  return(1);
00851 }

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 969 of file isoburn.c.

References isoburn_imgen_opts::fifo_size.

00970 {
00971  o->fifo_size= fifo_size;
00972  return(1);
00973 }

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 830 of file isoburn.c.

References isoburn_imgen_opts::level.

00831 {
00832  o->level= level;
00833  return(1);
00834 }

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 953 of file isoburn.c.

References isoburn_imgen_opts::output_charset.

00955 {
00956  o->output_charset= output_charset;
00957  return(1);
00958 }

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 906 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.

00909 {
00910  o->replace_dir_mode= replace_dir_mode%3;
00911  o->replace_file_mode= replace_file_mode%3;
00912  o->dir_mode= dir_mode;
00913  o->file_mode= file_mode;
00914  return(1);
00915 }

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 930 of file isoburn.c.

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

00933 {
00934  o->replace_uid= replace_uid%3;
00935  o->replace_gid= replace_gid%3;
00936  o->uid= uid;
00937  o->gid= gid;
00938  return(1);
00939 }

int isoburn_igopt_set_relaxed ( struct isoburn_imgen_opts o,
int  relax 
)

int isoburn_igopt_set_sort_files ( struct isoburn_imgen_opts o,
int  value 
)

Definition at line 892 of file isoburn.c.

References isoburn_imgen_opts::sort_files.

00893 {
00894  o->sort_files= !!(value&1);
00895  return(1);
00896 }

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 614 of file isoburn.c.

References isoburn_version().

00615 {
00616  int own_major, own_minor, own_micro;
00617 
00618  isoburn_version(&own_major, &own_minor, &own_micro);
00619  return(own_major > major ||
00620         (own_major == major && (own_minor > minor ||
00621          (own_minor == minor && own_micro >= micro))));
00622 }

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

Definition at line 226 of file isoburn.c.

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

Referenced by isoburn_new().

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

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

Definition at line 315 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(), and isoburn_toc_entry_new().

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

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

Definition at line 106 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().

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

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.

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 530 of file isoburn.c.

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

00533 {  
00534  int ret;
00535  struct isoburn *o= NULL;
00536 
00537  ret= isoburn_find_emulator(&o, out_drive, 0);
00538  if(ret<0 || o==NULL)
00539    return(-1);
00540  if(nwa >= 0)
00541    o->fabricated_msc2= nwa;
00542  if(o->nwa == o->zero_nwa)
00543    o->nwa= o->zero_nwa= 0;
00544  else
00545    o->zero_nwa= 0;
00546  ret= isoburn_prepare_disc_aux(d, out_drive, disc, opts, 2);
00547  if (ret<=0)
00548    return ret;
00549  return(1);
00550 }

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 509 of file isoburn.c.

References isoburn_prepare_disc_aux().

00511 {
00512  return isoburn_prepare_disc_aux(d, d, disc, opts, 0);
00513 }

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 345 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::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::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().

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

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 516 of file isoburn.c.

References isoburn_prepare_disc_aux().

00519 {
00520  int ret;
00521 
00522  ret= isoburn_prepare_disc_aux(d, out_drive, disc, opts, 1);
00523  if (ret<=0)
00524    return ret;
00525  return 1; 
00526 }

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 664 of file isoburn.c.

00665 {
00666  if(*o==NULL)
00667    return(0);
00668  free(*o);
00669  *o= NULL;
00670  return(1);
00671 }

int isoburn_ropt_get_default_dirperms ( struct isoburn_read_opts o,
mode_t *  mode 
)

Definition at line 735 of file isoburn.c.

References isoburn_read_opts::dirmode.

00737 {
00738  *mode= o->dirmode;
00739  return(1);
00740 }

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

Definition at line 717 of file isoburn.c.

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

00719 {
00720  *uid= o->uid;
00721  *gid= o->gid;
00722  *mode= o->mode;
00723  return(1);
00724 }

int isoburn_ropt_get_extensions ( struct isoburn_read_opts o,
int *  ext 
)

Definition at line 688 of file isoburn.c.

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

00689 {
00690  *ext= (!!o->norock) | ((!!o->nojoliet)<<1) | ((!!o->noiso1999)<<2) |
00691        ((!!o->preferjoliet)<<3) | ((!!o->pretend_blank)<<4) |
00692        ((!!o->noaaip) << 5) | ((!!o->noacl) << 6) | ((!!o->noea) << 7);
00693  return(1);
00694 }

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

Definition at line 759 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.

00761 {
00762  *size= o->size;
00763  *has_what= (!!o->hasRR) | ((!!o->hasJoliet)<<1) |
00764             ((!!o->hasIso1999)<<2) | ((!!o->hasElTorito)<<3); 
00765  return(1);
00766 }

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 632 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::noiso1999, isoburn_read_opts::nojoliet, isoburn_read_opts::norock, isoburn_read_opts::preferjoliet, isoburn_read_opts::pretend_blank, isoburn_read_opts::size, and isoburn_read_opts::uid.

00633 {
00634  struct isoburn_read_opts *o;
00635 
00636  o= (*new_o)= calloc(1, sizeof(struct isoburn_read_opts));
00637  if(o==NULL) {
00638    isoburn_msgs_submit(NULL, 0x00060000,
00639                      "Cannot allocate memory for read options", 0, "FATAL", 0);
00640    return(-1);
00641  }
00642  o->norock= 0;
00643  o->nojoliet= 0;
00644  o->noiso1999= 1;
00645  o->noaaip= 1;
00646  o->noacl= 1;
00647  o->noea= 1;
00648  o->preferjoliet= 0;
00649  o->uid= geteuid();
00650  o->gid= getegid();
00651  o->mode= 0444;
00652  o->dirmode= 0555;
00653  o->input_charset= NULL;
00654  o->hasRR= 0;
00655  o->hasJoliet= 0;
00656  o->hasIso1999= 0;
00657  o->hasElTorito= 0;
00658  o->size= 0;
00659  o->pretend_blank= 1;
00660  return(1);
00661 }

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 727 of file isoburn.c.

References isoburn_read_opts::dirmode.

00729 {
00730  o->dirmode= mode;
00731  return(1);
00732 }

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 697 of file isoburn.c.

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

00699 {
00700  mode_t dirmode;
00701 
00702  o->uid= uid;
00703  o->gid= gid;
00704  o->mode= mode;
00705  dirmode= mode;
00706  if(dirmode & S_IRUSR)
00707    dirmode|= S_IXUSR;
00708  if(dirmode & S_IRGRP)
00709    dirmode|= S_IXGRP;
00710  if(dirmode & S_IROTH)
00711    dirmode|= S_IXOTH;
00712  o->dirmode= dirmode;
00713  return(1);
00714 }

int isoburn_ropt_set_extensions ( struct isoburn_read_opts o,
int  ext 
)

Definition at line 674 of file isoburn.c.

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

00675 {
00676  o->norock= !!(ext&1);
00677  o->nojoliet= !!(ext&2);
00678  o->noiso1999= !!(ext&4);
00679  o->preferjoliet= !!(ext&8);
00680  o->pretend_blank= !!(ext&16);
00681  o->noaaip= !!(ext & 32);
00682  o->noacl= !!(ext & 64);
00683  o->noea= !!(ext & 128);
00684  return(1);
00685 }

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 743 of file isoburn.c.

References isoburn_read_opts::input_charset.

00745 {
00746  o->input_charset= input_charset;
00747  return(1);
00748 }

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 591 of file isoburn.c.

References isoburn_cancel_prepared_write().

00593 {
00594  return isoburn_cancel_prepared_write(d, output_drive, 1);
00595 }

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

Definition at line 82 of file isoburn.c.

References isoburn_toc_entry_destroy().

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

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

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, and isoburn_toc_entry::track_no.

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->next= NULL;
00072  if(boss!=NULL) {
00073    for(s= boss; s->next!=NULL; s= s->next);
00074    s->next= o;
00075  }
00076  return(1);
00077 }

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 598 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().

00599 {
00600  *major= isoburn_header_version_major;
00601  *minor= isoburn_header_version_minor;
00602  *micro= isoburn_header_version_micro;
00603 
00604 /* No more: values from version.h generated from version.h.in and
00605             macro values defined in configure.ac
00606 
00607  *major = ISOBURN_MAJOR_VERSION;
00608  *minor = ISOBURN_MINOR_VERSION;
00609  *micro = ISOBURN_MICRO_VERSION;
00610 */
00611 }


Variable Documentation

struct isoburn* isoburn_list_start = NULL

Definition at line 103 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 on Fri May 1 12:03:18 2009 for libisoburn by  doxygen 1.5.8