New API calls isoburn_igopt_set_partition_img, isoburn_igopt_get_partition_img

This commit is contained in:
Thomas Schmitt 2010-10-18 15:54:46 +00:00
parent 0125ee074e
commit eac40e9a6d
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);
}

View File

@ -553,6 +553,12 @@ struct isoburn_imgen_opts {
*/
uint32_t tail_blocks;
/* Eventual disk file paths of prepared images which shall be appended
after the ISO image and described by partiton table entries in a MBR.
*/
char *appended_partitions[4];
uint8_t appended_part_types[4];
};

View File

@ -1374,6 +1374,55 @@ int isoburn_igopt_get_tail_blocks(struct isoburn_imgen_opts *opts,
uint32_t *num_blocks);
/** Cause an arbitrary data file to be appended to the ISO image and to be
described by a partition table entry in an MBR at the start of the
ISO image.
The partition entry will bear the size of the image file rounded up to
the next multiple of 2048 bytes.
@since 0.6.4
@param opts
The option set to be manipulated.
@param partition_number
Depicts the partition table entry which shall describe the
appended image. Range 1 to 4.
1 will cause the whole ISO image to be unclaimable space before
partition 1.
@param image_path
File address in the local file system.
@param image_type
The partition type. E.g. FAT12 = 0x01 , FAT16 = 0x06,
Linux Native Partition = 0x83. See fdisk command L.
@return
<=0 = error, 1 = success
*/
int isoburn_igopt_set_partition_img(struct isoburn_imgen_opts *opts,
int partition_number, uint8_t partition_type,
char *image_path);
/** Inquire the current settings made by isoburn_igopt_set_partition_img().
@since 0.6.4
@param opts
The option set to be inquired.
@param num_entries
Number of array elements in partition_types[] and image_paths[].
@param partition_types
The partition type associated with the partition. Valid only if
image_paths[] of the same index is not NULL.
@param image_paths
Its elements get filled with either NULL or a pointer to a string
with a file address,
@return
<0 = error
0 = no partition image set
>0 highest used partition number
*/
int isoburn_igopt_get_partition_img(struct isoburn_imgen_opts *opts,
int num_entries,
uint8_t partition_types[],
char *image_paths[]);
/* ----------------------------------------------------------------------- */
/* End of Options for image generation */
/* ----------------------------------------------------------------------- */

View File

@ -32,6 +32,7 @@ isoburn_igopt_get_level;
isoburn_igopt_get_out_charset;
isoburn_igopt_get_over_mode;
isoburn_igopt_get_over_ugid;
isoburn_igopt_get_partition_img;
isoburn_igopt_get_pvd_times;
isoburn_igopt_get_relaxed;
isoburn_igopt_get_scdbackup_tag;
@ -45,6 +46,7 @@ isoburn_igopt_set_level;
isoburn_igopt_set_out_charset;
isoburn_igopt_set_over_mode;
isoburn_igopt_set_over_ugid;
isoburn_igopt_set_partition_img;
isoburn_igopt_set_pvd_times;
isoburn_igopt_set_relaxed;
isoburn_igopt_set_scdbackup_tag;

View File

@ -1 +1 @@
#define Xorriso_timestamP "2010.10.15.125440"
#define Xorriso_timestamP "2010.10.18.155353"