From afd6178b6cbcf25be834897688389ca32cd1fabe Mon Sep 17 00:00:00 2001 From: Vreixo Formoso Lopes Date: Thu, 13 Sep 2007 10:29:49 +0000 Subject: [PATCH] Add fabricated disc status. --- libisoburn/isoburn.c | 1 + libisoburn/isoburn.h | 4 ++++ libisoburn/isofs_wrap.c | 20 +++++++++++++------- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/libisoburn/isoburn.c b/libisoburn/isoburn.c index f9e628af..9933287c 100644 --- a/libisoburn/isoburn.c +++ b/libisoburn/isoburn.c @@ -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; diff --git a/libisoburn/isoburn.h b/libisoburn/isoburn.h index ebb78c03..f6ec32ca 100644 --- a/libisoburn/isoburn.h +++ b/libisoburn/isoburn.h @@ -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 --- */ diff --git a/libisoburn/isofs_wrap.c b/libisoburn/isofs_wrap.c index 1944e0dd..71e8cf9e 100644 --- a/libisoburn/isofs_wrap.c +++ b/libisoburn/isofs_wrap.c @@ -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; }