New API calls isoburn_igopt_set_partition_img, isoburn_igopt_get_partition_img

This commit is contained in:
2010-10-18 15:54:46 +00:00
parent 25f1eab3ac
commit 38e1dc8a22
5 changed files with 122 additions and 1 deletions

View File

@ -533,6 +533,18 @@ int isoburn_prepare_disc_aux(struct burn_drive *in_d, struct burn_drive *out_d,
opts->partition_secs_per_head,
opts->partition_heads_per_cyl);
iso_write_opts_set_tail_blocks(wopts, opts->tail_blocks);
for(i= 0; i < 4; i++) {
if(opts->appended_partitions[i] == NULL)
continue;
ret= iso_write_opts_set_partition_img(wopts, i + 1,
opts->appended_part_types[i],
opts->appended_partitions[i], 0);
if(ret < 0) {
isoburn_report_iso_error(ret, "Cannot set path for appended partition",
0, "FAILURE", 0);
{ret= -1; goto ex;}
}
}
ret = iso_image_create_burn_source(in_o->image, wopts, &wsrc);
if (ret < 0) {
@ -883,6 +895,7 @@ int isoburn_ropt_get_size_what(struct isoburn_read_opts *o,
int isoburn_igopt_new(struct isoburn_imgen_opts **new_o, int flag)
{
struct isoburn_imgen_opts *o;
int i;
o= (*new_o)= calloc(1, sizeof(struct isoburn_imgen_opts));
if(o==NULL) {
@ -933,14 +946,23 @@ int isoburn_igopt_new(struct isoburn_imgen_opts **new_o, int flag)
o->vol_effective_time= 0;
o->libjte_handle= NULL;
o->tail_blocks= 0;
for(i= 0; i < 4; i++) {
o->appended_partitions[i]= NULL;
o->appended_part_types[i]= 0;
}
return(1);
}
int isoburn_igopt_destroy(struct isoburn_imgen_opts **o, int flag)
{
int i;
if(*o==NULL)
return(0);
for(i= 0; i < 4; i++)
if((*o)->appended_partitions[i] != NULL)
free((*o)->appended_partitions[i]);
free(*o);
*o= NULL;
return(1);
@ -1265,3 +1287,45 @@ int isoburn_igopt_get_tail_blocks(struct isoburn_imgen_opts *opts,
return 1;
}
int isoburn_igopt_set_partition_img(struct isoburn_imgen_opts *opts,
int partition_number, uint8_t partition_type,
char *image_path)
{
if (partition_number < 1 || partition_number > 4) {
isoburn_msgs_submit(NULL, 0x00060000,
"Partition number is out of range (1...4)",
0, "FAILURE", 0);
return(0);
}
if (opts->appended_partitions[partition_number - 1] != NULL)
free(opts->appended_partitions[partition_number - 1]);
opts->appended_partitions[partition_number - 1] = strdup(image_path);
if (opts->appended_partitions[partition_number - 1] == NULL)
return(-1);
opts->appended_part_types[partition_number - 1] = partition_type;
return(1);
}
int isoburn_igopt_get_partition_img(struct isoburn_imgen_opts *opts,
int num_entries,
uint8_t partition_types[],
char *image_paths[])
{
int i, max_entry= 0;
for(i= 0; i < num_entries; i++)
image_paths[i]= NULL;
for(i= 0; i < 4; i++) {
if(opts->appended_partitions[i] == NULL)
continue;
if(i < num_entries) {
image_paths[i]= opts->appended_partitions[i];
partition_types[i]= opts->appended_part_types[i];
}
max_entry= i + 1;
}
return(max_entry);
}