Prepared libisoburn for drive role 5

This commit is contained in:
2011-03-21 09:31:51 +00:00
parent 6968b72648
commit cf49e83893
3 changed files with 59 additions and 15 deletions

View File

@@ -439,14 +439,16 @@ static int isoburn_inspect_partition(struct isoburn *o, uint32_t img_size,
The need for emulation is confirmed already.
@param o A freshly created isoburn object. isoburn_create_data_source() was
already called, nevertheless.
@param flag bit0= read-only
@return <=0 error , 1 = success
*/
int isoburn_start_emulation(struct isoburn *o, int flag)
{
int ret, i, capacity = -1, role;
int ret, i, capacity = -1, role, dummy;
off_t data_count, to_read;
struct burn_drive *drive;
struct ecma119_pri_vol_desc *pvm;
enum burn_disc_status s;
if(o==NULL) {
isoburn_msgs_submit(NULL, 0x00060000,
@@ -457,6 +459,9 @@ int isoburn_start_emulation(struct isoburn *o, int flag)
drive= o->drive;
if(flag & 1)
o->fabricated_disc_status= BURN_DISC_FULL;
/* We can assume 0 as start block for image.
The data there point to the most recent session.
*/
@@ -464,7 +469,12 @@ int isoburn_start_emulation(struct isoburn *o, int flag)
ret = burn_get_read_capacity(drive, &capacity, 0);
if (ret <= 0)
capacity = -1;
if (capacity > 0 || role == 2 || role == 4) {
if (role == 5) { /* random access write-only media */
s = burn_disc_get_status(drive);
o->fabricated_disc_status= s;
burn_disc_track_lba_nwa(drive, NULL, 0, &dummy, &(o->nwa));
return 1;
} else if (capacity > 0 || role == 2 || role == 4) {
/* Might be a block device on a system where libburn cannot determine its
size. Try to read anyway. */
to_read = o->target_iso_head_size;
@@ -477,13 +487,14 @@ int isoburn_start_emulation(struct isoburn *o, int flag)
/* 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;
else if(!(flag & 1))
o->fabricated_disc_status= BURN_DISC_BLANK;
return 1;
}
} else {
/* No read capacity means blank media */
o->fabricated_disc_status= BURN_DISC_BLANK;
if(!(flag & 1))
o->fabricated_disc_status= BURN_DISC_BLANK;
return 1;
}
@@ -494,7 +505,8 @@ int isoburn_start_emulation(struct isoburn *o, int flag)
--i;
if (!i) {
o->fabricated_disc_status= BURN_DISC_BLANK;
if(!(flag & 1))
o->fabricated_disc_status= BURN_DISC_BLANK;
return 1;
}
@@ -518,12 +530,14 @@ int isoburn_start_emulation(struct isoburn *o, int flag)
return ret;
size *= (off_t) 2048; /* block size in bytes */
isoburn_set_start_byte(o, size, 0);
o->fabricated_disc_status= BURN_DISC_APPENDABLE;
if(!(flag & 1))
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;
if(!(flag & 1))
o->fabricated_disc_status= BURN_DISC_BLANK;
} else {
/* treat any disc in an unknown format as full */
o->fabricated_disc_status= BURN_DISC_FULL;