Replace rwopts management with data_source related functions

This commit is contained in:
Vreixo Formoso Lopes 2007-09-23 15:32:48 +00:00
parent aa9d33c9e3
commit cff1144b0e
3 changed files with 14 additions and 39 deletions

View File

@ -55,21 +55,15 @@ int isoburn_new(struct isoburn **objpt, int flag)
o->target_volset= NULL;
o->prev= NULL;
o->next= NULL;
if(isoburn_new_rwopts(o)<=0)
goto failed;
isoburn_link(o, isoburn_list_start, 1);
return(1);
failed:;
isoburn_destroy(objpt,0);
return(-1);
}
int isoburn_destroy(struct isoburn **objpt, int flag)
{
struct isoburn *o;
int isoburn_free_rwopts(struct isoburn *o);
o= *objpt;
if(o==NULL)
@ -88,7 +82,6 @@ int isoburn_destroy(struct isoburn **objpt, int flag)
if(o->drive!=NULL)
burn_drive_release(o->drive, 0);
isoburn_free_rwopts(o);
if(o->target_volset!=NULL)
iso_volset_free(o->target_volset);

View File

@ -84,8 +84,8 @@ int isoburn_find_by_drive(struct isoburn **pt, struct burn_drive *d, int flag);
/* Calls from burn_wrap.c into isofs_wrap.c */
int isoburn_start_emulation(struct isoburn *o, int flag);
int isoburn_new_rwopts(struct isoburn *o);
int isoburn_free_rwopts(struct isoburn *o);
int isoburn_create_data_source(struct isoburn *o);
int isoburn_free_data_source(struct isoburn *o);
int isoburn_invalidate_iso(struct isoburn *o, int flag);

View File

@ -88,6 +88,9 @@ int isoburn_read_volset(struct burn_drive *d, struct isoburn_read_opts *read_opt
return -1;
}
// TODO replace with isoburn_disc_get_status()
// Check for suitable FULL or APPENDABLE status. Full only useful for image
// modification
if (o->fabricated_disc_status == BURN_DISC_BLANK) {
// FIXME construct an empty volset!!
*volset = NULL;
@ -139,38 +142,24 @@ int isoburn_activate_session(struct burn_drive *drive)
}
/** Allocate and initialize memory for libisofs related objects in
struct isoburn.
@param o A freshly created isoburn object with NULL pointers
/** Create a new data source suitable for reading from the given drive.
@param o A freshly created isoburn object, without any data_source
(src field == NULL), but with the drive field set.
@return <=0 error , 1 = success
*/
int isoburn_new_rwopts(struct isoburn *o)
int isoburn_create_data_source(struct isoburn *o)
{
// FIXME
/* <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
* This should call isoburn_data_source_new(), that now is in
* isoburn_start_emulation(). That is wrong, as for true ms discs
* isoburn_start_emulation() is never called, and thus we haven't a
* source for read previous session volset.
* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
*/
/* create and initialize the data source */
// o->src = isoburn_data_source_new(o->drive);
// if (!o->src)
// return -1;
return 1;
o->src = isoburn_data_source_new(o->drive);
return (o->src ? 1 : -1);
}
/** Dispose memory objects created by isoburn_new_rwopts(). This function
expect that the pointers in struct isoburn might still be NULL, i.e.
that isoburn_new_rwopts() was not called before.
/** Dispose the data source created by isoburn_create_data_source().
@return <=0 error , 1 = success
*/
int isoburn_free_rwopts(struct isoburn *o)
int isoburn_free_data_source(struct isoburn *o)
{
if (o->src)
data_source_free(o->src);
@ -180,7 +169,7 @@ int isoburn_free_rwopts(struct isoburn *o)
/** Initialize the emulation of multi-session on random access media.
The need for emulation is confirmed already.
@param o A freshly created isoburn object. isoburn_new_rwopts() was
@param o A freshly created isoburn object. isoburn_create_data_source() was
already called, nevertheless.
@return <=0 error , 1 = success
*/
@ -206,13 +195,6 @@ int isoburn_start_emulation(struct isoburn *o, int flag)
return 1;
}
// TODO remove >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
/* create and initialize the data source */
o->src = isoburn_data_source_new(o->drive);
if (!o->src)
return -1;
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
/* check first 64K. If 0's, the disc is treated as a blank disc, and thus
overwritten without extra check. */
i = sizeof(o->target_iso_head);