New API call isoburn_igopt_set_system_area()

This commit is contained in:
Thomas Schmitt 2010-04-06 12:51:15 +00:00
parent 24bbe47f18
commit 8d7df2b2ff
4 changed files with 80 additions and 1 deletions

View File

@ -449,6 +449,14 @@ int isoburn_prepare_disc_aux(struct burn_drive *in_d, struct burn_drive *out_d,
iso_write_opts_set_default_gid(wopts, opts->gid); iso_write_opts_set_default_gid(wopts, opts->gid);
iso_write_opts_set_output_charset(wopts, opts->output_charset); iso_write_opts_set_output_charset(wopts, opts->output_charset);
iso_write_opts_set_fifo_size(wopts, fifo_chunks); iso_write_opts_set_fifo_size(wopts, fifo_chunks);
ret = iso_write_opts_set_system_area(wopts, opts->system_area_data,
opts->system_area_options, 0);
if (ret < 0) {
isoburn_report_iso_error(ret, "Cannot set content of System Area",
0, "FAILURE", 0);
{ret= -1; goto ex;}
}
ret = isoburn_disc_track_lba_nwa(out_d, NULL, 0, &lba, &nwa); ret = isoburn_disc_track_lba_nwa(out_d, NULL, 0, &lba, &nwa);
opts->effective_lba= nwa; opts->effective_lba= nwa;
@ -850,6 +858,8 @@ int isoburn_igopt_new(struct isoburn_imgen_opts **new_o, int flag)
o->fifo_size= 4*1024*1024; o->fifo_size= 4*1024*1024;
o->effective_lba= -1; o->effective_lba= -1;
o->data_start_lba= -1; o->data_start_lba= -1;
o->system_area_data= NULL;
o->system_area_options= 0;
return(1); return(1);
} }
@ -1061,3 +1071,35 @@ int isoburn_igopt_get_scdbackup_tag(struct isoburn_imgen_opts *o,
return(1); return(1);
} }
int isoburn_igopt_set_system_area(struct isoburn_imgen_opts *opts,
char data[32768], int options)
{
if (data == NULL) { /* Disable */
if (opts->system_area_data != NULL)
free(opts->system_area_data);
opts->system_area_data = NULL;
} else {
if (opts->system_area_data == NULL) {
opts->system_area_data = calloc(32768, 1);
if (opts->system_area_data == NULL)
return(-1);
}
memcpy(opts->system_area_data, data, 32768);
}
opts->system_area_options = options & 1;
return(1);
}
int isoburn_igopt_get_system_area(struct isoburn_imgen_opts *opts,
char data[32768], int *options)
{
*options= opts->system_area_options;
if(opts->system_area_data == NULL)
return(0);
memcpy(data, opts->system_area_data, 32768);
return(1);
}

View File

@ -488,6 +488,20 @@ struct isoburn_imgen_opts {
char scdbackup_tag_time[19]; char scdbackup_tag_time[19];
char *scdbackup_tag_written; char *scdbackup_tag_written;
/* Content of an embedded boot image. Valid if not NULL.
* In that case it must point to a memory buffer at least 32 kB.
*/
char *system_area_data;
/*
* bit0= make bytes 446 - 512 of the system area a partition
* table which reserves partition 1 from byte 63*512 to the
* end of the ISO image. Assumed are 63 secs/hed, 255 head/cyl.
* (GRUB protective msdos label.)
* This works with and without system_area_data.
*/
int system_area_options;
}; };

View File

@ -1167,6 +1167,29 @@ int isoburn_igopt_get_scdbackup_tag(struct isoburn_imgen_opts *o,
char **tag_written); char **tag_written);
/** Attach 32 kB of binary data which shall get written to the first 32 kB
of the ISO image, the System Area.
options can cause manipulations of these data before writing happens.
If system area data are giveni or options bit0 is set, then bit1 of
el_torito_set_isolinux_options() is automatically disabled.
@since 0.5.4
@param o The option set to work on
@param data Either NULL or 32 kB of data. Do not submit less bytes !
@param options Can cause manipulations of submitted data before they
get written:
bit0= apply a --protective-msdos-label as of grub-mkisofs.
This means to patch bytes 446 to 512 of the system
area so that one partition is defined which begins
at the second 512-byte block of the image and ends
where the image ends.
@return 1 success, 0 no data to get, <0 failure
*/
int isoburn_igopt_set_system_area(struct isoburn_imgen_opts *o,
char data[32768], int options);
int isoburn_igopt_get_system_area(struct isoburn_imgen_opts *o,
char data[32768], int *options);
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
/* End of Options for image generation */ /* End of Options for image generation */
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */

View File

@ -1 +1 @@
#define Xorriso_timestamP "2010.04.05.192817" #define Xorriso_timestamP "2010.04.06.125013"