Add fabricated disc status.

This commit is contained in:
Vreixo Formoso Lopes 2007-09-13 10:29:49 +00:00
parent 1d37dc892a
commit afd6178b6c
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->target_ropts= NULL;
o->new_wopts= NULL;
o->fabricated_disc_status= BURN_DISC_UNREADY;
for(i=0;i<65536;i++)
o->target_iso_head[i]= 0;
o->target_volset= NULL;

View File

@ -41,6 +41,10 @@ struct isoburn {
/* Aligned start address to be used for processing (counted in blocks) */
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 --- */

View File

@ -96,6 +96,12 @@ int isoburn_read_volset(struct burn_drive *d, struct isoburn_read_opts *read_opt
if (ret < 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);
if (ret < 0)
return -1;
@ -216,9 +222,9 @@ int isoburn_start_emulation(struct isoburn *o, int flag)
/* sanity check */
if (pvm->vol_desc_type[0] != 1 || pvm->vol_desc_version[0] != 1
|| pvm->file_structure_version[0] != 1 ) {
// TODO unsupported image type, maybe not image or damaged image
// should this be an error?
return -2;
// TODO for now I treat this as a full disc
o->fabricated_disc_status= BURN_DISC_FULL;
return 1;
}
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) 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, (off_t) 0, 0);
o->fabricated_disc_status= BURN_DISC_BLANK;
} else {
// TODO not valid iso image
// should this be an error?
return -2;
// TODO for now I treat this as a full disc
o->fabricated_disc_status= BURN_DISC_FULL;
}
return 1;
}