Add fabricated disc status.

This commit is contained in:
Vreixo Formoso Lopes 2007-09-13 10:29:49 +00:00
parent 667db357c8
commit e9da76ab36
3 changed files with 18 additions and 7 deletions

View File

@ -52,6 +52,7 @@ int isoburn_new(struct isoburn **objpt, int flag)
o->treatment= 1; o->treatment= 1;
o->target_ropts= NULL; o->target_ropts= NULL;
o->new_wopts= NULL; o->new_wopts= NULL;
o->fabricated_disc_status= BURN_DISC_UNREADY;
for(i=0;i<65536;i++) for(i=0;i<65536;i++)
o->target_iso_head[i]= 0; o->target_iso_head[i]= 0;
o->target_volset= NULL; o->target_volset= NULL;

View File

@ -41,6 +41,10 @@ struct isoburn {
/* Aligned start address to be used for processing (counted in blocks) */ /* Aligned start address to be used for processing (counted in blocks) */
int nwa; int nwa;
/* Eventual freely fabricated isoburn_disc_get_status().
BURN_DISC_UNREADY means that normally emulated status is in effect.
*/
enum burn_disc_status fabricated_disc_status;
/* --- Vreixo's part --- */ /* --- Vreixo's part --- */

View File

@ -96,6 +96,12 @@ int isoburn_read_volset(struct burn_drive *d, struct isoburn_read_opts *read_opt
if (ret < 0) if (ret < 0)
return 0; return 0;
if (o->fabricated_disc_status == BURN_DISC_BLANK) {
// FIXME construct an empty volset!!
*volset = NULL;
return 1;
}
ret = isoburn_disc_get_msc1(d, &ropts.block); ret = isoburn_disc_get_msc1(d, &ropts.block);
if (ret < 0) if (ret < 0)
return -1; return -1;
@ -216,9 +222,9 @@ int isoburn_start_emulation(struct isoburn *o, int flag)
/* sanity check */ /* sanity check */
if (pvm->vol_desc_type[0] != 1 || pvm->vol_desc_version[0] != 1 if (pvm->vol_desc_type[0] != 1 || pvm->vol_desc_version[0] != 1
|| pvm->file_structure_version[0] != 1 ) { || pvm->file_structure_version[0] != 1 ) {
// TODO unsupported image type, maybe not image or damaged image // TODO for now I treat this as a full disc
// should this be an error? o->fabricated_disc_status= BURN_DISC_FULL;
return -2; return 1;
} }
if (!strncmp((char*)pvm->std_identifier, "CD001", 5)) { if (!strncmp((char*)pvm->std_identifier, "CD001", 5)) {
@ -228,16 +234,16 @@ int isoburn_start_emulation(struct isoburn *o, int flag)
size = (off_t) iso_read_lsb(pvm->vol_space_size, 4); size = (off_t) iso_read_lsb(pvm->vol_space_size, 4);
size *= (off_t) 2048; /* block size in bytes */ size *= (off_t) 2048; /* block size in bytes */
isoburn_set_start_byte(o, size, 0); isoburn_set_start_byte(o, size, 0);
o->fabricated_disc_status= BURN_DISC_APPENDABLE;
} else if (!strncmp((char*)pvm->std_identifier, "CDXX1", 5)) { } else if (!strncmp((char*)pvm->std_identifier, "CDXX1", 5)) {
/* empty image */ /* empty image */
isoburn_set_start_byte(o, (off_t) 0, 0); isoburn_set_start_byte(o, (off_t) 0, 0);
o->fabricated_disc_status= BURN_DISC_BLANK;
} else { } else {
// TODO not valid iso image // TODO for now I treat this as a full disc
// should this be an error? o->fabricated_disc_status= BURN_DISC_FULL;
return -2;
} }
return 1; return 1;
} }