correct handling of disc status and blank discs in read volset
This commit is contained in:
parent
8222fbcd49
commit
87f1c84c63
@ -76,6 +76,7 @@ int isoburn_read_volset(struct burn_drive *d, struct isoburn_read_opts *read_opt
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct ecma119_read_opts ropts;
|
struct ecma119_read_opts ropts;
|
||||||
|
enum burn_disc_status status;
|
||||||
struct isoburn *o;
|
struct isoburn *o;
|
||||||
|
|
||||||
assert(d && read_opts && volset);
|
assert(d && read_opts && volset);
|
||||||
@ -88,15 +89,34 @@ int isoburn_read_volset(struct burn_drive *d, struct isoburn_read_opts *read_opt
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO replace with isoburn_disc_get_status()
|
status = isoburn_disc_get_status(d);
|
||||||
// Check for suitable FULL or APPENDABLE status. Full only useful for image
|
if (status == BURN_DISC_BLANK) {
|
||||||
// modification
|
struct iso_volume *volume;
|
||||||
if (o->fabricated_disc_status == BURN_DISC_BLANK) {
|
struct iso_tree_node_dir *root;
|
||||||
// FIXME construct an empty volset!!
|
|
||||||
*volset = NULL;
|
/*
|
||||||
|
* Blank disc, we create a new volset without files.
|
||||||
|
*/
|
||||||
|
|
||||||
|
root = iso_tree_new_root();
|
||||||
|
if (!root)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
volume = iso_volume_new_with_root("NEW DISC", "", "LIBISOBURN", root);
|
||||||
|
if (!volume)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
*volset = iso_volset_new(volume, "NEW VOLSET");
|
||||||
|
if (!*volset)
|
||||||
|
return -1;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (status != BURN_DISC_APPENDABLE && status != BURN_DISC_FULL) {
|
||||||
|
/* incorrect disc status */
|
||||||
|
return -4;
|
||||||
|
}
|
||||||
|
|
||||||
ret = isoburn_disc_get_msc1(d, (int*) &ropts.block);
|
ret = isoburn_disc_get_msc1(d, (int*) &ropts.block);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return -2;
|
return -2;
|
||||||
|
@ -114,10 +114,8 @@ struct isoburn_read_opts {
|
|||||||
Not a wrapper, but peculiar to libisoburn.
|
Not a wrapper, but peculiar to libisoburn.
|
||||||
@param d The drive which holds an existing ISO filesystem
|
@param d The drive which holds an existing ISO filesystem
|
||||||
@param read_opts The read options which can be chosen by the application
|
@param read_opts The read options which can be chosen by the application
|
||||||
@param volset the volset that represents the image, or NULL if the image is
|
@param volset the volset that represents the image, if the disc is blacnk
|
||||||
empty.
|
it will have no files
|
||||||
<<<<< What about return a volset without file if image is
|
|
||||||
empty <<<<<<<<<
|
|
||||||
@return <=0 error , 1 = success
|
@return <=0 error , 1 = success
|
||||||
>>>>> error means damaged or unsupported image
|
>>>>> error means damaged or unsupported image
|
||||||
error code is stored in ecma119_read_opts in libisofs
|
error code is stored in ecma119_read_opts in libisofs
|
||||||
|
@ -117,17 +117,6 @@ int main(int argc, char **argv)
|
|||||||
printf("Can't read volset\n");
|
printf("Can't read volset\n");
|
||||||
goto exit_cleanup;
|
goto exit_cleanup;
|
||||||
}
|
}
|
||||||
printf("Volset read\n");
|
|
||||||
fflush(stdout);
|
|
||||||
|
|
||||||
if (!volset) {
|
|
||||||
// TODO this piece of code should be inside libisoburn
|
|
||||||
struct iso_volume *volume;
|
|
||||||
|
|
||||||
root = iso_tree_new_root();
|
|
||||||
volume = iso_volume_new_with_root("NEW DISC", "", "LIBISOBURN", root);
|
|
||||||
volset = iso_volset_new( volume, "VOLSETID" );
|
|
||||||
}
|
|
||||||
root = iso_volume_get_root(iso_volset_get_volume(volset, 0));
|
root = iso_volume_get_root(iso_volset_get_volume(volset, 0));
|
||||||
|
|
||||||
/* add a new dir */
|
/* add a new dir */
|
||||||
|
Loading…
Reference in New Issue
Block a user