From 5cd5f6abf9b508c91b36ce9a7c8725cdbf0ee6a8 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 23 Apr 2015 13:51:44 +0000 Subject: [PATCH] New API call isoburn_igopt_set_part_flag() and libisofs interval reader flags --- libisoburn/isoburn.c | 53 ++++++++++++++++++++++++++++++-- libisoburn/isoburn.h | 3 ++ libisoburn/isofs_wrap.c | 1 + libisoburn/libisoburn.h | 61 ++++++++++++++++++++++++++++++++++--- libisoburn/libisoburn.ver | 2 ++ xorriso/xorriso_timestamp.h | 2 +- 6 files changed, 114 insertions(+), 8 deletions(-) diff --git a/libisoburn/isoburn.c b/libisoburn/isoburn.c index 9fdb56c9..2a1fe786 100644 --- a/libisoburn/isoburn.c +++ b/libisoburn/isoburn.c @@ -521,7 +521,8 @@ int isoburn_make_iso_write_opts(struct isoburn *out_o, opts->partition_heads_per_cyl); iso_write_opts_set_tail_blocks(wopts, opts->tail_blocks); 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) { isoburn_report_iso_error(ret, "Cannot set path for PreP partition", 0, "FAILURE", 0); @@ -529,7 +530,8 @@ int isoburn_make_iso_write_opts(struct isoburn *out_o, } } 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) { isoburn_report_iso_error(ret, "Cannot set path for EFI system partition", 0, "FAILURE", 0); @@ -541,7 +543,8 @@ int isoburn_make_iso_write_opts(struct isoburn *out_o, continue; ret= iso_write_opts_set_partition_img(wopts, i + 1, opts->appended_part_types[i], - opts->appended_partitions[i], 0); + opts->appended_partitions[i], + opts->appended_part_flags[i]); if(ret < 0) { isoburn_report_iso_error(ret, "Cannot set path for appended partition", 0, "FAILURE", 0); @@ -1128,10 +1131,13 @@ int isoburn_igopt_new(struct isoburn_imgen_opts **new_o, int flag) o->libjte_handle= NULL; o->tail_blocks= 0; o->prep_partition= NULL; + o->prep_part_flag= 0; o->efi_boot_partition= NULL; + o->efi_boot_part_flag= 0; for(i= 0; i < Libisoburn_max_appended_partitionS; i++) { o->appended_partitions[i]= NULL; o->appended_part_types[i]= 0; + o->appended_part_flags[i]= 0; } memset(o->hfsp_serial_number, 0, 8); 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) free(o->prep_partition); o->prep_partition= NULL; + o->prep_part_flag= 0; if(path != NULL) { o->prep_partition= strdup(path); if(o->prep_partition == NULL) { @@ -1593,6 +1600,7 @@ int isoburn_igopt_set_prep_partition(struct isoburn_imgen_opts *o, return(-1); } } + o->prep_part_flag= flag & 1; return(1); } @@ -1601,6 +1609,8 @@ int isoburn_igopt_get_prep_partition(struct isoburn_imgen_opts *opts, char **path, int flag) { *path= opts->prep_partition; + if(flag & 1) + return(1 + (opts->prep_part_flag & 0x3fffffff)); return(1); } @@ -1611,6 +1621,7 @@ int isoburn_igopt_set_efi_bootp(struct isoburn_imgen_opts *o, if(o->efi_boot_partition != NULL) free(o->efi_boot_partition); o->efi_boot_partition= NULL; + o->efi_boot_part_flag= 0; if(path != NULL) { o->efi_boot_partition= strdup(path); if(o->efi_boot_partition == NULL) { @@ -1618,6 +1629,7 @@ int isoburn_igopt_set_efi_bootp(struct isoburn_imgen_opts *o, return(-1); } } + o->efi_boot_part_flag = flag & 1; return(1); } @@ -1626,6 +1638,8 @@ int isoburn_igopt_get_efi_bootp(struct isoburn_imgen_opts *opts, char **path, int flag) { *path= opts->efi_boot_partition; + if(flag & 1) + return(1 + (opts->efi_boot_part_flag & 0x3fffffff)); 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) { opts->appended_as_gpt= !!gpt; diff --git a/libisoburn/isoburn.h b/libisoburn/isoburn.h index 7757bc8a..de4b7abb 100644 --- a/libisoburn/isoburn.h +++ b/libisoburn/isoburn.h @@ -676,13 +676,16 @@ struct isoburn_imgen_opts { /* Disk file paths of content of PreP partition and EFI system partition */ char *prep_partition; + int prep_part_flag; char *efi_boot_partition; + int efi_boot_part_flag; /* 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[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 */ diff --git a/libisoburn/isofs_wrap.c b/libisoburn/isofs_wrap.c index ddc0b6fb..28f217d7 100644 --- a/libisoburn/isofs_wrap.c +++ b/libisoburn/isofs_wrap.c @@ -280,6 +280,7 @@ displacement_rollover:; 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_load_system_area(ropts, 1); + iso_read_opts_keep_import_src(ropts, 1); ds = isoburn_data_source_new(d, read_opts->displacement, read_opts->displacement_sign, diff --git a/libisoburn/libisoburn.h b/libisoburn/libisoburn.h index f5c15765..a82036f1 100644 --- a/libisoburn/libisoburn.h +++ b/libisoburn/libisoburn.h @@ -242,7 +242,7 @@ void isoburn_version(int *major, int *minor, int *micro); */ #define isoburn_libisofs_req_major 1 #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 at compile time. @@ -1711,7 +1711,13 @@ int isoburn_igopt_get_tail_blocks(struct isoburn_imgen_opts *opts, @param path File address in the local file system. @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 */ 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, 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 @param opts The option set to be manipulated. @param path 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 - 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 */ 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[]); +/** 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() are to be represented in MBR or as GPT partitions. @since 1.4.0 diff --git a/libisoburn/libisoburn.ver b/libisoburn/libisoburn.ver index 3d561bf8..43d294c4 100644 --- a/libisoburn/libisoburn.ver +++ b/libisoburn/libisoburn.ver @@ -41,6 +41,7 @@ isoburn_igopt_get_level; isoburn_igopt_get_out_charset; isoburn_igopt_get_over_mode; isoburn_igopt_get_over_ugid; +isoburn_igopt_get_part_flags; isoburn_igopt_get_partition_img; isoburn_igopt_get_prep_partition; isoburn_igopt_get_pvd_times; @@ -65,6 +66,7 @@ isoburn_igopt_set_level; isoburn_igopt_set_out_charset; isoburn_igopt_set_over_mode; isoburn_igopt_set_over_ugid; +isoburn_igopt_set_part_flag; isoburn_igopt_set_partition_img; isoburn_igopt_set_prep_partition; isoburn_igopt_set_pvd_times; diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 15aa7725..1611302d 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2015.03.03.201723" +#define Xorriso_timestamP "2015.04.23.135054"