libisoburn-0.2.2/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_new_image() or isoburn_prepare_disc() 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_new_image() or isoburn_prepare_disc() instead of running isoburn_disc_write().

libisofs reserves resources and maybe already starts generating the image stream when one of above two 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 541 of file isoburn.c.

References isoburn::iso_source, and isoburn_find_emulator().

Referenced by isoburn_sync_after_write().

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

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

00793 {
00794  if(*o==NULL)
00795    return(0);
00796  free(*o);
00797  *o= NULL;
00798  return(1);
00799 }

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

References isoburn_imgen_opts::effective_lba.

00948 {
00949  *lba= o->effective_lba;
00950  return(1);
00951 }

int isoburn_igopt_get_extensions ( struct isoburn_imgen_opts o,
int *  ext 
)

Definition at line 825 of file isoburn.c.

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

00826 {
00827  *ext= (!!o->rockridge) | ((!!o->joliet)<<1) | ((!!o->iso1999)<<2);
00828  return(1);
00829 }

int isoburn_igopt_get_fifo_size ( struct isoburn_imgen_opts o,
int *  fifo_size 
)

Definition at line 940 of file isoburn.c.

References isoburn_imgen_opts::fifo_size.

00941 {
00942  *fifo_size= o->fifo_size;
00943  return(1);
00944 }

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

Definition at line 728 of file isoburn.c.

References isoburn_read_opts::input_charset.

00730 {
00731  *input_charset= o->input_charset;
00732  return(1);
00733 }

int isoburn_igopt_get_level ( struct isoburn_imgen_opts o,
int *  level 
)

Definition at line 809 of file isoburn.c.

References isoburn_imgen_opts::level.

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

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

Definition at line 925 of file isoburn.c.

References isoburn_imgen_opts::output_charset.

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

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

00885 {
00886  *replace_dir_mode= o->replace_dir_mode%3;
00887  *replace_file_mode= o->replace_file_mode%3;
00888  *dir_mode= o->dir_mode;
00889  *file_mode= o->file_mode;
00890  return(1);
00891 }

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

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

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

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

References isoburn_imgen_opts::sort_files.

00864 {
00865  *value= !!o->sort_files;
00866  return(1);
00867 }

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 753 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::dir_mode, 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::sort_files, and isoburn_imgen_opts::uid.

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

int isoburn_igopt_set_extensions ( struct isoburn_imgen_opts o,
int  ext 
)

Definition at line 816 of file isoburn.c.

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

00817 {
00818  o->rockridge= !!(ext&1);
00819  o->joliet= !!(ext&2);
00820  o->iso1999= !!(ext&4);
00821  return(1);
00822 }

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

References isoburn_imgen_opts::fifo_size.

00934 {
00935  o->fifo_size= fifo_size;
00936  return(1);
00937 }

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

References isoburn_imgen_opts::level.

00803 {
00804  o->level= level;
00805  return(1);
00806 }

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

References isoburn_imgen_opts::output_charset.

00919 {
00920  o->output_charset= output_charset;
00921  return(1);
00922 }

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

00873 {
00874  o->replace_dir_mode= replace_dir_mode%3;
00875  o->replace_file_mode= replace_file_mode%3;
00876  o->dir_mode= dir_mode;
00877  o->file_mode= file_mode;
00878  return(1);
00879 }

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

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

00897 {
00898  o->replace_uid= replace_uid%3;
00899  o->replace_gid= replace_gid%3;
00900  o->uid= uid;
00901  o->gid= gid;
00902  return(1);
00903 }

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

References isoburn_imgen_opts::sort_files.

00857 {
00858  o->sort_files= !!(value&1);
00859  return(1);
00860 }

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

References isoburn_version().

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

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_drive_aquire(), isoburn_emulate_toc(), isoburn_find_emulator(), isoburn_igopt_new(), 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 514 of file isoburn.c.

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

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

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

References isoburn_prepare_disc_aux().

00495 {
00496  return isoburn_prepare_disc_aux(d, d, disc, opts, 0);
00497 }

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::dir_mode, 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::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_sort_files(wopts, opts->sort_files);
00417  iso_write_opts_set_replace_mode(wopts, opts->replace_dir_mode,
00418                 opts->replace_file_mode, opts->replace_uid, opts->replace_gid);
00419  iso_write_opts_set_default_dir_mode(wopts, opts->dir_mode);
00420  iso_write_opts_set_default_file_mode(wopts, opts->file_mode);
00421  iso_write_opts_set_default_uid(wopts, opts->uid);
00422  iso_write_opts_set_default_gid(wopts, opts->gid);
00423  iso_write_opts_set_output_charset(wopts, opts->output_charset);
00424  iso_write_opts_set_fifo_size(wopts, fifo_chunks);
00425 
00426  ret = isoburn_disc_track_lba_nwa(out_d, NULL, 0, &lba, &nwa);
00427  opts->effective_lba= nwa;
00428  ret= isoburn_get_msc2(out_o, NULL, &nwa, 0);
00429  if (ret != 1) {
00430    isoburn_msgs_submit(out_o, 0x00060000,
00431                    "Cannot determine next writeable address", 0, "FAILURE", 0);
00432    {ret= -3; goto ex;}
00433  }
00434  iso_write_opts_set_ms_block(wopts, nwa);
00435  iso_write_opts_set_appendable(wopts, !new_img);
00436  iso_write_opts_set_overwrite_buf(wopts,
00437                                   nwa>0 ? out_o->target_iso_head : NULL);
00438 
00439  ret = iso_image_create_burn_source(in_o->image, wopts, &wsrc);
00440  if (ret < 0) {
00441    isoburn_report_iso_error(ret, "Cannot create burn source", 0, "FAILURE", 0);
00442    {ret= -1; goto ex;}
00443  }
00444  if (early_indev_release) {
00445    for(i= 0; i<300; i++) {
00446 
00447      /* <<< ??? */
00448      if((i%30) == 0) {
00449        sprintf(msg, "Waiting for data in fifo since %d seconds", i/30);
00450        isoburn_msgs_submit(in_o, 0x00060000, msg, 0, "DEBUG", 0);
00451      }
00452 
00453      usleep(100000);
00454      ret= iso_ring_buffer_get_status(wsrc, &buffer_size, &buffer_free);
00455      if(ret >0 && buffer_size != buffer_free)
00456    break;
00457    }
00458 
00459    /* <<< ??? */
00460    sprintf(msg,
00461            "After %.1f seconds: %d bytes of output available (fifo state=%d)",
00462            ((double) i+1) / 10.0, (int) (buffer_size - buffer_free), ret);
00463    isoburn_msgs_submit(in_o, 0x00060000, msg, 0, "DEBUG", 0);
00464 
00465    if(in_o->iso_data_source!=NULL)
00466      isoburn_data_source_shutdown(in_o->iso_data_source, 0);
00467  }
00468  
00469  /* TODO check return values for failure. propertly clean-up on error */
00470 
00471  out_o->iso_source= wsrc;
00472 
00473  *disc = burn_disc_create();
00474  session = burn_session_create();
00475  burn_disc_add_session(*disc, session, BURN_POS_END);
00476  track = burn_track_create();
00477  burn_track_set_source(track, out_o->iso_source);
00478  burn_session_add_track(session, track, BURN_POS_END);
00479 
00480  /* give up local references */
00481  burn_track_free(track);
00482  burn_session_free(session);
00483 
00484  in_o->wrote_well= out_o->wrote_well= -1; /* neutral */
00485  ret= 1;
00486 ex:
00487  if(wopts!=NULL)
00488    {iso_write_opts_free(wopts); wopts= NULL;}
00489  return ret;
00490 }

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

References isoburn_prepare_disc_aux().

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

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

00646 {
00647  if(*o==NULL)
00648    return(0);
00649  free(*o);
00650  *o= NULL;
00651  return(1);
00652 }

int isoburn_ropt_get_default_dirperms ( struct isoburn_read_opts o,
mode_t *  mode 
)

Definition at line 712 of file isoburn.c.

References isoburn_read_opts::dirmode.

00714 {
00715  *mode= o->dirmode;
00716  return(1);
00717 }

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

Definition at line 694 of file isoburn.c.

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

00696 {
00697  *uid= o->uid;
00698  *gid= o->gid;
00699  *mode= o->mode;
00700  return(1);
00701 }

int isoburn_ropt_get_extensions ( struct isoburn_read_opts o,
int *  ext 
)

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

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

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

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

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

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

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

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

References isoburn_read_opts::dirmode.

00706 {
00707  o->dirmode= mode;
00708  return(1);
00709 }

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

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

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

int isoburn_ropt_set_extensions ( struct isoburn_read_opts o,
int  ext 
)

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

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

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

References isoburn_read_opts::input_charset.

00722 {
00723  o->input_charset= input_charset;
00724  return(1);
00725 }

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

References isoburn_cancel_prepared_write().

00577 {
00578  return isoburn_cancel_prepared_write(d, output_drive, 1);
00579 }

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

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

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


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 Sat Nov 8 02:08:48 2008 for libisoburn by  doxygen 1.5.6