From 531ea178f308644156fadc0680db96457e781c90 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 27 May 2012 16:58:51 +0000 Subject: [PATCH] New (yet inofficial) -as mkisofs option -hfsplus-serial-no --- xorriso/base_obj.c | 1 + xorriso/emulators.c | 23 ++++++++++++++++++++--- xorriso/write_run.c | 1 + xorriso/xorriso_private.h | 5 +++++ xorriso/xorriso_timestamp.h | 2 +- 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/xorriso/base_obj.c b/xorriso/base_obj.c index f67429d1..34b2809f 100644 --- a/xorriso/base_obj.c +++ b/xorriso/base_obj.c @@ -260,6 +260,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag) m->appended_part_types[i]= 0; } m->ascii_disc_label[0]= 0; + memset(m->hfsp_serial_number, 0, 8); m->vol_creation_time= 0; m->vol_modification_time= 0; m->vol_expiration_time= 0; diff --git a/xorriso/emulators.c b/xorriso/emulators.c index c65d5cae..4d79f7af 100644 --- a/xorriso/emulators.c +++ b/xorriso/emulators.c @@ -608,7 +608,7 @@ int Xorriso_genisofs_count_args(struct XorrisO *xorriso, int argc, char **argv, "--stdio_sync", "--quoted_path_list", "--efi-boot", "--embedded-boot", "-isohybrid-mbr", "-e", "-partition_offset", "-partition_hd_cyl", "-partition_sec_hd", "-partition_cyl_align", "-untranslated_name_len", - "-rr_reloc_dir", + "-rr_reloc_dir", "-hfsplus-serial-no", "" }; static char arg2_options[][41]= { @@ -729,14 +729,16 @@ int Xorriso_genisofs_help(struct XorrisO *xorriso, int flag) /* >>> ts B20523 : To be activated when HFS+ works */ +" -hfsplus Generate HFS+ filesystem", " -hide-hfsplus GLOBFILE Hide HFS+ file", " -hide-hfsplus-list FILE File with list of HFS+ files to hide", -" -hfsplus Generate HFS+ filesystem", " -hfsplus-file-creator-type CREATOR TYPE iso_rr_path", " Attach creator and type to a File", " -hfs-bless FOLDER_NAME Name of Folder to be blessed", " -hfs-bless-by BLESS_TYPE ISO_RR_PATH", " Bless ISO_RR_PATH by BLESS_TYPE {p,i,s,9,x}", +" -hfsplus-serial-no HEXSTRING", +" HFS serial number: 16 characters [0-9a-fA-F]", #endif @@ -1088,7 +1090,8 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom, int with_boot_image= 0, with_cat_path= 0, with_emul_toc= 0; int old_root_md5= 1, old_root_dev= 0, old_root_ino= 1; int *weight_list= NULL, weight_count= 0; - int *delay_opt_list= NULL, delay_opt_count= 0; + int *delay_opt_list= NULL, delay_opt_count= 0, bin_count; + uint8_t sn[8]; char *sfe= NULL, *adr= NULL, ra_text[80], *pathspec= NULL; char *ept, *add_pt, *eff_path= NULL, *indev= NULL, msc[80], *cpt; char *old_root= NULL, *argpt, *hargv[1]; @@ -1526,6 +1529,20 @@ illegal_c:; i+= arg_count; } else if(strcmp(argpt, "-hfsplus") == 0) { xorriso->do_hfsplus= 1; + } else if(strcmp(argpt, "-hfsplus-serial-no") == 0) { + if(i+1>=argc) + goto not_enough_args; + i++; + ret= Hex_to_bin(argv[i], 8, &bin_count, (unsigned char *) sn, 0); + if(ret <= 0 || bin_count != 8) { + sprintf(xorriso->info_text, + "-as %s %s : Malformed hex string. Expected 16 characters [0-9a-fA-F]", + whom, argv[i - 1]); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + ret= 0; goto ex; + } else { + memcpy(xorriso->hfsp_serial_number, sn, 8); + } } else if(strcmp(argpt, "-graft-points")==0) { xorriso->allow_graft_points= 1; } else if(strcmp(argpt, "-path-list")==0 || diff --git a/xorriso/write_run.c b/xorriso/write_run.c index 45ded673..8cb27b8c 100644 --- a/xorriso/write_run.c +++ b/xorriso/write_run.c @@ -861,6 +861,7 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag) xorriso->appended_part_types[i], part_image); } isoburn_igopt_set_disc_label(sopts, xorriso->ascii_disc_label); + isoburn_igopt_set_hfsp_serial_number(sopts, xorriso->hfsp_serial_number); if(image!=NULL && 12+strlen(Xorriso_timestamP)<80) { strcpy(xorriso_id, xorriso->preparer_id); diff --git a/xorriso/xorriso_private.h b/xorriso/xorriso_private.h index 1f08bf8e..7d57b89a 100644 --- a/xorriso/xorriso_private.h +++ b/xorriso/xorriso_private.h @@ -400,6 +400,11 @@ struct XorrisO { /* the global context of xorriso */ */ char ascii_disc_label[Xorriso_disc_label_sizE]; + /* HFS+ image serial number. + 00...00 means that it shall be generated by libisofs. + */ + uint8_t hfsp_serial_number[8]; + /* User settable PVD time stamps */ time_t vol_creation_time; time_t vol_modification_time; diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index bbf84b76..2681fe04 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2012.05.27.165658" +#define Xorriso_timestamP "2012.05.27.165938"