Enabled output of HFS+ proposal with report_system_area cmd and as_mkisofs

This commit is contained in:
2015-05-14 10:08:32 +00:00
parent 8c1a77fdd8
commit b3a7dee69b
7 changed files with 172 additions and 52 deletions

View File

@ -1467,8 +1467,8 @@ undigestible:
}
static int Xorriso_record_cmd_line(struct XorrisO *xorriso, char *buf,
char **cmds, int *cmd_count, int flag)
int Xorriso_record_cmd_line(struct XorrisO *xorriso, char *buf,
char **cmds, int *cmd_count, int flag)
{
int ret;
@ -1571,7 +1571,7 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
int ptype, gpt_idx;
int efi_boot_part= 0, full_sparc_part= 0, have_sparc_part= 0;
int appended_as_gpt= 0, have_prep= 0, did_sysarea= 0, cared_for_apm= 0;
int cared_for_sparc= 0;
int cared_for_sparc= 0, have_hfsplus= 0;
int have_sysarea= 0, ptable_killer, imported_iso, have_alpha_ldr_path= 0;
unsigned long int sa_options= 0, partno, id_tag, perms, start_cyl, num_blocks;
unsigned long int part_status, part_type, start_block;
@ -1582,6 +1582,8 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
struct elto_img_par *et_imgs= NULL;
int elto_count= 0;
uint32_t img_blocks= 0;
struct FindjoB *job= NULL;
struct stat dir_stbuf;
struct mbr_par {
uint8_t ptype;
@ -1598,7 +1600,8 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
int gpt_count= 0;
struct apm_par {
int ptype; /* 0= unknown, 1= Apple_HFS */
int ptype; /* bit0= type Apple_HFS , bit1= name HFSPLUS_Hybrid */
char *path;
};
struct apm_par *apms= NULL;
int apm_count= 0;
@ -1674,8 +1677,11 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
for(gpt_idx= 0; gpt_idx < gpt_count; gpt_idx++)
gpts[gpt_idx].path= NULL;
}
if(apm_count > 0)
if(apm_count > 0) {
Xorriso_alloc_meM(apms, struct apm_par, apm_count);
for(i= 0; i < apm_count; i++)
apms[i].path= NULL;
}
ptable_killer= (mbr_count > 0) | ((gpt_count > 0) << 1) |
((apm_count > 0) << 2);
@ -1770,12 +1776,19 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
gpts[idx].has_path= 1;
gpts[idx].path= textpt;
} else if(strcmp(name, "APM partition name :") == 0) {
idx= num[0] - 1;
if(strcmp(textpt, "HFSPLUS_Hybrid") == 0)
apms[idx].ptype|= 2;
} else if(strcmp(name, "APM partition type :") == 0) {
idx= num[0] - 1;
if(strcmp(textpt, "Apple_HFS") == 0)
apms[idx].ptype= 1;
else
apms[idx].ptype= 0;
apms[idx].ptype|= 1;
} else if(strcmp(name, "APM partition path :") == 0) {
idx= num[0] - 1;
apms[idx].path= textpt;
} else if(strcmp(name, "DEC Alpha ldr path :") == 0) {
have_alpha_ldr_path= 1;
@ -1890,37 +1903,38 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
} else if(strcmp(name, "MBR partition path :") == 0) {
idx= num[0] - 1;
if(!(flag & 1)) {
if(mbrpts[idx].ptype == 0x41) {
sprintf(xorriso->info_text,
"Cannot make proposal to mark PReP partition by data file: ");
Text_shellsafe(textpt, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
continue;
}
ptype= 0;
if(mbrpts[idx].ptype == 0xef)
ptype= 3;
ret= Xorriso_search_eltorito_path(xorriso, et_imgs, elto_count,
textpt, ptype,
&et_idx, &efi_boot_part, !!isohybrid);
if(ret <= 0) {
sprintf(xorriso->info_text,
"Cannot make proposal to mark data file as MBR partition without being an El Torito boot image : ");
Text_shellsafe(textpt, xorriso->info_text, 1);
if(mbrpts[idx].ptype == 0x41) {
sprintf(xorriso->info_text,
"Cannot make proposal to mark PReP partition by data file: ");
Text_shellsafe(textpt, xorriso->info_text, 1);
if(!(flag & 1))
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
} else {
for(gpt_idx= 0; gpt_idx < gpt_count; gpt_idx++) {
if(gpts[gpt_idx].path != NULL)
if(strcmp(gpts[gpt_idx].path, textpt) == 0)
break;
}
if(gpt_idx >= gpt_count) {
sprintf(xorriso->info_text,
"Cannot make proposal to mark data file as MBR partition without being in GPT : ");
Text_shellsafe(textpt, xorriso->info_text, 1);
continue;
}
ptype= 0;
if(mbrpts[idx].ptype == 0xef)
ptype= 3;
ret= Xorriso_search_eltorito_path(xorriso, et_imgs, elto_count,
textpt, ptype,
&et_idx, &efi_boot_part, !!isohybrid);
if(ret <= 0) {
sprintf(xorriso->info_text,
"Cannot make proposal to mark data file as MBR partition without being an El Torito boot image : ");
Text_shellsafe(textpt, xorriso->info_text, 1);
if(!(flag & 1))
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
} else {
for(gpt_idx= 0; gpt_idx < gpt_count; gpt_idx++) {
if(gpts[gpt_idx].path != NULL)
if(strcmp(gpts[gpt_idx].path, textpt) == 0)
break;
}
if(gpt_idx >= gpt_count) {
sprintf(xorriso->info_text,
"Cannot make proposal to mark data file as MBR partition without being in GPT : ");
Text_shellsafe(textpt, xorriso->info_text, 1);
if(!(flag & 1))
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
}
}
}
@ -2007,11 +2021,42 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
}
} else if(strcmp(name, "APM start and size :") == 0) {
idx= num[0] - 1;
/* >>> check for -hfsplus : APM inside ISO, type Apple_HFS,
no path, isofs.hb and isofs.hx in image
>>> HFS+ magic number ?
*/;
if(num[1] + num[2] <= img_blocks && apms[idx].ptype == 3 &&
apms[idx].path == NULL && !have_hfsplus) {
/* >>> HFS+ magic number */;
/* >>> Read byte 1024 and 1025 after partition start
Must be {'H', '+'} (0x482b big endian)
*/;
/* ??? >>> Do this recognition in libisofs ? */
if(mkisofs)
sprintf(buf, "-hfsplus");
else
sprintf(buf, "-hfsplus on");
Xorriso_record_cmd_linE
buf[0]= 0;
/* Report commands for blessings and creator-type */
ret= Findjob_new(&job, "/", 0);
if(ret <= 0) {
Xorriso_no_findjob(xorriso, "xorriso", 0);
{ret= -1; goto ex;}
}
Findjob_set_action_target(job, 53, NULL, 0);
xorriso->show_hfs_cmd_count= *cmd_count;
xorriso->show_hfs_cmds= cmds;
xorriso->show_hfs_cmd_flag= (flag & 1) | ((!!mkisofs) << 1);
ret= Xorriso_findi(xorriso, job, NULL, (off_t) 0, NULL, "/",
&dir_stbuf, 0, 0);
*cmd_count= xorriso->show_hfs_cmd_count;
if(ret <= 0)
goto ex;
have_hfsplus= 1;
cared_for_apm= 1;
}
} else if(strcmp(name, "MIPS-BE boot path :") == 0) {
if(mkisofs)
@ -2322,6 +2367,8 @@ after_el_torito:
ret= 1;
ex:
xorriso->show_hfs_cmds= NULL;
Findjob_destroy(&job, 0);
Xorriso_free_meM(apms);
Xorriso_free_meM(gpts);
Xorriso_free_meM(mbrpts);