New (yet inofficial) -as mkisofs option -hfsplus-file-creator-type

This commit is contained in:
Thomas Schmitt 2012-05-25 08:45:56 +00:00
parent a59ecdf456
commit dfb1f5c5e7
4 changed files with 85 additions and 7 deletions

View File

@ -616,7 +616,7 @@ int Xorriso_genisofs_count_args(struct XorrisO *xorriso, int argc, char **argv,
""
};
static char arg3_options[][41]= {
"-append_partition",
"-append_partition", "-hfsplus-file-creator-type",
""
};
static char final_options[][41]= {
@ -732,6 +732,8 @@ int Xorriso_genisofs_help(struct XorrisO *xorriso, int flag)
" -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.",
#endif
@ -1504,8 +1506,17 @@ illegal_c:;
} else if(strcmp(argpt, "-joliet-long")==0) {
Xorriso_relax_compliance(xorriso,
"joliet_long_paths:joliet_long_names", 0);
} else if(strcmp(argpt, "-hfsplus")==0) {
} else if(strcmp(argpt, "-hfsplus") == 0) {
xorriso->do_hfsplus= 1;
} else if(strcmp(argpt, "-hfsplus-file-creator-type") == 0) {
if(i + 3 >= argc)
goto not_enough_args;
/* Memorize command until all pathspecs are processed */
delay_opt_list[delay_opt_count++]= i;
if(argv[i] != argpt)
delay_opt_list[delay_opt_count - 1]|= 1<<31;
i+= 3;
} else if(strcmp(argpt, "-graft-points")==0) {
xorriso->allow_graft_points= 1;
} else if(strcmp(argpt, "-path-list")==0 ||
@ -2068,15 +2079,14 @@ problem_handler_2:;
if(option_d)
Xorriso_relax_compliance(xorriso, "deep_paths:long_paths", 0);
/* After all pathspecs are added: perform boot related options */
/* After all pathspecs are added: perform delayed options, mostly boot related
*/
for(j= 0; j < delay_opt_count; j++) {
i= delay_opt_list[j] & ~(1 << 31);
if(delay_opt_list[j] & (1 << 31))
argpt= argv[i] + 1;
else
argpt= argv[i];
if(ret <= 0)
goto ex;
if(strcmp(argpt, "-no-emul-boot")==0) {
emul_boot= xorriso->boot_image_emul= 0;
} else if(strcmp(argpt, "-hard-disk-boot")==0) {
@ -2196,7 +2206,13 @@ problem_handler_2:;
if(ret <= 0)
goto ex;
ret = Xorriso_option_boot_image(xorriso, "any", sfe, 0);
ret= Xorriso_option_boot_image(xorriso, "any", sfe, 0);
if(ret <= 0)
goto problem_handler_boot;
} else if(strcmp(argpt, "-hfsplus-file-creator-type") == 0) {
ret= Xorriso_hfsplus_file_creator_type(xorriso, argv[i + 3], NULL,
argv[i + 1], argv[i + 2], 0);
if(ret <= 0)
goto problem_handler_boot;

View File

@ -3460,3 +3460,61 @@ set_error:;
return(1);
}
int Xorriso_hfsplus_file_creator_type(struct XorrisO *xorriso, char *path,
void *in_node,
char *creator, char *hfs_type, int flag)
{
int ret;
IsoNode *node;
struct iso_hfsplus_xinfo_data *hfs_data;
if(in_node == NULL) {
ret= Xorriso_node_from_path(xorriso, NULL, path, &node, 0);
if(ret <= 0)
return(ret);
} else
node= (IsoNode *) in_node;
hfs_data= iso_hfsplus_xinfo_new(0);
if(hfs_data == NULL) {
Xorriso_no_malloc_memory(xorriso, NULL, 0);
return(-1);
}
if(strlen(creator) != 4 || strlen(hfs_type) != 4) {
strcat(xorriso->info_text,
"HFS+ file creator code or type code are not exactly 4 characters long");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
}
memcpy(hfs_data->creator_code, creator, 4);
memcpy(hfs_data->type_code, hfs_type, 4);
ret= iso_node_remove_xinfo(node, iso_hfsplus_xinfo_func);
Xorriso_process_msg_queues(xorriso, 0);
if(ret < 0) {
Xorriso_report_iso_error(xorriso, path, ret,
"Cannot overwrite HFS+ creator and type of ISO node",
0, "FAILURE", 1);
goto failure;
}
ret= iso_node_add_xinfo(node, iso_hfsplus_xinfo_func, (void *) hfs_data);
Xorriso_process_msg_queues(xorriso, 0);
if(ret < 0) {
Xorriso_report_iso_error(xorriso, path, ret,
"Cannot attach HFS+ creator and type to ISO node", 0, "FAILURE", 1);
goto failure;
} else if(ret == 0) {
strcat(xorriso->info_text,
"Programm error: iso_node_add_xinfo refuses to attach HFS+ creator and type");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
goto failure;
}
Xorriso_set_change_pending(xorriso, 0);
return(1);
failure:
iso_hfsplus_xinfo_func(hfs_data, 1);
return(0);
}

View File

@ -1 +1 @@
#define Xorriso_timestamP "2012.05.24.093552"
#define Xorriso_timestamP "2012.05.25.084641"

View File

@ -598,5 +598,9 @@ int Xorriso_list_extras(struct XorrisO *xorriso, char *mode, int flag);
int Xorriso_set_data_cache(struct XorrisO *xorriso, void *ropts,
int num_tiles, int tile_blocks, int flag);
int Xorriso_hfsplus_file_creator_type(struct XorrisO *xorriso, char *path,
void *in_node,
char *creator, char *hfs_type, int flag);
#endif /* Xorrisoburn_includeD */