New API call isoburn_igopt_set_part_flag() and libisofs interval reader flags

This commit is contained in:
Thomas Schmitt 2015-04-23 13:51:44 +00:00
parent 9624cdd825
commit 5cd5f6abf9
6 changed files with 114 additions and 8 deletions

View File

@ -521,7 +521,8 @@ int isoburn_make_iso_write_opts(struct isoburn *out_o,
opts->partition_heads_per_cyl); opts->partition_heads_per_cyl);
iso_write_opts_set_tail_blocks(wopts, opts->tail_blocks); iso_write_opts_set_tail_blocks(wopts, opts->tail_blocks);
if(opts->prep_partition != NULL) { if(opts->prep_partition != NULL) {
ret = iso_write_opts_set_prep_img(wopts, opts->prep_partition, 0); ret = iso_write_opts_set_prep_img(wopts, opts->prep_partition,
opts->prep_part_flag & 1);
if(ret < 0) { if(ret < 0) {
isoburn_report_iso_error(ret, "Cannot set path for PreP partition", isoburn_report_iso_error(ret, "Cannot set path for PreP partition",
0, "FAILURE", 0); 0, "FAILURE", 0);
@ -529,7 +530,8 @@ int isoburn_make_iso_write_opts(struct isoburn *out_o,
} }
} }
if(opts->efi_boot_partition != NULL) { if(opts->efi_boot_partition != NULL) {
ret = iso_write_opts_set_efi_bootp(wopts, opts->efi_boot_partition, 0); ret = iso_write_opts_set_efi_bootp(wopts, opts->efi_boot_partition,
opts->efi_boot_part_flag & 1);
if(ret < 0) { if(ret < 0) {
isoburn_report_iso_error(ret, "Cannot set path for EFI system partition", isoburn_report_iso_error(ret, "Cannot set path for EFI system partition",
0, "FAILURE", 0); 0, "FAILURE", 0);
@ -541,7 +543,8 @@ int isoburn_make_iso_write_opts(struct isoburn *out_o,
continue; continue;
ret= iso_write_opts_set_partition_img(wopts, i + 1, ret= iso_write_opts_set_partition_img(wopts, i + 1,
opts->appended_part_types[i], opts->appended_part_types[i],
opts->appended_partitions[i], 0); opts->appended_partitions[i],
opts->appended_part_flags[i]);
if(ret < 0) { if(ret < 0) {
isoburn_report_iso_error(ret, "Cannot set path for appended partition", isoburn_report_iso_error(ret, "Cannot set path for appended partition",
0, "FAILURE", 0); 0, "FAILURE", 0);
@ -1128,10 +1131,13 @@ int isoburn_igopt_new(struct isoburn_imgen_opts **new_o, int flag)
o->libjte_handle= NULL; o->libjte_handle= NULL;
o->tail_blocks= 0; o->tail_blocks= 0;
o->prep_partition= NULL; o->prep_partition= NULL;
o->prep_part_flag= 0;
o->efi_boot_partition= NULL; o->efi_boot_partition= NULL;
o->efi_boot_part_flag= 0;
for(i= 0; i < Libisoburn_max_appended_partitionS; i++) { for(i= 0; i < Libisoburn_max_appended_partitionS; i++) {
o->appended_partitions[i]= NULL; o->appended_partitions[i]= NULL;
o->appended_part_types[i]= 0; o->appended_part_types[i]= 0;
o->appended_part_flags[i]= 0;
} }
memset(o->hfsp_serial_number, 0, 8); memset(o->hfsp_serial_number, 0, 8);
o->hfsp_block_size= 0; o->hfsp_block_size= 0;
@ -1586,6 +1592,7 @@ int isoburn_igopt_set_prep_partition(struct isoburn_imgen_opts *o,
if(o->prep_partition != NULL) if(o->prep_partition != NULL)
free(o->prep_partition); free(o->prep_partition);
o->prep_partition= NULL; o->prep_partition= NULL;
o->prep_part_flag= 0;
if(path != NULL) { if(path != NULL) {
o->prep_partition= strdup(path); o->prep_partition= strdup(path);
if(o->prep_partition == NULL) { if(o->prep_partition == NULL) {
@ -1593,6 +1600,7 @@ int isoburn_igopt_set_prep_partition(struct isoburn_imgen_opts *o,
return(-1); return(-1);
} }
} }
o->prep_part_flag= flag & 1;
return(1); return(1);
} }
@ -1601,6 +1609,8 @@ int isoburn_igopt_get_prep_partition(struct isoburn_imgen_opts *opts,
char **path, int flag) char **path, int flag)
{ {
*path= opts->prep_partition; *path= opts->prep_partition;
if(flag & 1)
return(1 + (opts->prep_part_flag & 0x3fffffff));
return(1); return(1);
} }
@ -1611,6 +1621,7 @@ int isoburn_igopt_set_efi_bootp(struct isoburn_imgen_opts *o,
if(o->efi_boot_partition != NULL) if(o->efi_boot_partition != NULL)
free(o->efi_boot_partition); free(o->efi_boot_partition);
o->efi_boot_partition= NULL; o->efi_boot_partition= NULL;
o->efi_boot_part_flag= 0;
if(path != NULL) { if(path != NULL) {
o->efi_boot_partition= strdup(path); o->efi_boot_partition= strdup(path);
if(o->efi_boot_partition == NULL) { if(o->efi_boot_partition == NULL) {
@ -1618,6 +1629,7 @@ int isoburn_igopt_set_efi_bootp(struct isoburn_imgen_opts *o,
return(-1); return(-1);
} }
} }
o->efi_boot_part_flag = flag & 1;
return(1); return(1);
} }
@ -1626,6 +1638,8 @@ int isoburn_igopt_get_efi_bootp(struct isoburn_imgen_opts *opts,
char **path, int flag) char **path, int flag)
{ {
*path= opts->efi_boot_partition; *path= opts->efi_boot_partition;
if(flag & 1)
return(1 + (opts->efi_boot_part_flag & 0x3fffffff));
return(1); return(1);
} }
@ -1675,6 +1689,39 @@ int isoburn_igopt_get_partition_img(struct isoburn_imgen_opts *opts,
} }
int isoburn_igopt_set_part_flag(struct isoburn_imgen_opts *opts,
int partition_number, int flag)
{
char msg[80];
if (partition_number < 1 ||
partition_number > Libisoburn_max_appended_partitionS) {
sprintf(msg, "Partition number is out of range (1 ... %d)",
Libisoburn_max_appended_partitionS);
isoburn_msgs_submit(NULL, 0x00060000, msg, 0, "FAILURE", 0);
return(0);
}
opts->appended_part_flags[partition_number - 1]= flag;
return(1);
}
int isoburn_igopt_get_part_flags(struct isoburn_imgen_opts *opts,
int num_entries, int part_flags[])
{
int i, max_entry= 0;
for(i= 0; i < num_entries; i++)
part_flags[i]= 0;
for(i= 0; i < Libisoburn_max_appended_partitionS; i++) {
if(i < num_entries)
part_flags[i]= opts->appended_part_flags[i];
max_entry= i + 1;
}
return(max_entry);
}
int isoburn_igopt_set_appended_as_gpt(struct isoburn_imgen_opts *opts, int gpt) int isoburn_igopt_set_appended_as_gpt(struct isoburn_imgen_opts *opts, int gpt)
{ {
opts->appended_as_gpt= !!gpt; opts->appended_as_gpt= !!gpt;

View File

@ -676,13 +676,16 @@ struct isoburn_imgen_opts {
/* Disk file paths of content of PreP partition and EFI system partition */ /* Disk file paths of content of PreP partition and EFI system partition */
char *prep_partition; char *prep_partition;
int prep_part_flag;
char *efi_boot_partition; char *efi_boot_partition;
int efi_boot_part_flag;
/* Eventual disk file paths of prepared images which shall be appended /* Eventual disk file paths of prepared images which shall be appended
after the ISO image and described by partiton table entries in a MBR. after the ISO image and described by partiton table entries in a MBR.
*/ */
char *appended_partitions[Libisoburn_max_appended_partitionS]; char *appended_partitions[Libisoburn_max_appended_partitionS];
uint8_t appended_part_types[Libisoburn_max_appended_partitionS]; uint8_t appended_part_types[Libisoburn_max_appended_partitionS];
int appended_part_flags[Libisoburn_max_appended_partitionS];
/* If 1: With appended partitions: create protective MBR and mark by GPT /* If 1: With appended partitions: create protective MBR and mark by GPT
*/ */

View File

@ -280,6 +280,7 @@ displacement_rollover:;
iso_read_opts_set_input_charset(ropts, read_opts->input_charset); iso_read_opts_set_input_charset(ropts, read_opts->input_charset);
iso_read_opts_auto_input_charset(ropts, read_opts->auto_input_charset); iso_read_opts_auto_input_charset(ropts, read_opts->auto_input_charset);
iso_read_opts_load_system_area(ropts, 1); iso_read_opts_load_system_area(ropts, 1);
iso_read_opts_keep_import_src(ropts, 1);
ds = isoburn_data_source_new(d, read_opts->displacement, ds = isoburn_data_source_new(d, read_opts->displacement,
read_opts->displacement_sign, read_opts->displacement_sign,

View File

@ -242,7 +242,7 @@ void isoburn_version(int *major, int *minor, int *micro);
*/ */
#define isoburn_libisofs_req_major 1 #define isoburn_libisofs_req_major 1
#define isoburn_libisofs_req_minor 3 #define isoburn_libisofs_req_minor 3
#define isoburn_libisofs_req_micro 8 #define isoburn_libisofs_req_micro 9
/** The minimum version of libburn to be used with this version of libisoburn /** The minimum version of libburn to be used with this version of libisoburn
at compile time. at compile time.
@ -1711,7 +1711,13 @@ int isoburn_igopt_get_tail_blocks(struct isoburn_imgen_opts *opts,
@param path @param path
File address in the local file system. File address in the local file system.
@param flag @param flag
Reserved for future usage, set to 0. With isoburn_igopt_set_prep_partition():
Control bits as of iso_write_opts_set_efi_bootp()
bit0= The path contains instructions for the interval libisofs
reader. See libisofs.h.
@since 1.4.0
With isoburn_igopt_get_prep_partition():
bit0= add the current flag setting & 0x3fffffff to return value 1.
@return 1 success, <=0 failure @return 1 success, <=0 failure
*/ */
int isoburn_igopt_set_prep_partition(struct isoburn_imgen_opts *opts, int isoburn_igopt_set_prep_partition(struct isoburn_imgen_opts *opts,
@ -1719,14 +1725,24 @@ int isoburn_igopt_set_prep_partition(struct isoburn_imgen_opts *opts,
int isoburn_igopt_get_prep_partition(struct isoburn_imgen_opts *opts, int isoburn_igopt_get_prep_partition(struct isoburn_imgen_opts *opts,
char **path, int flag); char **path, int flag);
/** Copy a data file from the local filesystem into the emerging ISO image. /** Copy a data file from the local filesystem into the emerging ISO image
and mark it by a GPT entry as EFI system partition.
@since 1.2.4 @since 1.2.4
@param opts @param opts
The option set to be manipulated. The option set to be manipulated.
@param path @param path
File address in the local file system. File address in the local file system.
Instead of a disk path, the word --efi-boot-image may be given.
It exposes in GPT the content of the first El Torito EFI boot image
as EFI system partition.
@param flag @param flag
Reserved for future usage, set to 0. With isoburn_igopt_get_efi_bootp():
Control bits as of iso_write_opts_set_efi_bootp()
bit0= The path contains instructions for the interval libisofs
reader. See libisofs.h.
@since 1.4.0
With isoburn_igopt_set_efi_bootp():
bit0= add the current flag setting & 0x3fffffff to return value 1.
@return 1 success, <=0 failure @return 1 success, <=0 failure
*/ */
int isoburn_igopt_set_efi_bootp(struct isoburn_imgen_opts *opts, int isoburn_igopt_set_efi_bootp(struct isoburn_imgen_opts *opts,
@ -1791,6 +1807,43 @@ int isoburn_igopt_get_partition_img(struct isoburn_imgen_opts *opts,
char *image_paths[]); char *image_paths[]);
/** Set flag bits for a partition defined by isoburn_igopt_set_partition_img().
The bits will be forwarded to libisofs iso_write_opts_set_partition_img().
@since 1.4.0
@param opts
The option set to be manipulated.
@param partition_number
Depicts the partition table entry to which shall the flags bits
shall apply.
@param flag
Control bits as of iso_write_opts_set_partition_img()
bit0= The path contains instructions for the interval libisofs
reader. See libisofs.h.
@since 1.4.0
@return
<=0 = error, 1 = success
*/
int isoburn_igopt_set_part_flag(struct isoburn_imgen_opts *opts,
int partition_number, int flag);
/** Inquire the current settings made by isoburn_igopt_set_part_flags().
@since 1.4.0
@param opts
The option set to be inquired.
@param num_entries
Number of array elements in part_flags[].
@param part_flags
The array elements 0 to num_entries - 1 will get filled by the
flag bits of the images of the corresponding partition.
@return
<0 = error
0 = no partition image set
>0 highest used partition number
*/
int isoburn_igopt_get_part_flags(struct isoburn_imgen_opts *opts,
int num_entries, int part_flags[]);
/** Control whether partitions created by iso_write_opts_set_partition_img() /** Control whether partitions created by iso_write_opts_set_partition_img()
are to be represented in MBR or as GPT partitions. are to be represented in MBR or as GPT partitions.
@since 1.4.0 @since 1.4.0

View File

@ -41,6 +41,7 @@ isoburn_igopt_get_level;
isoburn_igopt_get_out_charset; isoburn_igopt_get_out_charset;
isoburn_igopt_get_over_mode; isoburn_igopt_get_over_mode;
isoburn_igopt_get_over_ugid; isoburn_igopt_get_over_ugid;
isoburn_igopt_get_part_flags;
isoburn_igopt_get_partition_img; isoburn_igopt_get_partition_img;
isoburn_igopt_get_prep_partition; isoburn_igopt_get_prep_partition;
isoburn_igopt_get_pvd_times; isoburn_igopt_get_pvd_times;
@ -65,6 +66,7 @@ isoburn_igopt_set_level;
isoburn_igopt_set_out_charset; isoburn_igopt_set_out_charset;
isoburn_igopt_set_over_mode; isoburn_igopt_set_over_mode;
isoburn_igopt_set_over_ugid; isoburn_igopt_set_over_ugid;
isoburn_igopt_set_part_flag;
isoburn_igopt_set_partition_img; isoburn_igopt_set_partition_img;
isoburn_igopt_set_prep_partition; isoburn_igopt_set_prep_partition;
isoburn_igopt_set_pvd_times; isoburn_igopt_set_pvd_times;

View File

@ -1 +1 @@
#define Xorriso_timestamP "2015.03.03.201723" #define Xorriso_timestamP "2015.04.23.135054"