Data Structures | Defines | Functions

libisoburn-0.5.6.pl00/libisoburn/isoburn.h File Reference

#include <stdint.h>
Include dependency graph for isoburn.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  isoburn_toc_entry
struct  isoburn
struct  isoburn_read_opts
 Options for image reading. More...
struct  isoburn_imgen_opts
 Options for image generation by libisofs and image transport to libburn. More...
struct  isoburn_toc_track
struct  isoburn_toc_session
struct  isoburn_toc_disc

Defines

#define Libisoburn_target_head_sizE   (32*2048)
#define Libisoburn_nwa_alignemenT   32
#define Libisoburn_toc_scan_alignemenT   16
#define Libisoburn_toc_scan_max_gaP   65536
#define Libisoburn_overwriteable_starT   ((off_t) (Libisoburn_target_head_sizE/2048))

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_get_emulation_mode (struct isoburn *o, int *pt, int flag)
int isoburn_get_target_volset (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_destroy_all (struct isoburn **objpt, 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_report_iso_error (int iso_error_code, char default_msg_text[], int os_errno, char min_severity[], int flag)
int isoburn_start_emulation (struct isoburn *o, int flag)
 Initialize the emulation of multi-session on random access media.
int isoburn_invalidate_iso (struct isoburn *o, int flag)
 Alters and writes the first 64 kB of a "media" to invalidate an ISO image.
int isoburn_find_emulator (struct isoburn **pt, struct burn_drive *drive, int flag)
 Get an eventual isoburn object which is wrapped around the drive.
int isoburn_msgs_submit (struct isoburn *o, int error_code, char msg_text[], int os_errno, char severity[], int flag)
int isoburn_set_start_byte (struct isoburn *o, off_t value, int flag)
 Set the start address for an emulated add-on session.
int isoburn_get_msc2 (struct isoburn *o, struct burn_write_opts *opts, int *msc2, int flag)
 Obtains the image address offset to be used with image generation.
IsoDataSource * isoburn_data_source_new (struct burn_drive *d)
 Get a data source suitable for read from a drive using burn_read_data() function.
int isoburn_data_source_shutdown (IsoDataSource *src, int flag)
 Disable read capabilities of a data source which was originally created by isoburn_data_source_new().

Define Documentation

#define Libisoburn_nwa_alignemenT   32

Definition at line 524 of file isoburn.h.

Referenced by isoburn_emulate_toc(), and isoburn_set_start_byte().

#define Libisoburn_overwriteable_starT   ((off_t) (Libisoburn_target_head_sizE/2048))

Definition at line 554 of file isoburn.h.

#define Libisoburn_target_head_sizE   (32*2048)

Definition at line 42 of file isoburn.h.

Referenced by isoburn_activate_session(), isoburn_disc_erase(), and isoburn_start_emulation().

#define Libisoburn_toc_scan_alignemenT   16

Definition at line 531 of file isoburn.h.

#define Libisoburn_toc_scan_max_gaP   65536

Definition at line 538 of file isoburn.h.

Referenced by isoburn_emulate_toc().


Function Documentation

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

Definition at line 282 of file isoburn.c.

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

       : bit0= fetch first (idx<0) or last (idx>0) item in list
         bit1= address from start of list */
{
 int i,abs_idx;
 struct isoburn *npt;

 if(flag&2)
   for(;o->prev!=NULL;o= o->prev);
 abs_idx= (idx>0?idx:-idx);
 *pt= o;
 for(i= 0;(i<abs_idx || (flag&1)) && *pt!=NULL;i++) {
   if(idx>0)
     npt= o->next;
   else
     npt= o->prev;
   if(npt==NULL && (flag&1))
 break;
   *pt= npt;
 }
 return(*pt!=NULL);
}

int isoburn_count ( struct isoburn o,
int  flag 
)

Definition at line 269 of file isoburn.c.

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

       : bit1= count from start of list */
{
 int counter= 0;

 if(flag&2)
   for(;o->prev!=NULL;o= o->prev);
 for(;o!=NULL;o= o->next)
   counter++;
 return(counter);
}

IsoDataSource* isoburn_data_source_new ( struct burn_drive *  d  ) 

Get a data source suitable for read from a drive using burn_read_data() function.

Parameters:
d drive to read from. Must be grabbed.
Returns:
the data source, NULL on error. Must be freed with libisofs iso_data_source_unref() function. Note: this doesn't release the drive.

Definition at line 225 of file data_source.c.

References isoburn_cache_tile::age, isoburn_cache_tile::cache_hits, isoburn_cache_tile::cache_lba, isoburn_cached_drive::current_age, isoburn_cached_drive::drive, isoburn_cache_tile::last_aligned_error_lba, isoburn_cache_tile::last_error_lba, and isoburn_cached_drive::tiles.

Referenced by isoburn_read_image().

{
 IsoDataSource *ret;
 struct isoburn_cached_drive *icd= NULL;
 int i;

 if (d==NULL)
   return NULL;
 ret = malloc(sizeof(IsoDataSource));
 icd = calloc(1,sizeof(struct isoburn_cached_drive));
 if (ret == NULL || icd == NULL)
   return NULL;
 ret->refcount = 1;
 ret->read_block = ds_read_block;
 ret->open = ds_open;
 ret->close = ds_close;
 ret->free_data = ds_free_data;
 ret->data = icd;
 icd->drive = d;
 icd->current_age= 0;
 for(i= 0; i<Libisoburn_cache_tileS; i++) {
   icd->tiles[i].cache_lba = 0xffffffff;
   icd->tiles[i].cache_hits = 0;
   icd->tiles[i].last_error_lba = 0xffffffff;
   icd->tiles[i].last_aligned_error_lba = 0xffffffff;
   icd->tiles[i].age= 0;
 }
 return ret;
}

int isoburn_data_source_shutdown ( IsoDataSource *  src,
int  flag 
)

Disable read capabilities of a data source which was originally created by isoburn_data_source_new().

After this any attempt to read will yield a FATAL programming error event. This is usually done to allow libburn to release the drive while libisofs still holds a reference to the data source object. libisofs is not supposed to use this object for reading any more, nevertheless. The disabled state of the data source is a safety fence around this daring situation.

Parameters:
src The data source to be disabled
flag unused yet
Returns:
<=0 is failure , >0 success

Definition at line 213 of file data_source.c.

References isoburn_cached_drive::drive.

Referenced by isoburn_prepare_disc_aux().

{
 struct isoburn_cached_drive *icd;

 if(src==NULL)
   return(0);
 icd= (struct isoburn_cached_drive *) src->data;
 icd->drive= NULL;
 return(1);
}

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

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

{
 struct isoburn *o;

 o= *objpt;
 if(o==NULL)
   return(0);

 /* >>> mutex */

 if(o==isoburn_list_start)
   isoburn_list_start= o->next;
 if(o->prev!=NULL)
   o->prev->next= o->next;
 if(o->next!=NULL)
   o->next->prev= o->prev;

 /* >>> end mutex */

 if(o->image!=NULL)
   iso_image_unref(o->image);
 if(o->toc!=NULL)
   isoburn_toc_entry_destroy(&(o->toc), 1); /* all */
 if(o->iso_source!=NULL)
   burn_source_free(o->iso_source);
 if(o->iso_data_source!=NULL)
   iso_data_source_unref(o->iso_data_source);
 free((char *) o);
 *objpt= NULL;
 return(1);
}

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

Definition at line 193 of file isoburn.c.

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

Referenced by isoburn_finish(), and isoburn_initialize().

{
 struct isoburn *o,*n;

 o= *objpt;
 if(o==NULL)
   return(0);
 for(;o->prev!=NULL;o= o->prev);
 for(;o!=NULL;o= n) {
   n= o->next;
   isoburn_destroy(&o,0);
 }
 *objpt= NULL;
 return(1);
}

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

Definition at line 306 of file isoburn.c.

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

Referenced by isoburn_find_emulator().

{
 struct isoburn *o;

 *pt= NULL;
 for(o= isoburn_list_start;o!=NULL;o= o->next)
   if(o->drive==d) {
     *pt= o;
     return(1);
   }
 return(0);
}

int isoburn_find_emulator ( struct isoburn **  pt,
struct burn_drive *  drive,
int  flag 
)

Get an eventual isoburn object which is wrapped around the drive.

Parameters:
pt Eventually returns a pointer to the found object. It is allowed to become NULL if return value is -1 or 0. In this case, the drive is a genuine libburn drive with no emulation activated by isoburn.
drive The drive to be searched for
flag unused yet
Returns:
-1 unsuitable media, 0 generic media, 1 emulated media.

Get an eventual isoburn object which is wrapped around the drive.

Returns:
-1 unsuitable media, 0 generic media, 1 emulated media.

Definition at line 511 of file burn_wrap.c.

References isoburn_find_by_drive(), and isoburn_msgs_submit().

Referenced by isoburn_activate_session(), isoburn_attach_image(), isoburn_cancel_prepared_write(), isoburn_disc_available_space(), isoburn_disc_erasable(), isoburn_disc_erase(), isoburn_disc_get_msc1(), isoburn_disc_get_status(), isoburn_disc_track_lba_nwa(), isoburn_disc_write(), isoburn_drive_aquire(), isoburn_drive_release(), isoburn_drive_set_msgs_submit(), isoburn_drive_wrote_well(), isoburn_emulate_toc(), isoburn_get_attached_image(), isoburn_get_fifo_status(), isoburn_get_min_start_byte(), isoburn_get_mount_params(), isoburn_needs_emulation(), isoburn_prepare_blind_grow(), isoburn_prepare_disc_aux(), isoburn_read_image(), isoburn_set_msc1(), isoburn_set_read_pacifier(), and isoburn_toc_drive_get_disc().

{
 int ret;

 ret= isoburn_find_by_drive(pt, drive, 0);
 if(ret<=0)
   return(0);
 if((*pt)->emulation_mode==-1) {
   isoburn_msgs_submit(*pt, 0x00060000,
                    "Unsuitable drive and media state", 0, "FAILURE", 0);
   return(-1);
 }
 if((*pt)->emulation_mode==0)
   return(0);
 return(1);
} 

int isoburn_get_emulation_mode ( struct isoburn o,
int *  pt,
int  flag 
)
int isoburn_get_msc2 ( struct isoburn o,
struct burn_write_opts *  opts,
int *  msc2,
int  flag 
)

Obtains the image address offset to be used with image generation.

This is either the (emulated) drive nwa or a value set by isoburn_prepare_blind_grow(). In any case this is the address to tell to iso_write_opts_set_ms_block().

Parameters:
o The isoburn object to be inquired
opts If not NULL: write parameters to be set on drive before query
msc2 The value to be used with iso_write_opts_set_ms_block()
flag unused yet
Returns:
<=0 is failure , >0 success

Definition at line 697 of file burn_wrap.c.

References isoburn::drive, isoburn::fabricated_msc2, isoburn_disc_track_lba_nwa(), and isoburn::nwa.

Referenced by isoburn_prepare_disc_aux().

{
 int ret, lba, nwa;

 if(o->fabricated_msc2>=0)
   *msc2= o->fabricated_msc2;
 else {
   ret= isoburn_disc_track_lba_nwa(o->drive, opts, 0, &lba, &nwa);
   if(ret<=0)
     return(ret);
   *msc2= nwa;
 }
 return(1);
}

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

Definition at line 224 of file isoburn.c.

References isoburn::next.

{
 *pt= o->next;
 return(1);
}

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

Definition at line 217 of file isoburn.c.

References isoburn::prev.

{
 *pt= o->prev;
 return(1);
}

int isoburn_get_target_volset ( struct isoburn o,
IsoImage **  pt,
int  flag 
)
int isoburn_invalidate_iso ( struct isoburn o,
int  flag 
)

Alters and writes the first 64 kB of a "media" to invalidate an ISO image.

(It shall stay restorable by skilled humans, though). The result shall especially keep libisoburn from accepting the media image as ISO filesystem.

Parameters:
o A fully activated isoburn object. isoburn_start_emulation() was already called.
Returns:
<=0 error , 1 = success

Definition at line 406 of file isofs_wrap.c.

References isoburn::drive, isoburn_activate_session(), and isoburn::target_iso_head.

Referenced by isoburn_disc_erase().

{
 /* 
  * replace CD001 with CDXX1 in PVM.
  * I think this is enought for invalidating an iso image
  */
 strncpy((char*)o->target_iso_head + 16 * 2048 + 1, "CDXX1", 5);
 return isoburn_activate_session(o->drive);
}

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

Definition at line 231 of file isoburn.c.

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

Referenced by isoburn_new().

{

 /* >>> mutex */

 if(isoburn_list_start==NULL ||
    (isoburn_list_start==link && (flag&1)))
   isoburn_list_start= o;
 if(o->prev!=NULL)
   o->prev->next= o->next;
 if(o->next!=NULL)
   o->next->prev= o->prev;
 o->prev= o->next= NULL;
 if(link==NULL)
   return(1);
 if(flag&1) {
   o->next= link;
   o->prev= link->prev;
   if(o->prev!=NULL)
     o->prev->next= o;
   link->prev= o;
 } else {
   o->prev= link;
   o->next= link->next;
   if(o->next!=NULL)
     o->next->prev= o;
   link->next= o;
 }

 /* >>> end mutex */

 return(1);
}

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

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

{
 struct isoburn *o;
 int i, ret;

 *objpt= o= (struct isoburn *) malloc(sizeof(struct isoburn));
 if(o==NULL) {
   isoburn_msgs_submit(NULL, 0x00060000,
                       "Cannot allocate memory for isoburn control object",
                       0, "FATAL", 0);
   return(-1);
 }

 o->drive= NULL;
 o->emulation_mode= 0;
 o->fabricated_msc1= -1;
 o->fabricated_msc2= -1;
 o->zero_nwa= Libisoburn_overwriteable_starT;
 o->min_start_byte= o->zero_nwa * 2048;
 o->nwa= o->zero_nwa;
 o->truncate= 0;
 o->iso_source= NULL;
 o->fabricated_disc_status= BURN_DISC_UNREADY;
 o->toc= NULL;
 o->wrote_well= -1;
 for(i=0;i<Libisoburn_target_head_sizE;i++)
   o->target_iso_head[i]= 0;
 o->image= NULL;
 o->iso_data_source= NULL;
 o->read_pacifier= NULL;
 o->read_pacifier_handle= NULL;
 o->msgs_submit= NULL;
 o->msgs_submit_handle= NULL;
 o->msgs_submit_flag= 0;
 o->prev= NULL;
 o->next= NULL;
 ret= iso_image_new("ISOIMAGE", &o->image);
 if(ret<0) {
   isoburn_report_iso_error(ret, "Cannot create image", 0, "FATAL", 0);
   goto failed;
 }
 isoburn_link(o, isoburn_list_start, 1);
 return(1);
failed:;
 isoburn_destroy(objpt, 0);
 return(-1);
}

int isoburn_report_iso_error ( int  iso_error_code,
char  default_msg_text[],
int  os_errno,
char  min_severity[],
int  flag 
)

Definition at line 988 of file burn_wrap.c.

References isoburn__sev_to_text(), and isoburn__text_to_sev().

Referenced by isoburn_new(), isoburn_prepare_disc_aux(), and isoburn_read_image().

{
 int error_code, iso_sev, min_sev, ret;
 char *sev_text_pt, *msg_text_pt= NULL;

 error_code= iso_error_get_code(iso_error_code);
 if(error_code < 0x00030000 || error_code >= 0x00040000)
   error_code= (error_code & 0xffff) | 0x00050000;

 if(iso_error_code<0)
   msg_text_pt= (char *) iso_error_to_msg(iso_error_code);
 if(msg_text_pt==NULL)
   msg_text_pt= msg_text;
 iso_sev= iso_error_get_severity(iso_error_code);
 sev_text_pt= min_severity;
 isoburn__text_to_sev(min_severity, &min_sev, 0);
 if(min_sev < iso_sev) 
   isoburn__sev_to_text(iso_sev, &sev_text_pt, 0);
 ret= iso_msgs_submit(error_code, msg_text_pt, os_errno, sev_text_pt, 0);
 return(ret);
}

int isoburn_set_start_byte ( struct isoburn o,
off_t  value,
int  flag 
)

Set the start address for an emulated add-on session.

The value will be rounded up to the alignment necessary for the media. The aligned value will be divided by 2048 and then put into o->nwa .

Parameters:
o The isoburn object to be programmed.
value The start address in bytes
flag unused yet
Returns:
<=0 is failure , >0 success

Definition at line 850 of file burn_wrap.c.

References isoburn::drive, isoburn_msgs_submit(), Libisoburn_nwa_alignemenT, isoburn::min_start_byte, and isoburn::nwa.

Referenced by isoburn_start_emulation().

{
 int ret;
 struct burn_drive *drive = o->drive;
 struct burn_multi_caps *caps= NULL;
 
 ret= burn_disc_get_multi_caps(drive, BURN_WRITE_NONE, &caps, 0);
 if(ret<=0)
   goto ex;
 if(!caps->start_adr) {
   isoburn_msgs_submit(o, 0x00060000,
                       "Cannot set start byte address with this type of media",
                       0, "FAILURE", 0);
   {ret= 0; goto ex;}
 }
 o->min_start_byte= value;
 if(value % caps->start_alignment)
   value+= caps->start_alignment - (value % caps->start_alignment);
 o->nwa= value/2048;
 /* If suitable for media alignment, round up to Libisoburn_nwa_alignemenT */
 if((o->nwa % Libisoburn_nwa_alignemenT) &&
     ((Libisoburn_nwa_alignemenT*2048) % caps->start_alignment)==0 )
   o->nwa+= Libisoburn_nwa_alignemenT - (o->nwa % Libisoburn_nwa_alignemenT);
 ret= 1;
ex:
 if(caps!=NULL)
   burn_disc_free_multi_caps(&caps);
 return(ret);
}

int isoburn_start_emulation ( struct isoburn o,
int  flag 
)

Initialize the emulation of multi-session on random access media.

The need for emulation is confirmed already.

Parameters:
o A freshly created isoburn object. isoburn_create_data_source() was already called, nevertheless.
Returns:
<=0 error , 1 = success

Definition at line 310 of file isofs_wrap.c.

References isoburn::drive, isoburn::fabricated_disc_status, iso_read_lsb(), isoburn_msgs_submit(), isoburn_set_start_byte(), Libisoburn_target_head_sizE, isoburn::target_iso_head, and isoburn::zero_nwa.

Referenced by isoburn_welcome_media().

{
 int ret, i, capacity = -1, role;
 off_t data_count, to_read;
 struct burn_drive *drive;
 struct ecma119_pri_vol_desc *pvm;
 
 if(o==NULL) {
   isoburn_msgs_submit(NULL, 0x00060000,
                       "Program error: isoburn_start_emulation: o==NULL",
                       0, "FATAL", 0);
   return -1;
 }

 drive= o->drive;

 /* We can assume 0 as start block for image.
    The data there point to the most recent session.
 */
 role = burn_drive_get_drive_role(drive);
 ret = burn_get_read_capacity(drive, &capacity, 0);
 if (ret <= 0)
   capacity = -1;
 if (capacity > 0 || role == 2) {
   /* Might be a block device on a system where libburn cannot determine its
      size.  Try to read anyway. */
   memset(o->target_iso_head, 0, Libisoburn_target_head_sizE);
   to_read = Libisoburn_target_head_sizE;
   if(capacity > 0 && (off_t) capacity * (off_t) 2048 < to_read)
     to_read = (off_t) capacity * (off_t) 2048;
   ret = burn_read_data(drive, (off_t) 0, (char*)o->target_iso_head, 
                        to_read, &data_count, 2);
   if (ret <= 0) {
     /* an error means a disc with no ISO image */
     if (capacity > 0)
       o->fabricated_disc_status= BURN_DISC_FULL;
     else
        o->fabricated_disc_status= BURN_DISC_BLANK;
     return 1;
   }
 } else {
   /* No read capacity means blank media */
   o->fabricated_disc_status= BURN_DISC_BLANK;
   return 1;
 }

 /* check first 64K. If 0's, the disc is treated as a blank disc, and thus
    overwritten without extra check. */
 i = Libisoburn_target_head_sizE;
 while (i && !o->target_iso_head[i-1]) 
   --i;

 if (!i) {
   o->fabricated_disc_status= BURN_DISC_BLANK;
   return 1;
 }

 pvm = (struct ecma119_pri_vol_desc *)(o->target_iso_head + 16 * 2048);

 if (!strncmp((char*)pvm->std_identifier, "CD001", 5)) {
   off_t size;

   /* sanity check */
   if (pvm->vol_desc_type[0] != 1 || pvm->vol_desc_version[0] != 1 
       || pvm->file_structure_version[0] != 1 ) {
     /* TODO for now I treat this as a full disc */
     o->fabricated_disc_status= BURN_DISC_FULL;
     return 1;
   }

   /* ok, PVM found, set size */
   size = (off_t) iso_read_lsb(pvm->vol_space_size, 4);
   size *= (off_t) 2048; /* block size in bytes */
   isoburn_set_start_byte(o, size, 0);
   o->fabricated_disc_status= BURN_DISC_APPENDABLE;
 } else if (!strncmp((char*)pvm->std_identifier, "CDXX1", 5)) {

   /* empty image */
   isoburn_set_start_byte(o, o->zero_nwa * 2048, 0);
   o->fabricated_disc_status= BURN_DISC_BLANK;
 } else {
   /* treat any disc in an unknown format as full */
   o->fabricated_disc_status= BURN_DISC_FULL;
 }
 return 1;
}

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

Definition at line 85 of file isoburn.c.

References isoburn_toc_entry_destroy().

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

{
 if(*o==NULL)
   return(0);
 if(flag&1)
   isoburn_toc_entry_destroy(&((*o)->next), flag);
 if((*o)->volid != NULL)
   free((*o)->volid);
 free((char *) (*o));   
 *o= NULL;
 return(1);
}

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

Definition at line 56 of file isoburn.c.

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

Referenced by isoburn_make_toc_entry().

{
 struct isoburn_toc_entry *o, *s;

 *objpt= o= (struct isoburn_toc_entry *)
            malloc(sizeof(struct isoburn_toc_entry));
 if(o==NULL) {
   isoburn_msgs_submit(NULL, 0x00060000,
                       "Cannot allocate memory for isoburn toc entry",
                       0, "FATAL", 0);
   return(-1);
 }
 o->session= 0;
 o->track_no= 0;
 o->start_lba= -1;
 o->track_blocks= 0;
 o->volid= NULL;
 o->next= NULL;
 if(boss!=NULL) {
   for(s= boss; s->next!=NULL; s= s->next);
   s->next= o;
 }
 return(1);
}