Enabled output of HFS+ proposal with report_system_area cmd and as_mkisofs

This commit is contained in:
Thomas Schmitt 2015-05-14 10:08:32 +00:00
parent d8da5a00dd
commit 376b450694
7 changed files with 172 additions and 52 deletions

View File

@ -428,6 +428,10 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
m->update_flags= 0; m->update_flags= 0;
m->show_hfs_cmd_flag= 0;
m->show_hfs_cmd_count= 0;
m->show_hfs_cmds= NULL;
m->result_line[0]= 0; m->result_line[0]= 0;
m->result_line_counter= 0; m->result_line_counter= 0;
m->result_page_counter= 0; m->result_page_counter= 0;

View File

@ -173,6 +173,7 @@ struct FindjoB {
50= print_outname namespace 50= print_outname namespace
51= report_sections 51= report_sections
52= show_stream_id 52= show_stream_id
53= internal: show_hfs_cmd , controlled by xorriso->show_hfs_cmd*
*/ */
int action; int action;
int prune; int prune;

View File

@ -1467,7 +1467,7 @@ undigestible:
} }
static int Xorriso_record_cmd_line(struct XorrisO *xorriso, char *buf, int Xorriso_record_cmd_line(struct XorrisO *xorriso, char *buf,
char **cmds, int *cmd_count, int flag) char **cmds, int *cmd_count, int flag)
{ {
int ret; int ret;
@ -1571,7 +1571,7 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
int ptype, gpt_idx; int ptype, gpt_idx;
int efi_boot_part= 0, full_sparc_part= 0, have_sparc_part= 0; 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 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; 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 sa_options= 0, partno, id_tag, perms, start_cyl, num_blocks;
unsigned long int part_status, part_type, start_block; 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; struct elto_img_par *et_imgs= NULL;
int elto_count= 0; int elto_count= 0;
uint32_t img_blocks= 0; uint32_t img_blocks= 0;
struct FindjoB *job= NULL;
struct stat dir_stbuf;
struct mbr_par { struct mbr_par {
uint8_t ptype; uint8_t ptype;
@ -1598,7 +1600,8 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
int gpt_count= 0; int gpt_count= 0;
struct apm_par { 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; struct apm_par *apms= NULL;
int apm_count= 0; 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++) for(gpt_idx= 0; gpt_idx < gpt_count; gpt_idx++)
gpts[gpt_idx].path= NULL; gpts[gpt_idx].path= NULL;
} }
if(apm_count > 0) if(apm_count > 0) {
Xorriso_alloc_meM(apms, struct apm_par, apm_count); 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) | ptable_killer= (mbr_count > 0) | ((gpt_count > 0) << 1) |
((apm_count > 0) << 2); ((apm_count > 0) << 2);
@ -1770,12 +1776,19 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
gpts[idx].has_path= 1; gpts[idx].has_path= 1;
gpts[idx].path= textpt; 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) { } else if(strcmp(name, "APM partition type :") == 0) {
idx= num[0] - 1; idx= num[0] - 1;
if(strcmp(textpt, "Apple_HFS") == 0) if(strcmp(textpt, "Apple_HFS") == 0)
apms[idx].ptype= 1; apms[idx].ptype|= 1;
else
apms[idx].ptype= 0; } 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) { } else if(strcmp(name, "DEC Alpha ldr path :") == 0) {
have_alpha_ldr_path= 1; have_alpha_ldr_path= 1;
@ -1890,12 +1903,12 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
} else if(strcmp(name, "MBR partition path :") == 0) { } else if(strcmp(name, "MBR partition path :") == 0) {
idx= num[0] - 1; idx= num[0] - 1;
if(!(flag & 1)) {
if(mbrpts[idx].ptype == 0x41) { if(mbrpts[idx].ptype == 0x41) {
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"Cannot make proposal to mark PReP partition by data file: "); "Cannot make proposal to mark PReP partition by data file: ");
Text_shellsafe(textpt, xorriso->info_text, 1); Text_shellsafe(textpt, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); if(!(flag & 1))
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
continue; continue;
} }
ptype= 0; ptype= 0;
@ -1908,6 +1921,7 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"Cannot make proposal to mark data file as MBR partition without being an El Torito boot image : "); "Cannot make proposal to mark data file as MBR partition without being an El Torito boot image : ");
Text_shellsafe(textpt, xorriso->info_text, 1); Text_shellsafe(textpt, xorriso->info_text, 1);
if(!(flag & 1))
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
} else { } else {
for(gpt_idx= 0; gpt_idx < gpt_count; gpt_idx++) { for(gpt_idx= 0; gpt_idx < gpt_count; gpt_idx++) {
@ -1919,10 +1933,10 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"Cannot make proposal to mark data file as MBR partition without being in GPT : "); "Cannot make proposal to mark data file as MBR partition without being in GPT : ");
Text_shellsafe(textpt, xorriso->info_text, 1); Text_shellsafe(textpt, xorriso->info_text, 1);
if(!(flag & 1))
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
} }
} }
}
} else if(strcmp(name, "GPT disk GUID :") == 0) { } else if(strcmp(name, "GPT disk GUID :") == 0) {
@ -2007,11 +2021,42 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
} }
} else if(strcmp(name, "APM start and size :") == 0) { } else if(strcmp(name, "APM start and size :") == 0) {
idx= num[0] - 1;
/* >>> check for -hfsplus : APM inside ISO, type Apple_HFS, if(num[1] + num[2] <= img_blocks && apms[idx].ptype == 3 &&
no path, isofs.hb and isofs.hx in image apms[idx].path == NULL && !have_hfsplus) {
>>> HFS+ magic number ?
/* >>> 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) { } else if(strcmp(name, "MIPS-BE boot path :") == 0) {
if(mkisofs) if(mkisofs)
@ -2322,6 +2367,8 @@ after_el_torito:
ret= 1; ret= 1;
ex: ex:
xorriso->show_hfs_cmds= NULL;
Findjob_destroy(&job, 0);
Xorriso_free_meM(apms); Xorriso_free_meM(apms);
Xorriso_free_meM(gpts); Xorriso_free_meM(gpts);
Xorriso_free_meM(mbrpts); Xorriso_free_meM(mbrpts);

View File

@ -36,8 +36,8 @@ int Xorriso__append_boot_params(char *line, ElToritoBootImage *bootimg,
int Xorriso_get_volume(struct XorrisO *xorriso, IsoImage **volume, int Xorriso_get_volume(struct XorrisO *xorriso, IsoImage **volume,
int flag); int flag);
int Xorriso_record_cmd_line(struct XorrisO *xorriso, char *buf,
char **cmds, int *cmd_count, int flag);
#endif /* ! Xorriso_pvt_iso_img_includeD */ #endif /* ! Xorriso_pvt_iso_img_includeD */

View File

@ -31,6 +31,7 @@
#include "lib_mgt.h" #include "lib_mgt.h"
#include "iso_img.h" #include "iso_img.h"
#include "iso_tree.h" #include "iso_tree.h"
#include "iso_img.h"
#include "iso_manip.h" #include "iso_manip.h"
#include "sort_cmp.h" #include "sort_cmp.h"
#include "parse_exec.h" #include "parse_exec.h"
@ -2533,6 +2534,7 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
time_t date= 0; time_t date= 0;
mode_t mode_or= 0, mode_and= ~1; mode_t mode_or= 0, mode_and= ~1;
char *target, *text_2, *iso_prefix, md5[16], *basename, bless_code[17]; char *target, *text_2, *iso_prefix, md5[16], *basename, bless_code[17];
char crtp[10];
struct FindjoB *subjob; struct FindjoB *subjob;
struct stat dir_stbuf, stbuf; struct stat dir_stbuf, stbuf;
void *xinfo; void *xinfo;
@ -2741,9 +2743,13 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
&value_length, &value, 0); &value_length, &value, 0);
if(ret < 0) if(ret < 0)
return(ret); return(ret);
if(ret > 0 && value_length >= 10) { if(ret > 0) {
ret= Xorriso_hfsplus_file_creator_type(xorriso, show_path, (void *) node, if(value_length >= 10) {
ret= Xorriso_hfsplus_file_creator_type(xorriso, show_path,
(void *) node,
value + 2, value + 6, 4); value + 2, value + 6, 4);
} else
ret= 1;
free(value); free(value);
if(ret <= 0) if(ret <= 0)
return(ret); return(ret);
@ -2752,11 +2758,15 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
&value_length, &value, 0); &value_length, &value, 0);
if(ret < 0) if(ret < 0)
return(ret); return(ret);
if(ret > 0 && value_length >= 1) { if(ret > 0) {
if(value_length >= 1) {
bless_code[0]= value[0]; bless_code[0]= value[0];
bless_code[1]= 0; bless_code[1]= 0;
ret= Xorriso_hfsplus_bless(xorriso, show_path, (void *) node, ret= Xorriso_hfsplus_bless(xorriso, show_path, (void *) node,
bless_code, 0); bless_code, 0);
} else
ret= 1;
free(value);
if(ret <= 0) if(ret <= 0)
return(ret); return(ret);
} }
@ -2770,6 +2780,55 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
} else if(action == 51) { /* report_sections */ } else if(action == 51) { /* report_sections */
ret= Xorriso_report_lba(xorriso, show_path, node, 1); ret= Xorriso_report_lba(xorriso, show_path, node, 1);
} else if(action == 53) { /* internal: show_hfs_cmd */
ret= Xorriso_get_blessing(xorriso, node, &bless_idx, bless_code, 0);
if (ret > 0) {
if(xorriso->show_hfs_cmd_flag & 2) {
sprintf(xorriso->result_line, "-hfs-bless-by %s ", bless_code);
Text_shellsafe(show_path, xorriso->result_line, 1);
} else {
sprintf(xorriso->result_line, "-find ");
Text_shellsafe(show_path, xorriso->result_line, 1);
sprintf(xorriso->result_line + strlen(xorriso->result_line),
" -exec set_hfs_bless %s --", bless_code);
}
ret= Xorriso_record_cmd_line(xorriso, xorriso->result_line,
xorriso->show_hfs_cmds,
&xorriso->show_hfs_cmd_count,
(xorriso->show_hfs_cmd_flag & 1));
if(ret <= 0)
return(ret);
}
ret= iso_node_get_xinfo(node, iso_hfsplus_xinfo_func, &xinfo);
if(ret < 0) {
Xorriso_process_msg_queues(xorriso, 0);
ret= 0;
} else if(ret == 1) {
hfsplus_xinfo= (struct iso_hfsplus_xinfo_data *) xinfo;
for(i= 0; i < 4; i++)
crtp[i]= hfsplus_xinfo->creator_code[i];
crtp[4]= ' ';
for(i= 0; i < 4; i++)
crtp[5 + i]= hfsplus_xinfo->type_code[i];
crtp[9]= 0;
if(xorriso->show_hfs_cmd_flag & 2) {
sprintf(xorriso->result_line, "-hfsplus-file-creator-type %s ", crtp);
Text_shellsafe(show_path, xorriso->result_line, 1);
} else {
sprintf(xorriso->result_line, "-find ");
Text_shellsafe(show_path, xorriso->result_line, 1);
sprintf(xorriso->result_line + strlen(xorriso->result_line),
" -exec set_hfs_crtp %s --", crtp);
}
ret= Xorriso_record_cmd_line(xorriso, xorriso->result_line,
xorriso->show_hfs_cmds,
&xorriso->show_hfs_cmd_count,
(xorriso->show_hfs_cmd_flag & 1));
if(ret <= 0)
return(ret);
}
ret= 1;
} else { /* includes : 15 in_iso */ } else { /* includes : 15 in_iso */
Xorriso_esc_filepath(xorriso, show_path, xorriso->result_line, 0); Xorriso_esc_filepath(xorriso, show_path, xorriso->result_line, 0);
strcat(xorriso->result_line, "\n"); strcat(xorriso->result_line, "\n");

View File

@ -758,6 +758,15 @@ struct XorrisO { /* the global context of xorriso */
*/ */
int update_flags; int update_flags;
/* For find jobs show_hfs_cmd , show_hfs_as_mkisofs
*/
/* bit0= do not record but only count
bit1= as_mkisofs mode
*/
int show_hfs_cmd_flag;
int show_hfs_cmd_count;
char **show_hfs_cmds;
/* result (stdout, R: ) */ /* result (stdout, R: ) */
char result_line[10*SfileadrL]; char result_line[10*SfileadrL];
int result_line_counter; int result_line_counter;

View File

@ -1 +1 @@
#define Xorriso_timestamP "2015.05.11.160333" #define Xorriso_timestamP "2015.05.14.100737"