From 0e755f48c99b120fbebe6f6331e960fdb186405f Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 5 Sep 2010 11:36:53 +0000 Subject: [PATCH] New API function isoburn_igopt_set_part_offset(), requiring libisofs 0.6.35 --- libisoburn/isoburn.c | 59 +++++++++++++++++++++++++++++++++++++ libisoburn/isoburn.h | 21 +++++++++++++ libisoburn/libisoburn.h | 41 +++++++++++++++++++++++++- xorriso/xorriso_timestamp.h | 2 +- 4 files changed, 121 insertions(+), 2 deletions(-) diff --git a/libisoburn/isoburn.c b/libisoburn/isoburn.c index 2fbf46e7..8490ab46 100644 --- a/libisoburn/isoburn.c +++ b/libisoburn/isoburn.c @@ -487,6 +487,39 @@ int isoburn_prepare_disc_aux(struct burn_drive *in_d, struct burn_drive *out_d, iso_write_opts_set_overwrite_buf(wopts, nwa>0 ? out_o->target_iso_head : NULL); + if (opts->partition_offset > 0) { + + if (nwa > 0) { + /* >>> refuse because for now this works only for single session with + no_emul_toc + <<< to be removed when multi session stuff is fully ready + */ + isoburn_msgs_submit(in_o, 0x00060000, + "Programming error: non-zero NWA combined with partition offset", + 0, "FATAL", 0); + {ret= -4; goto ex;} + } + + iso_write_opts_set_part_offset(wopts, opts->partition_offset, + opts->partition_secs_per_head, + opts->partition_heads_per_cyl); + } +#ifdef Libisoburn_partition_offseT +#if Libisoburn_partition_offseT >= 16 + + else { + /* <<< For preliminary testing of emulated TOC and partition offset. + Problem is that only this macro can prepare the overwrite buffer + for partition offset yet. Emulated TOC does not work yet. + */ + iso_write_opts_set_part_offset(wopts, + (uint32_t) Libisoburn_partition_offseT, + 0, 0); + } + +#endif +#endif + ret = iso_image_create_burn_source(in_o->image, wopts, &wsrc); if (ret < 0) { isoburn_report_iso_error(ret, "Cannot create burn source", 0, "FAILURE", 0); @@ -877,6 +910,9 @@ int isoburn_igopt_new(struct isoburn_imgen_opts **new_o, int flag) o->data_start_lba= -1; o->system_area_data= NULL; o->system_area_options= 0; + o->partition_offset= 0; + o->partition_secs_per_head= 0; + o->partition_heads_per_cyl= 0; o->vol_creation_time= 0; o->vol_modification_time= 0; o->vol_expiration_time= 0; @@ -1157,3 +1193,26 @@ int isoburn_igopt_get_pvd_times(struct isoburn_imgen_opts *opts, } +int isoburn_igopt_set_part_offset(struct isoburn_imgen_opts *opts, + uint32_t block_offset_2k, + int secs_512_per_head, int heads_per_cyl) +{ + if (block_offset_2k > 0 && block_offset_2k < 16) + return(0); + opts->partition_offset = block_offset_2k; + opts->partition_secs_per_head = secs_512_per_head; + opts->partition_heads_per_cyl = heads_per_cyl; + return(1); +} + + +int isoburn_igopt_get_part_offset(struct isoburn_imgen_opts *opts, + uint32_t *block_offset_2k, + int *secs_512_per_head, int *heads_per_cyl) +{ + *block_offset_2k = opts->partition_offset; + *secs_512_per_head = opts->partition_secs_per_head; + *heads_per_cyl = opts->partition_heads_per_cyl; + return 1; +} + diff --git a/libisoburn/isoburn.h b/libisoburn/isoburn.h index 03323ecc..53aa91cd 100644 --- a/libisoburn/isoburn.h +++ b/libisoburn/isoburn.h @@ -36,10 +36,20 @@ int isoburn_toc_entry_new(struct isoburn_toc_entry **objpt, int isoburn_toc_entry_destroy(struct isoburn_toc_entry **o, int flag); +/* >>> TWINTREE : provisory test of partition offset with emulated TOC. + .target_iso_head must become dynamically allocated +#define Libisoburn_partition_offseT 16 +*/ + + /* Size of target_iso_head which is to be written during isoburn_activate_session() */ +#ifdef Libisoburn_partition_offseT +#define Libisoburn_target_head_sizE (32*2048 +Libisoburn_partition_offseT*2048) +#else #define Libisoburn_target_head_sizE (32*2048) +#endif struct isoburn { @@ -520,6 +530,17 @@ struct isoburn_imgen_opts { and timezone 0 */ char vol_uuid[17]; + /* TWINTREE: The number of unclaimed 2K blocks before + start of partition 1 as of the MBR in system area. + If not 0 this will cause double volume descriptor sets + and double tree. + */ + uint32_t partition_offset; + /* TWINTREE: Partition table parameter: 1 to 63, 0= disabled/default */ + int partition_secs_per_head; + /* TWINTREE: 1 to 255, 0= disabled/default */ + int partition_heads_per_cyl; + }; diff --git a/libisoburn/libisoburn.h b/libisoburn/libisoburn.h index 5702eda8..531dc874 100644 --- a/libisoburn/libisoburn.h +++ b/libisoburn/libisoburn.h @@ -224,7 +224,7 @@ void isoburn_version(int *major, int *minor, int *micro); */ #define isoburn_libisofs_req_major 0 #define isoburn_libisofs_req_minor 6 -#define isoburn_libisofs_req_micro 34 +#define isoburn_libisofs_req_micro 35 /** The minimum version of libburn to be used with this version of libisoburn at compile time. @@ -1222,6 +1222,44 @@ int isoburn_igopt_set_system_area(struct isoburn_imgen_opts *o, int isoburn_igopt_get_system_area(struct isoburn_imgen_opts *o, char data[32768], int *options); +/** >>> TWINTREE : Under Construction. + Do not use yet for multi-session + + Control production of a second set of volume descriptors (ISO 9660 superblock) + and directory trees, together with a partition table entry in the MBR which + has non-zero start address. + The second volume descriptor set and trees will allow to mount the ISO image + at the start of the first partition, while it is still possible to mount it + via the normal fist volume descriptor set and tree at the start of the device. + This makes few sense on optical media. Nevertheless it creates a conventional + partition table on USB sticks which then are mountable on Linux via /dev/sdb + and /dev/sdb1 alike. + + >>> Not combinable with multi-session yet. + + @since 0.6.2 + @param opts + The option set to be manipulated. + @param block_offset_2k + The offset of the partition start relative to device start. + This is counted in 2 kB blocks. The partition table will show the + according number of 512 byte sectors. + Default is 0 which causes no second set and trees. + If it is not 0 then it must not be smaller than 16. + @param secs_512_per_head + Number of 512 byte sectors per head. 1 to 63. 0=automatic. + @param heads_per_cyl + Number of heads per cylinder. 1 to 255. 0=automatic. + @return 1 success, <=0 failure + */ +int isoburn_igopt_set_part_offset(struct isoburn_imgen_opts *opts, + uint32_t block_offset_2k, + int secs_512_per_head, int heads_per_cyl); +int isoburn_igopt_get_part_offset(struct isoburn_imgen_opts *opts, + uint32_t *block_offset_2k, + int *secs_512_per_head, int *heads_per_cyl); + + /** Explicitely set the four timestamps of the emerging ISO image. Default with all parameters is 0. @since 0.5.4 @@ -1260,6 +1298,7 @@ int isoburn_igopt_get_pvd_times(struct isoburn_imgen_opts *opts, time_t *expiration_time, time_t *effective_time, char uuid[17]); + /* ----------------------------------------------------------------------- */ /* End of Options for image generation */ /* ----------------------------------------------------------------------- */ diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index afdc3508..03942b96 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2010.09.04.100823" +#define Xorriso_timestamP "2010.09.05.113621"