New API calls isoburn_igopt_set_gpt_guid(), isoburn_igopt_get_gpt_guid()

This commit is contained in:
Thomas Schmitt 2016-08-12 18:46:36 +00:00
parent c1e7b52ba4
commit 51670e47b7
5 changed files with 82 additions and 2 deletions

View File

@ -405,7 +405,7 @@ int isoburn_make_iso_write_opts(struct isoburn *out_o,
IsoWriteOpts *wopts, IsoWriteOpts *wopts,
int flag) int flag)
{ {
int ret, rec_mtime, new_img, lba, nwa, i; int ret, rec_mtime, new_img, lba, nwa, i, guid_mode;
struct burn_drive *out_d; struct burn_drive *out_d;
new_img= flag&1; new_img= flag&1;
@ -477,6 +477,10 @@ int isoburn_make_iso_write_opts(struct isoburn *out_o,
opts->vol_creation_time, opts->vol_modification_time, opts->vol_creation_time, opts->vol_modification_time,
opts->vol_expiration_time, opts->vol_effective_time, opts->vol_expiration_time, opts->vol_effective_time,
opts->vol_uuid); opts->vol_uuid);
guid_mode= opts->gpt_guid_mode;
if(opts->vol_uuid[0] == 0 && opts->gpt_guid_mode == 2)
guid_mode= 0;
iso_write_opts_set_gpt_guid(wopts, opts->gpt_guid, guid_mode);
iso_write_opts_attach_jte(wopts, opts->libjte_handle); iso_write_opts_attach_jte(wopts, opts->libjte_handle);
iso_write_opts_set_hfsp_serial_number(wopts, opts->hfsp_serial_number); iso_write_opts_set_hfsp_serial_number(wopts, opts->hfsp_serial_number);
@ -1175,6 +1179,8 @@ int isoburn_igopt_new(struct isoburn_imgen_opts **new_o, int flag)
o->appended_as_gpt= 0; o->appended_as_gpt= 0;
o->appended_as_apm= 0; o->appended_as_apm= 0;
o->part_like_isohybrid= 0; o->part_like_isohybrid= 0;
memset(o->gpt_guid, 0, 16);
o->gpt_guid_mode= 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;
o->apm_block_size= 0; o->apm_block_size= 0;
@ -1804,6 +1810,32 @@ int isoburn_igopt_get_part_like_isohybrid(struct isoburn_imgen_opts *opts,
} }
int isoburn_igopt_set_gpt_guid(struct isoburn_imgen_opts *opts,
uint8_t guid[16], int mode)
{
if(mode < 0 || mode > 2) {
isoburn_msgs_submit(NULL, 0x00060000,
"Unrecognized GPT disk GUID setup mode. (0 ... 2)",
0, "FAILURE", 0);
return(0);
}
opts->gpt_guid_mode= mode;
if(opts->gpt_guid_mode == 1)
memcpy(opts->gpt_guid, guid, 16);
return 1;
}
int isoburn_igopt_get_gpt_guid(struct isoburn_imgen_opts *opts,
uint8_t guid[16], int *mode)
{
if(opts->gpt_guid_mode == 1)
memcpy(guid, opts->gpt_guid, 16);
*mode = opts->gpt_guid_mode;
return(1);
}
int isoburn_igopt_set_disc_label(struct isoburn_imgen_opts *opts, char *label) int isoburn_igopt_set_disc_label(struct isoburn_imgen_opts *opts, char *label)
{ {
strncpy(opts->ascii_disc_label, label, Libisoburn_disc_label_sizE - 1); strncpy(opts->ascii_disc_label, label, Libisoburn_disc_label_sizE - 1);

View File

@ -710,6 +710,11 @@ struct isoburn_imgen_opts {
*/ */
int part_like_isohybrid; int part_like_isohybrid;
/* See libisoburn.h isoburn_igopt_set_gpt_guid()
*/
uint8_t gpt_guid[16];
int gpt_guid_mode;
/* Eventual name of the non-ISO aspect of the image. E.g. SUN ASCII label. /* Eventual name of the non-ISO aspect of the image. E.g. SUN ASCII label.
*/ */
char ascii_disc_label[Libisoburn_disc_label_sizE]; char ascii_disc_label[Libisoburn_disc_label_sizE];

View File

@ -1987,6 +1987,47 @@ int isoburn_igopt_set_part_like_isohybrid(struct isoburn_imgen_opts *opts,
int isoburn_igopt_get_part_like_isohybrid(struct isoburn_imgen_opts *opts, int isoburn_igopt_get_part_like_isohybrid(struct isoburn_imgen_opts *opts,
int *alike); int *alike);
/** Control whether the emerging GPT gets a pseudo-randomly generated disk GUID
or whether it gets a user supplied GUID.
The partition GUIDs will be generated in a reproducible way by exoring a
little-endian 32 bit counter with the disk GUID beginning at byte offset 9.
@since 1.4.6
@param opts
The option set to be manipulated.
@param guid
16 bytes of user supplied GUID.
The upper 4 bit of guid[6] and guid[7] should bear the value 4 to
express the version 4 in both endiannesses. Bit 7 of byte[8] should
be set to 1 and bit 6 be set to 0, in order to express the RFC 4122
variant of GUID, where version 4 means "random".
@param mode
0 = ignore parameter guid and produce the GPT disk GUID by a
pseudo-random algorithm. This is the default setting.
1 = use parameter guid as GPT disk GUID
2 = ignore parameter guid and derive the GPT disk GUID from
parameter uuid of isoburn_igopt_set_pvd_times().
The 16 bytes of uuid get copied and bytes 6, 7, 8 get their
upper bits changed to comply to RFC 4122.
If no such uuid is given when ISO production starts, then
mode 2 defaults to mode 0.
*/
int isoburn_igopt_set_gpt_guid(struct isoburn_imgen_opts *opts,
uint8_t guid[16], int mode);
/** Inquire the current setting of isoburn_igopt_set_gpt_guid().
@since 1.4.6
@param opts
The option set to be inquired.
@param guid
Returns the current guid if current mode is 1.
@param mode
Returns the current value.
@return
<=0 = error, 1 = success
*/
int isoburn_igopt_get_gpt_guid(struct isoburn_imgen_opts *opts,
uint8_t guid[16], int *mode);
/** Set a name for the system area. This setting is ignored unless system area /** 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(). type 3 "SUN Disk Label" is in effect by iso_write_opts_set_system_area().

View File

@ -36,6 +36,7 @@ isoburn_igopt_get_effective_lba;
isoburn_igopt_get_efi_bootp; isoburn_igopt_get_efi_bootp;
isoburn_igopt_get_extensions; isoburn_igopt_get_extensions;
isoburn_igopt_get_fifo_size; isoburn_igopt_get_fifo_size;
isoburn_igopt_get_gpt_guid;
isoburn_igopt_get_hfsp_block_size; isoburn_igopt_get_hfsp_block_size;
isoburn_igopt_get_hfsp_serial_number; isoburn_igopt_get_hfsp_serial_number;
isoburn_igopt_get_level; isoburn_igopt_get_level;
@ -63,6 +64,7 @@ isoburn_igopt_set_disc_label;
isoburn_igopt_set_efi_bootp; isoburn_igopt_set_efi_bootp;
isoburn_igopt_set_extensions; isoburn_igopt_set_extensions;
isoburn_igopt_set_fifo_size; isoburn_igopt_set_fifo_size;
isoburn_igopt_set_gpt_guid;
isoburn_igopt_set_hfsp_block_size; isoburn_igopt_set_hfsp_block_size;
isoburn_igopt_set_hfsp_serial_number; isoburn_igopt_set_hfsp_serial_number;
isoburn_igopt_set_level; isoburn_igopt_set_level;

View File

@ -1 +1 @@
#define Xorriso_timestamP "2016.08.07.193333" #define Xorriso_timestamP "2016.08.12.184736"