trunk/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.

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

References isoburn::iso_source, and isoburn_find_emulator().

Referenced by isoburn_sync_after_write().

00546 {
00547  int ret;
00548  struct isoburn *o= NULL;
00549 
00550  if(output_drive!=NULL) {
00551    ret= isoburn_find_emulator(&o, output_drive, 0);
00552    if(ret<0 || o==NULL)
00553      o= NULL;
00554    else if(o->iso_source==NULL)
00555      o= NULL;
00556  }
00557  if(o==NULL) {
00558    ret= isoburn_find_emulator(&o, d, 0);
00559    if(ret<0)
00560      return(-1);
00561    if(o==NULL)
00562      return(0);
00563    if(o->iso_source==NULL)
00564      return(0);
00565  }
00566  if(o->iso_source->read!=NULL)
00567    return(0);
00568  if(o->iso_source->version<1)
00569    return(0);
00570  o->iso_source->cancel(o->iso_source);
00571  burn_source_free(o->iso_source);
00572  o->iso_source= NULL;
00573  return(1);
00574 }

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

00799 {
00800  if(*o==NULL)
00801    return(0);
00802  free(*o);
00803  *o= NULL;
00804  return(1);
00805 }

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

References isoburn_imgen_opts::effective_lba.

00957 {
00958  *lba= o->effective_lba;
00959  return(1);
00960 }

int isoburn_igopt_get_extensions ( struct isoburn_imgen_opts o,
int *  ext 
)

Definition at line 831 of file isoburn.c.

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

00832 {
00833  *ext= (!!o->rockridge) | ((!!o->joliet)<<1) | ((!!o->iso1999)<<2);
00834  return(1);
00835 }

int isoburn_igopt_get_fifo_size ( struct isoburn_imgen_opts o,
int *  fifo_size 
)

Definition at line 949 of file isoburn.c.

References isoburn_imgen_opts::fifo_size.

00950 {
00951  *fifo_size= o->fifo_size;
00952  return(1);
00953 }

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

Definition at line 731 of file isoburn.c.

References isoburn_read_opts::input_charset.

00733 {
00734  *input_charset= o->input_charset;
00735  return(1);
00736 }

int isoburn_igopt_get_level ( struct isoburn_imgen_opts o,
int *  level 
)

Definition at line 815 of file isoburn.c.

References isoburn_imgen_opts::level.

00816 {
00817  *level= o->level;
00818  return(1);
00819 }

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

Definition at line 934 of file isoburn.c.

References isoburn_imgen_opts::output_charset.

00936 {
00937  *output_charset= o->output_charset;
00938  return(1);
00939 }

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

00894 {
00895  *replace_dir_mode= o->replace_dir_mode%3;
00896  *replace_file_mode= o->replace_file_mode%3;
00897  *dir_mode= o->dir_mode;
00898  *file_mode= o->file_mode;
00899  return(1);
00900 }

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

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

00917 {
00918  *replace_uid= o->replace_uid%3;
00919  *replace_gid= o->replace_gid%3;
00920  *uid= o->uid;
00921  *gid= o->gid;
00922  return(1);
00923 }

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

References isoburn_imgen_opts::sort_files.

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

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

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

00757 {
00758  struct isoburn_imgen_opts *o;
00759 
00760  o= (*new_o)= calloc(1, sizeof(struct isoburn_imgen_opts));
00761  if(o==NULL) {
00762    isoburn_msgs_submit(NULL, 0x00060000,
00763                        "Cannot allocate memory for image generation options",
00764                        0, "FATAL", 0);
00765    return(-1);
00766  }
00767  o->level= 2;
00768  o->rockridge= 1;
00769  o->joliet= 0;
00770  o->iso1999= 0;
00771  o->omit_version_numbers= 0;
00772  o->allow_deep_paths= 1;
00773  o->allow_longer_paths= 0;
00774  o->max_37_char_filenames= 0;
00775  o->no_force_dots= 0;
00776  o->allow_lowercase= 0;
00777  o->allow_full_ascii= 0;
00778  o->joliet_longer_paths= 0;
00779  o->always_gmt= 0;
00780  o->rrip_version_1_10= 0;
00781  o->dir_rec_mtime= 0;
00782  o->sort_files= 0;
00783  o->replace_dir_mode= 0;
00784  o->replace_file_mode= 0;
00785  o->replace_uid= 0;
00786  o->replace_gid= 0;
00787  o->dir_mode= 0555;
00788  o->file_mode= 0444;
00789  o->uid= 0;
00790  o->gid= 0;
00791  o->output_charset= NULL;
00792  o->fifo_size= 4*1024*1024;
00793  o->effective_lba= -1;
00794  return(1);
00795 }

int isoburn_igopt_set_extensions ( struct isoburn_imgen_opts o,
int  ext 
)

Definition at line 822 of file isoburn.c.

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

00823 {
00824  o->rockridge= !!(ext&1);
00825  o->joliet= !!(ext&2);
00826  o->iso1999= !!(ext&4);
00827  return(1);
00828 }

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

References isoburn_imgen_opts::fifo_size.

00943 {
00944  o->fifo_size= fifo_size;
00945  return(1);
00946 }

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

References isoburn_imgen_opts::level.

00809 {
00810  o->level= level;
00811  return(1);
00812 }

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

References isoburn_imgen_opts::output_charset.

00928 {
00929  o->output_charset= output_charset;
00930  return(1);
00931 }

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

00882 {
00883  o->replace_dir_mode= replace_dir_mode%3;
00884  o->replace_file_mode= replace_file_mode%3;
00885  o->dir_mode= dir_mode;
00886  o->file_mode= file_mode;
00887  return(1);
00888 }

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

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

00906 {
00907  o->replace_uid= replace_uid%3;
00908  o->replace_gid= replace_gid%3;
00909  o->uid= uid;
00910  o->gid= gid;
00911  return(1);
00912 }

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

References isoburn_imgen_opts::sort_files.

00866 {
00867  o->sort_files= !!(value&1);
00868  return(1);
00869 }

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

References isoburn_version().

00602 {
00603  int own_major, own_minor, own_micro;
00604 
00605  isoburn_version(&own_major, &own_minor, &own_micro);
00606  return(own_major > major ||
00607         (own_major == major && (own_minor > minor ||
00608          (own_minor == minor && own_micro >= micro))));
00609 }

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

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

00520 {  
00521  int ret;
00522  struct isoburn *o= NULL;
00523 
00524  ret= isoburn_find_emulator(&o, out_drive, 0);
00525  if(ret<0 || o==NULL)
00526    return(-1);
00527  if(nwa >= 0)
00528    o->fabricated_msc2= nwa;
00529  if(o->nwa == o->zero_nwa)
00530    o->nwa= o->zero_nwa= 0;
00531  else
00532    o->zero_nwa= 0;
00533  ret= isoburn_prepare_disc_aux(d, out_drive, disc, opts, 2);
00534  if (ret<=0)
00535    return ret;
00536  return(1);
00537 }

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

References isoburn_prepare_disc_aux().

Referenced by main().

00498 {
00499  return isoburn_prepare_disc_aux(d, d, disc, opts, 0);
00500 }

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

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

References isoburn_prepare_disc_aux().

00506 {
00507  int ret;
00508 
00509  ret= isoburn_prepare_disc_aux(d, out_drive, disc, opts, 1);
00510  if (ret<=0)
00511    return ret;
00512  return 1; 
00513 }

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

00649 {
00650  if(*o==NULL)
00651    return(0);
00652  free(*o);
00653  *o= NULL;
00654  return(1);
00655 }

int isoburn_ropt_get_default_dirperms ( struct isoburn_read_opts o,
mode_t *  mode 
)

Definition at line 715 of file isoburn.c.

References isoburn_read_opts::dirmode.

00717 {
00718  *mode= o->dirmode;
00719  return(1);
00720 }

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

Definition at line 697 of file isoburn.c.

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

00699 {
00700  *uid= o->uid;
00701  *gid= o->gid;
00702  *mode= o->mode;
00703  return(1);
00704 }

int isoburn_ropt_get_extensions ( struct isoburn_read_opts o,
int *  ext 
)

Definition at line 669 of file isoburn.c.

References isoburn_read_opts::noiso1999, isoburn_read_opts::nojoliet, isoburn_read_opts::norock, isoburn_read_opts::preferjoliet, and isoburn_read_opts::pretend_blank.

00670 {
00671  *ext= (!!o->norock) | ((!!o->nojoliet)<<1) | ((!!o->noiso1999)<<2) |
00672        ((!!o->preferjoliet)<<3) | ((!!o->pretend_blank)<<4);
00673  return(1);
00674 }

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

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

00741 {
00742  *size= o->size;
00743  *has_what= (!!o->hasRR) | ((!!o->hasJoliet)<<1) |
00744             ((!!o->hasIso1999)<<2) | ((!!o->hasElTorito)<<3); 
00745  return(1);
00746 }

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

00620 {
00621  struct isoburn_read_opts *o;
00622 
00623  o= (*new_o)= calloc(1, sizeof(struct isoburn_read_opts));
00624  if(o==NULL) {
00625    isoburn_msgs_submit(NULL, 0x00060000,
00626                      "Cannot allocate memory for read options", 0, "FATAL", 0);
00627    return(-1);
00628  }
00629  o->norock= 0;
00630  o->nojoliet= 0;
00631  o->noiso1999= 1;
00632  o->preferjoliet= 0;
00633  o->uid= geteuid();
00634  o->gid= getegid();
00635  o->mode= 0444;
00636  o->dirmode= 0555;
00637  o->input_charset= NULL;
00638  o->hasRR= 0;
00639  o->hasJoliet= 0;
00640  o->hasIso1999= 0;
00641  o->hasElTorito= 0;
00642  o->size= 0;
00643  o->pretend_blank= 1;
00644  return(1);
00645 }

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

References isoburn_read_opts::dirmode.

00709 {
00710  o->dirmode= mode;
00711  return(1);
00712 }

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

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

00679 {
00680  mode_t dirmode;
00681 
00682  o->uid= uid;
00683  o->gid= gid;
00684  o->mode= mode;
00685  dirmode= mode;
00686  if(dirmode & S_IRUSR)
00687    dirmode|= S_IXUSR;
00688  if(dirmode & S_IRGRP)
00689    dirmode|= S_IXGRP;
00690  if(dirmode & S_IROTH)
00691    dirmode|= S_IXOTH;
00692  o->dirmode= dirmode;
00693  return(1);
00694 }

int isoburn_ropt_set_extensions ( struct isoburn_read_opts o,
int  ext 
)

Definition at line 658 of file isoburn.c.

References isoburn_read_opts::noiso1999, isoburn_read_opts::nojoliet, isoburn_read_opts::norock, isoburn_read_opts::preferjoliet, and isoburn_read_opts::pretend_blank.

00659 {
00660  o->norock= !!(ext&1);
00661  o->nojoliet= !!(ext&2);
00662  o->noiso1999= !!(ext&4);
00663  o->preferjoliet= !!(ext&8);
00664  o->pretend_blank= !!(ext&16);
00665  return(1);
00666 }

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

References isoburn_read_opts::input_charset.

00725 {
00726  o->input_charset= input_charset;
00727  return(1);
00728 }

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

References isoburn_cancel_prepared_write().

00580 {
00581  return isoburn_cancel_prepared_write(d, output_drive, 1);
00582 }

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

00586 {
00587  *major= isoburn_header_version_major;
00588  *minor= isoburn_header_version_minor;
00589  *micro= isoburn_header_version_micro;
00590 
00591 /* No more: values from version.h generated from version.h.in and
00592             macro values defined in configure.ac
00593 
00594  *major = ISOBURN_MAJOR_VERSION;
00595  *minor = ISOBURN_MINOR_VERSION;
00596  *micro = ISOBURN_MICRO_VERSION;
00597 */
00598 }


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 Thu Jan 1 04:46:58 2009 for libisoburn by  doxygen 1.5.6