From f18e352251bae0ea132c09b6ed42520c17f5a448 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Fri, 5 Nov 2010 14:39:36 +0000 Subject: [PATCH] New API calls isoburn_igopt_set_disc_label(), isoburn_igopt_get_disc_label() --- libisoburn/isoburn.c | 35 +++++++++++++----- libisoburn/isoburn.h | 18 ++++++++-- libisoburn/libisoburn.h | 72 ++++++++++++++++++++++++++++++------- libisoburn/libisoburn.ver | 2 ++ xorriso/xorriso_timestamp.h | 2 +- 5 files changed, 106 insertions(+), 23 deletions(-) diff --git a/libisoburn/isoburn.c b/libisoburn/isoburn.c index e3188146..e16a3f09 100644 --- a/libisoburn/isoburn.c +++ b/libisoburn/isoburn.c @@ -533,7 +533,7 @@ 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++) { + for(i= 0; i < Libisoburn_max_appended_partitionS; i++) { if(opts->appended_partitions[i] == NULL) continue; ret= iso_write_opts_set_partition_img(wopts, i + 1, @@ -545,6 +545,7 @@ int isoburn_prepare_disc_aux(struct burn_drive *in_d, struct burn_drive *out_d, {ret= -1; goto ex;} } } + iso_write_opts_set_disc_label(wopts, opts->ascii_disc_label); ret = iso_image_create_burn_source(in_o->image, wopts, &wsrc); if (ret < 0) { @@ -946,7 +947,7 @@ 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++) { + for(i= 0; i < Libisoburn_max_appended_partitionS; i++) { o->appended_partitions[i]= NULL; o->appended_part_types[i]= 0; } @@ -960,7 +961,7 @@ int isoburn_igopt_destroy(struct isoburn_imgen_opts **o, int flag) if(*o==NULL) return(0); - for(i= 0; i < 4; i++) + for(i= 0; i < Libisoburn_max_appended_partitionS; i++) if((*o)->appended_partitions[i] != NULL) free((*o)->appended_partitions[i]); free(*o); @@ -1292,10 +1293,13 @@ 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); + 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); } if (opts->appended_partitions[partition_number - 1] != NULL) @@ -1317,7 +1321,7 @@ int isoburn_igopt_get_partition_img(struct isoburn_imgen_opts *opts, for(i= 0; i < num_entries; i++) image_paths[i]= NULL; - for(i= 0; i < 4; i++) { + for(i= 0; i < Libisoburn_max_appended_partitionS; i++) { if(opts->appended_partitions[i] == NULL) continue; if(i < num_entries) { @@ -1329,3 +1333,18 @@ int isoburn_igopt_get_partition_img(struct isoburn_imgen_opts *opts, return(max_entry); } + +int isoburn_igopt_set_disc_label(struct isoburn_imgen_opts *opts, char *label) +{ + strncpy(opts->ascii_disc_label, label, Libisoburn_disc_label_sizE - 1); + opts->ascii_disc_label[Libisoburn_disc_label_sizE - 1] = 0; + return(1); +} + + +int isoburn_igopt_get_disc_label(struct isoburn_imgen_opts *opts, char **label) +{ + *label= opts->ascii_disc_label; + return(1); +} + diff --git a/libisoburn/isoburn.h b/libisoburn/isoburn.h index ad0c769c..00acfed1 100644 --- a/libisoburn/isoburn.h +++ b/libisoburn/isoburn.h @@ -45,6 +45,17 @@ int isoburn_toc_entry_destroy(struct isoburn_toc_entry **o, int flag); #define Libisoburn_target_head_sizE (32*2048) +/* Maximum number of appended partitions. Effectively usable number depends + on system area type. +*/ +#define Libisoburn_max_appended_partitionS 8 + +/* + Maximum length of a disc label text plus 1. +*/ +#define Libisoburn_disc_label_sizE 129 + + struct isoburn { @@ -556,9 +567,12 @@ struct isoburn_imgen_opts { /* 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]; + char *appended_partitions[Libisoburn_max_appended_partitionS]; + uint8_t appended_part_types[Libisoburn_max_appended_partitionS]; + /* Eventual name of the non-ISO aspect of the image. E.g. SUN ASCII label. + */ + char ascii_disc_label[Libisoburn_disc_label_sizE]; }; diff --git a/libisoburn/libisoburn.h b/libisoburn/libisoburn.h index 35a8765f..286058ed 100644 --- a/libisoburn/libisoburn.h +++ b/libisoburn/libisoburn.h @@ -1239,10 +1239,22 @@ int isoburn_igopt_get_scdbackup_tag(struct isoburn_imgen_opts *o, else: unspecified type @since 0.6.4 1= MIPS Big Endian Volume Header - >>> EXPERIMENTAL: - Submit MIPS boot image files as El Torito Boot image to - iso_image_set_boot_image() , iso_image_add_boot_image(). - No El Torito info will be produced with system area type 1. + Submit up to 15 MIPS Big Endian boot files by + iso_image_add_mips_boot_file() of libisofs. + This will overwrite the first 512 bytes of + the submitted data. + 2= DEC Boot Block for MIPS Little Endian + The first boot file submitted by + iso_image_add_mips_boot_file() will be activated. + This will overwrite the first 512 bytes of + the submitted data. + @since 0.6.6 + 3= SUN Disk Label for SUN SPARC + Submit up to 7 SPARC boot images by + isoburn_igopt_set_partition_img() for partition + numbers 2 to 8. + This will overwrite the first 512 bytes of + the submitted data. @return 1 success, 0 no data to get, <0 failure */ @@ -1375,23 +1387,31 @@ int isoburn_igopt_get_tail_blocks(struct isoburn_imgen_opts *opts, /** 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. + described by a partition table entry in an MBR or SUN Disk Label 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. + MBR or SUN Disk Label are selected by isoburn_igopt_set_system_area() + system area type: 0 selects MBR partition table. 3 selects a SUN partition + table with 320 kB start alignment. @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 + appended image. + Range with MBR: 1 to 4. 1 will cause the whole ISO image to be + unclaimable space before partition 1. + @since 0.6.6 + Range with SUN Disk Label: 2 to 8. + @param image_path File address in the local file system. + With SUN Disk Label: an empty name causes the partition to become + a copy of the next lower partition. @param image_type - The partition type. E.g. FAT12 = 0x01 , FAT16 = 0x06, + The MBR partition type. E.g. FAT12 = 0x01 , FAT16 = 0x06, Linux Native Partition = 0x83. See fdisk command L. + This parameter is ignored with SUN Disk Label. @return <=0 = error, 1 = success */ @@ -1410,7 +1430,7 @@ int isoburn_igopt_set_partition_img(struct isoburn_imgen_opts *opts, 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, + with a file address resp. an empty text. @return <0 = error 0 = no partition image set @@ -1422,6 +1442,34 @@ int isoburn_igopt_get_partition_img(struct isoburn_imgen_opts *opts, char *image_paths[]); +/** Set a name for the system area. This setting is ignored unless system area + type 3 "SUN Disk Label" is in effect by iso_write_opts_set_system_area(). + In this case it will replace the default text at the start of the image: + "CD-ROM Disc with Sun sparc boot created by libisofs" + @since 0.6.6 + @param opts + The option set to be manipulated. + @param label + A text of up to 128 characters. + @return + <=0 = error, 1 = success +*/ +int isoburn_igopt_set_disc_label(struct isoburn_imgen_opts *opts, char *label); + +/** Inquire the current setting made by isoburn_igopt_set_disc_label(). + @since 0.6.6 + @param opts + The option set to be inquired. + @param label + Returns a pointer to the currently set label string. + Do not alter this string. + Use only as long as the opts object exists. + @return + <=0 = error, 1 = success +*/ +int isoburn_igopt_get_disc_label(struct isoburn_imgen_opts *opts, + char **label); + /* ----------------------------------------------------------------------- */ /* End of Options for image generation */ diff --git a/libisoburn/libisoburn.ver b/libisoburn/libisoburn.ver index e528ba94..5c1b25b7 100644 --- a/libisoburn/libisoburn.ver +++ b/libisoburn/libisoburn.ver @@ -25,6 +25,7 @@ isoburn_igopt_attach_jte; isoburn_igopt_destroy; isoburn_igopt_detach_jte; isoburn_igopt_get_data_start; +isoburn_igopt_get_disc_label; isoburn_igopt_get_effective_lba; isoburn_igopt_get_extensions; isoburn_igopt_get_fifo_size; @@ -40,6 +41,7 @@ isoburn_igopt_get_sort_files; isoburn_igopt_get_system_area; isoburn_igopt_get_tail_blocks; isoburn_igopt_new; +isoburn_igopt_set_disc_label; isoburn_igopt_set_extensions; isoburn_igopt_set_fifo_size; isoburn_igopt_set_level; diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 4090b908..fcf48d3e 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2010.11.03.081124" +#define Xorriso_timestamP "2010.11.05.143916"