From 1fb2576e93510e3881e05d8a14edb4b4ea150327 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sat, 1 Mar 2008 15:13:13 +0000 Subject: [PATCH] New option update_r, -find actions "update" and "add_missing" (not yet completed) --- xorriso/xorriso.1 | 39 +++++++++++--- xorriso/xorriso.c | 102 ++++++++++++++++++++++++++---------- xorriso/xorriso_private.h | 16 +++++- xorriso/xorriso_timestamp.h | 2 +- xorriso/xorrisoburn.c | 62 +++++++++++++++------- xorriso/xorrisoburn.h | 18 +++++-- 6 files changed, 178 insertions(+), 61 deletions(-) diff --git a/xorriso/xorriso.1 b/xorriso/xorriso.1 index be97a236..8f1146cb 100644 --- a/xorriso/xorriso.1 +++ b/xorriso/xorriso.1 @@ -543,18 +543,28 @@ Like -add but read the parameter words from file disk_path. One pathspec resp. disk_path pattern per line. .TP \fB\-update\fR disk_path iso_rr_path +WARNING: This option is fewly tested and has potential to spoil your ISO image. +.br Compare file object disk_path with file object iso_rr_path. If they do not match, then perform the necessary image manipulations to make iso_rr_path -a matching copy of disk_path. This comparison can imply lengthy content +a matching copy of disk_path. This comparison will imply lengthy content reading before a decision is made. On the other hand it strives for the -smallest possible amount of add-on data in order to achieve the matching copy. +smallest possible amount of add-on data which is needed to achieve the +matching copy. .br -update is also a convenient compromise between -add addressing and -cp_r addressing: Its semantics is similar to -add and thus avoids the pitfalls inherited from cp -r behavior. Its syntax resembles cp, though. .br Note: Not all subtleties of link following are implemented yet. -Use with caution. +.TP +\fB\-update_r\fR disk_path iso_rr_path +WARNING: This option is fewly tested and has potential to spoil your ISO image. +.br +Like -update but working recursively. I.e. all file objects below both +addresses get compared whether they have counterparts below the other address +and whether both counterparts match. If there is a mismatch then the necessary +update manipulation is done. .TP \fB\-cpr\fR disk_path [***] iso_rr_path Insert the given files or directory trees from filesystem @@ -715,6 +725,15 @@ E.g.: .br -find / -exec compare /home/thomas .br +"update" performs command -update with the found file address as iso_rr_path. +The corresponding file address is determined like with above "compare". +.br +WARNING: This action is fewly tested and has potential to spoil your ISO image. +.br +E.g.: +.br + -find / -exec update /home/thomas +.br "find" performs another run of -find on the matching file address. It accepts the same params as -find, except iso_rr_path. E.g.: @@ -1267,8 +1286,8 @@ Similar to shell command du -sk. Like -find but operating on local filesystem and not on the ISO image. This is subject to the settings of -follow. .br --findx accepts the -exec actions as does -find. But except two -other actions it will allways perform action "echo". +-findx accepts the -exec actions as does -find. But except the following few +actions it will allways perform action "echo". .br "in_iso" iso_rr_path_start reports the path if its counterpart exist in the ISO image. For this the disk_path of the -find command gets replaced @@ -1281,7 +1300,13 @@ not exist in the ISO image. The report format is the same as with command -compare. E.g. .br - -find /home -exec not_in_iso / + -find /home/thomas -exec not_in_iso /thomas_on_cd +.br +"add_missing" iso_rr_path_start adds the counterpart if it does not yet +exist in the ISO image. +E.g. +.br + -find /home/thomas -exec add_missing /thomas_on_cd .TP \fB\-compare\fR disk_path iso_rr_path Compare attributes and eventual data file content of a fileobject in the @@ -1637,7 +1662,9 @@ first and only session to the output drive. .SS .B Write a ISO image into a pipe (single-session only) \fB$\fR xorriso -outdev - \\ +.br ... +.br | gzip >image.iso.gz .SS .B Adjust thresholds for verbosity, exit value and program abort diff --git a/xorriso/xorriso.c b/xorriso/xorriso.c index 1585f35e..56d756ff 100644 --- a/xorriso/xorriso.c +++ b/xorriso/xorriso.c @@ -2393,6 +2393,10 @@ struct FindjoB { 12= alter_date_r type date 13= find 14= compare disk_equivalent_of_start_path + 15= in_iso + 16= not_in_iso + 17= update + 18= add_missing */ int action; char *target; @@ -4477,10 +4481,15 @@ I thought to have seen a libisofs bug here but it seems that it was an illusion } -int Xorriso_find_compare(struct XorrisO *xorriso, char *iso_path, - char *iso_prefix, char *disk_prefix, int flag) +/* @param boss_iter Opaque handle to be forwarded to actions in ISO image + Set to NULL if calling this function from outside ISO world + @param flag bit0= update rather than compare +*/ +int Xorriso_find_compare(struct XorrisO *xorriso, void *boss_iter, + char *iso_path, char *iso_prefix, char *disk_prefix, + int flag) { - int ret, result; + int ret, result, uret; char disk_path[SfileadrL], adrc[SfileadrL]; if(strncmp(iso_path, iso_prefix, strlen(iso_prefix))!=0) @@ -4500,6 +4509,14 @@ int Xorriso_find_compare(struct XorrisO *xorriso, char *iso_path, 2|(1<<29)); if(retfind_compare_result) xorriso->find_compare_result= ret; + if(flag&1) { + if(ret==0) { + uret= Xorriso_update_interpreter(xorriso, boss_iter, + result, disk_path, iso_path, 0); + if(uret<=0) + ret= 0; + } + } return(ret); } @@ -6078,7 +6095,7 @@ int Xorriso_lsx_filev(struct XorrisO *xorriso, char *wd, int Xorriso_findx_action(struct XorrisO *xorriso, struct FindjoB *job, char *abs_path, char *show_path, int depth, int flag) { - int ret= 0, type, action= 0, dpl= 0, compare_result; + int ret= 0, type, action= 0, dpl= 0, compare_result, uret; uid_t user= 0; gid_t group= 0; time_t date= 0; @@ -6093,7 +6110,8 @@ int Xorriso_findx_action(struct XorrisO *xorriso, struct FindjoB *job, action= 0; if(action<0) action= 0; - if(action==15 || action==16) { /* in_iso , not_in_iso */ + if(action==15 || action==16 || action==18) { + /* in_iso , not_in_iso, add_missing */ Findjob_get_start_path(job, &disk_prefix, 0); if(strncmp(abs_path, disk_prefix, strlen(disk_prefix))!=0) return(-1); @@ -6107,20 +6125,33 @@ int Xorriso_findx_action(struct XorrisO *xorriso, struct FindjoB *job, return(ret); } - if(action==15) { + if(action==15) { /* in_iso */ ret= Xorriso_iso_lstat(xorriso, iso_path, &stbuf, 0); if(ret==-1) return(1); sprintf(xorriso->result_line, "%s\n", Text_shellsafe(show_path, sfe, 0)); Xorriso_result(xorriso, 0); ret= 1; - } else if(action==16) { + } else if(action==16) { /* not_in_iso */ ret= Xorriso_compare_2_files(xorriso, abs_path, iso_path, abs_path+dpl, &compare_result, 4); if(retfind_compare_result) xorriso->find_compare_result= ret; if(ret>=0) ret= 1; + } else if(action==18) { /* add_missing */ + ret= Xorriso_compare_2_files(xorriso, abs_path, iso_path, abs_path+dpl, + &compare_result, 4); + if(retfind_compare_result) + xorriso->find_compare_result= ret; + if(ret==0) { + uret= Xorriso_update_interpreter(xorriso, NULL, compare_result, + abs_path, iso_path, 0); + if(uret<=0) + ret= 0; + } + if(ret>=0) + ret= 1; } else { sprintf(xorriso->result_line, "%s\n", Text_shellsafe(show_path, sfe, 0)); Xorriso_result(xorriso, 0); @@ -7048,9 +7079,12 @@ ex:; } -int Xorriso_update_interpreter(struct XorrisO *xorriso, int compare_result, - char *disk_path, char *iso_rr_path, - int flag) +/* @param boss_iter Opaque handle to be forwarded to actions in ISO image + Set to NULL if calling this function from outside ISO world +*/ +int Xorriso_update_interpreter(struct XorrisO *xorriso, void *boss_iter, + int compare_result, char *disk_path, + char *iso_rr_path, int flag) { int ret; char sfe[5*SfileadrL]; @@ -7059,7 +7093,7 @@ int Xorriso_update_interpreter(struct XorrisO *xorriso, int compare_result, /* cannot open regular disk file, early eof of disk file */ sprintf(xorriso->info_text, "Problems with reading disk file %s\n", Text_shellsafe(disk_path, sfe, 0)); - Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 1); xorriso->find_compare_result= -1; return(1); } @@ -7070,20 +7104,20 @@ int Xorriso_update_interpreter(struct XorrisO *xorriso, int compare_result, /* <<< tolerate for now: disk_path being softlink to dir, iso being dir */ /* <<< to be obsoleted by proper link handling in compare_2_files */ - ret= Xorriso_rmi(xorriso, NULL, iso_rr_path, 1); + ret= Xorriso_rmi(xorriso, boss_iter, iso_rr_path, 1); if(ret>0) - ret= Xorriso_graft_in(xorriso, disk_path, iso_rr_path, 2); + ret= Xorriso_graft_in(xorriso, boss_iter, disk_path, iso_rr_path, 2); sprintf(xorriso->info_text, "Deleted and re-added "); } else if(compare_result&(1)) { /* disk_adr not existing */ - ret= Xorriso_rmi(xorriso, NULL, iso_rr_path, 1); + ret= Xorriso_rmi(xorriso, boss_iter, iso_rr_path, 1); sprintf(xorriso->info_text, "Deleted "); } else if(compare_result&(2|128|(1<<12)|(1<<14)|(1<<15))) { /* iso_adr not existing, size, cannot open iso file, early eof of iso file content bytes differ */ - ret= Xorriso_graft_in(xorriso, disk_path, iso_rr_path, 2); + ret= Xorriso_graft_in(xorriso, boss_iter, disk_path, iso_rr_path, 2); sprintf(xorriso->info_text, "Added/overwrote "); } else if(compare_result&(4|16|32|256|512|1024)) { @@ -7095,7 +7129,7 @@ int Xorriso_update_interpreter(struct XorrisO *xorriso, int compare_result, ret= 1; if(ret>0 && xorriso->info_text[0]) { strcat(xorriso->info_text, Text_shellsafe(iso_rr_path, sfe, 0)); - Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "UPDATE", 0); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "UPDATE", 1); } return(ret); } @@ -7194,7 +7228,7 @@ int Xorriso_option_add(struct XorrisO *xorriso, int argc, char **argv, goto problem_handler; strcpy(source, eff_path); - ret= Xorriso_graft_in(xorriso, source, target, 0); + ret= Xorriso_graft_in(xorriso, NULL, source, target, 0); if(ret<=0 || xorriso->request_to_abort) goto problem_handler; sprintf(xorriso->info_text, "Added to ISO image: %s '%s'='%s'\n", @@ -7274,7 +7308,7 @@ int Xorriso_option_alter_date(struct XorrisO *xorriso, {ret= -1; goto ex;} } Findjob_set_action_ad(job, t_type, t, 0); - ret= Xorriso_findi(xorriso, job, NULL, optv[i], &dir_stbuf, 0, 0); + ret= Xorriso_findi(xorriso, job, NULL, NULL, optv[i], &dir_stbuf, 0, 0); Findjob_destroy(&job, 0); } else ret= Xorriso_set_time(xorriso, optv[i], t, t_type); @@ -7639,7 +7673,7 @@ int Xorriso_option_chgrpi(struct XorrisO *xorriso, char *gid, {ret= -1; goto ex;} } Findjob_set_action_chgrp(job, gid_number, 0); - ret= Xorriso_findi(xorriso, job, NULL, optv[i], &dir_stbuf, 0, 0); + ret= Xorriso_findi(xorriso, job, NULL, NULL, optv[i], &dir_stbuf, 0, 0); Findjob_destroy(&job, 0); } else ret= Xorriso_set_gid(xorriso, optv[i], gid_number, 0); @@ -7692,7 +7726,7 @@ int Xorriso_option_chmodi(struct XorrisO *xorriso, char *mode, {ret= -1; goto ex;} } Findjob_set_action_chmod(job, mode_and, mode_or, 0); - ret= Xorriso_findi(xorriso, job, NULL, optv[i], &dir_stbuf, 0, 0); + ret= Xorriso_findi(xorriso, job, NULL, NULL, optv[i], &dir_stbuf, 0, 0); Findjob_destroy(&job, 0); } else { ret= Xorriso_set_st_mode(xorriso, optv[i], mode_and, mode_or, 0); @@ -7745,7 +7779,7 @@ int Xorriso_option_chowni(struct XorrisO *xorriso, char *uid, {ret= -1; goto ex;} } Findjob_set_action_chown(job, uid_number, 0); - ret= Xorriso_findi(xorriso, job, NULL, optv[i], &dir_stbuf, 0, 0); + ret= Xorriso_findi(xorriso, job, NULL, NULL, optv[i], &dir_stbuf, 0, 0); Findjob_destroy(&job, 0); } else ret= Xorriso_set_uid(xorriso, optv[i], uid_number, 0); @@ -7943,7 +7977,7 @@ int Xorriso_option_cpri(struct XorrisO *xorriso, int argc, char **argv, goto problem_handler; } } - ret= Xorriso_graft_in(xorriso, eff_origin, eff_dest, 0); + ret= Xorriso_graft_in(xorriso, NULL, eff_origin, eff_dest, 0); if(ret<=0 || xorriso->request_to_abort) goto problem_handler; sprintf(xorriso->info_text, "Added to ISO image: %s '%s'='%s'\n", @@ -8454,15 +8488,18 @@ not_enough_arguments:; Findjob_set_action_subjob(job, 13, new_job, 0); job= new_job; - } else if(strcmp(cpt, "compare")==0) { + } else if(strcmp(cpt, "compare")==0 || strcmp(cpt, "update")==0) { if(i+1>=end_idx) goto not_enough_arguments; i++; + action= 14; + if(strcmp(cpt, "update")==0) + action= 17; ret= Xorriso_make_abs_adr(xorriso, xorriso->wdx, argv[i], other_path_start, 1|2|4|8); if(ret<=0) goto ex; - Findjob_set_action_target(job, 14, other_path_start, 0); + Findjob_set_action_target(job, action, other_path_start, 0); ret= Xorriso_make_abs_adr(xorriso, xorriso->wdi, start_path,sfe, 1|2|4); if(ret<=0) goto ex; @@ -8471,7 +8508,8 @@ not_enough_arguments:; Xorriso_pacifier_reset(xorriso, 0); mem_lut= xorriso->last_update_time; } - } else if(strcmp(cpt, "in_iso")==0 || strcmp(cpt, "not_in_iso")==0) { + } else if(strcmp(cpt, "in_iso")==0 || strcmp(cpt, "not_in_iso")==0 || + strcmp(cpt, "add_missing")==0) { if(i+1>=end_idx) goto not_enough_arguments; i++; @@ -8481,6 +8519,8 @@ not_enough_arguments:; goto ex; if(strcmp(cpt, "in_iso")==0) action= 15; + else if(strcmp(cpt, "add_missing")==0) + action= 18; else action= 16; Findjob_set_action_target(job, action, other_path_start, 0); @@ -8516,7 +8556,8 @@ sorry_ex:; ret= Xorriso_findx(xorriso, first_job, "", start_path, &dir_stbuf, 0, NULL, 0); else - ret= Xorriso_findi(xorriso, first_job, NULL, start_path, &dir_stbuf, 0, 0); + ret= Xorriso_findi(xorriso, first_job, NULL, NULL, + start_path, &dir_stbuf, 0, 0); ex:; if(mem_lut!=xorriso->last_update_time && mem_lut!=0.0 && !(flag&2)) Xorriso_pacifier_callback(xorriso, "content bytes read", @@ -9205,7 +9246,7 @@ int Xorriso_option_mvi(struct XorrisO *xorriso, int argc, char **argv, goto problem_handler; } } - ret= Xorriso_rename(xorriso, eff_origin, eff_dest, 0); + ret= Xorriso_rename(xorriso, NULL, eff_origin, eff_dest, 0); if(ret<=0 || xorriso->request_to_abort) goto problem_handler; sprintf(xorriso->info_text, "Renamed in ISO image: %s to %s\n", @@ -9987,7 +10028,8 @@ int Xorriso_option_update(struct XorrisO *xorriso, char *disk_path, ret= Xorriso_compare_2_files(xorriso, disk_path, ipth, "", &result, 2| (1<<30) | ((flag&4)<<27)); if(ret==0) { - uret= Xorriso_update_interpreter(xorriso, result, disk_path, ipth, 0); + uret= Xorriso_update_interpreter(xorriso, NULL, result, disk_path, ipth, + 0); if(uret<=0) ret= -1; } @@ -10524,6 +10566,10 @@ next_command:; (*idx)+= 2; ret= Xorriso_option_update(xorriso, arg1, arg2, 1); + } else if(strcmp(cmd,"update_r")==0) { + (*idx)+= 2; + ret= Xorriso_option_update(xorriso, arg1, arg2, 1|8); + } else if(strcmp(cmd,"volid")==0) { (*idx)++; ret= Xorriso_option_volid(xorriso,arg1,0); diff --git a/xorriso/xorriso_private.h b/xorriso/xorriso_private.h index 03cbd402..039a7dbc 100644 --- a/xorriso/xorriso_private.h +++ b/xorriso/xorriso_private.h @@ -332,8 +332,20 @@ int Xorriso_pacifier_callback(struct XorrisO *xorriso, char *what_done, off_t count, off_t todo, char *current_object, int flag); -int Xorriso_find_compare(struct XorrisO *xorriso, char *iso_path, - char *iso_prefix, char *disk_prefix, int flag); +/* @param boss_iter Opaque handle to be forwarded to actions in ISO image + Set to NULL if calling this function from outside ISO world + @param flag bit0= update rather than compare +*/ +int Xorriso_find_compare(struct XorrisO *xorriso, void *boss_iter, + char *iso_path, char *iso_prefix, char *disk_prefix, + int flag); + +/* @param boss_iter Opaque handle to be forwarded to actions in ISO image + Set to NULL if calling this function from outside ISO world +*/ +int Xorriso_update_interpreter(struct XorrisO *xorriso, void *boss_iter, + int compare_result, char *disk_path, + char *iso_rr_path, int flag); int Sfile_str(char target[SfileadrL], char *source, int flag); diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 62e93e16..55ba3274 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2008.02.29.200510" +#define Xorriso_timestamP "2008.03.01.151219" diff --git a/xorriso/xorrisoburn.c b/xorriso/xorrisoburn.c index 44cfcb63..243c7910 100644 --- a/xorriso/xorrisoburn.c +++ b/xorriso/xorrisoburn.c @@ -1776,11 +1776,14 @@ int Xorriso_copy_properties(struct XorrisO *xorriso, } -/** @param flag bit0= mkdir: graft in as empty directory, not as copy from disk - bit1= do not report added files - @return <=0 = error , 1 = added simple node , 2 = added directory */ -int Xorriso_graft_in(struct XorrisO *xorriso, char *disk_path, char *img_path, - int flag) +/* @param boss_iter Opaque handle to be forwarded to actions in ISO image + Set to NULL if calling this function from outside ISO world + @param flag bit0= mkdir: graft in as empty directory, not as copy from disk + bit1= do not report added files + @return <=0 = error , 1 = added simple node , 2 = added directory +*/ +int Xorriso_graft_in(struct XorrisO *xorriso, void *boss_iter, + char *disk_path, char *img_path, int flag) { IsoImage *volume; char path[SfileadrL], *apt, *npt, *cpt, sfe[5*SfileadrL], sfe2[5*SfileadrL]; @@ -1895,7 +1898,7 @@ int Xorriso_graft_in(struct XorrisO *xorriso, char *disk_path, char *img_path, /* handle overwrite situation */; if(xorriso->do_overwrite==1 || (xorriso->do_overwrite==2 && !target_is_dir)) { - ret= Xorriso_rmi(xorriso, NULL, path, 1|8); + ret= Xorriso_rmi(xorriso, boss_iter, path, 1|8); if(ret<=0) return(ret); if(ret==3) { @@ -2628,12 +2631,25 @@ dir_not_removed:; } } +#ifdef Libisofs_iso_dir_iter_remove_repaireD if(boss_iter!=NULL) { ret= iso_dir_iter_remove((IsoDirIter *) boss_iter); if(ret<0) ret= -1; } else ret= iso_node_remove(victim_node); + +#else /* ! Libisofs_iso_dir_iter_remove_repaireD */ + + /* Ticket 127: A80301 + This violates libisofs API prescriptions but works by lucky incident + whereas iso_dir_iter_remove() removes the next node to come rather than + the most recently returned node. + */ + ret= iso_node_remove(victim_node); + +#endif /* Libisofs_iso_dir_iter_remove_repaireD */ + Xorriso_process_msg_queues(xorriso,0); if(ret<0) { Xorriso_report_iso_error(xorriso, path, ret, "Cannot remove node", 0, @@ -3269,8 +3285,11 @@ ex:; return(1); } - -int Xorriso_rename(struct XorrisO *xorriso, char *origin, char *dest, int flag) +/* @param boss_iter Opaque handle to be forwarded to actions in ISO image + Set to NULL if calling this function from outside ISO world +*/ +int Xorriso_rename(struct XorrisO *xorriso, void *boss_iter, + char *origin, char *dest, int flag) { int ret, ol, dest_ret; char sfe[5*SfileadrL], eff_dest[SfileadrL], dir_adr[SfileadrL], *cpt; @@ -3324,7 +3343,7 @@ int Xorriso_rename(struct XorrisO *xorriso, char *origin, char *dest, int flag) Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); return(0); } else if(dest_ret>0) { - ret= Xorriso_rmi(xorriso, NULL, eff_dest, 1|8); + ret= Xorriso_rmi(xorriso, boss_iter, eff_dest, 1|8); if(ret<=0) return(0); if(ret==3) { @@ -3342,7 +3361,7 @@ int Xorriso_rename(struct XorrisO *xorriso, char *origin, char *dest, int flag) cpt= dir_adr+strlen(dir_adr); *cpt= 0; if(dir_adr[0]!=0) { - ret= Xorriso_graft_in(xorriso, NULL, dir_adr, 1); + ret= Xorriso_graft_in(xorriso, boss_iter, NULL, dir_adr, 1); if(ret<=0) return(ret); } @@ -3432,7 +3451,7 @@ int Xorriso_mkdir(struct XorrisO *xorriso, char *path, int flag) ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, path, eff_path, 2); if(ret<0) return(-2); - ret= Xorriso_graft_in(xorriso, NULL, eff_path, 1); + ret= Xorriso_graft_in(xorriso, NULL, NULL, eff_path, 1); if(ret<=0) return(-2); if(!(flag&1)) { @@ -3732,6 +3751,7 @@ int Xorriso_set_time(struct XorrisO *xorriso, char *in_path, time_t t, int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job, + IsoDirIter *boss_iter, char *abs_path, char *show_path, IsoNode *node, int depth, int flag) { @@ -3771,13 +3791,15 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job, ret= Xorriso_ls_filev(xorriso, "", 1, &abs_path, (off_t) 0, 1|2|8); } else if(action>=9 && action<=13) { /* actions which have own findjobs */ Findjob_set_start_path(subjob, abs_path, 0); - ret= Xorriso_findi(xorriso, subjob, NULL, abs_path, &dir_stbuf, depth, 0); - } else if(action==14) { /* compare */ + ret= Xorriso_findi(xorriso, subjob, boss_iter, NULL, + abs_path, &dir_stbuf, depth, 0); + } else if(action==14 || action==17) { /* compare , update */ Findjob_get_start_path(job, &iso_prefix, 0); - ret= Xorriso_find_compare(xorriso, abs_path, iso_prefix, target, 0); + ret= Xorriso_find_compare(xorriso, (void *) boss_iter, abs_path, iso_prefix, target, + (action==17)); if(ret>=0) ret= 1; - } else if(action==16) { /* not_in_iso */ + } else if(action==16 || action==18) { /* not_in_iso , add_missing */ ; } else { /* includes : 15 in_iso */ sprintf(xorriso->result_line, "%s\n", Text_shellsafe(show_path, sfe, 0)); @@ -3789,6 +3811,7 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job, int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job, + void *boss_iter, void *dir_node_generic, char *dir_path, struct stat *dir_stbuf, int depth, int flag) { @@ -3842,8 +3865,8 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job, if(ret<0) goto ex; if(ret>0) { - ret= Xorriso_findi_action(xorriso, job, path, dir_path, - (IsoNode *) dir_node, depth, 0); + ret= Xorriso_findi_action(xorriso, job, (IsoDirIter *) boss_iter, + path, dir_path, (IsoNode *) dir_node, depth, 0); if(ret<=0) goto ex; } @@ -3874,7 +3897,8 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job, ret= Xorriso_make_abs_adr(xorriso, xorriso->wdi, path, abs_path, 1|2|4); if(ret<=0) goto ex; - ret= Xorriso_findi_action(xorriso, job, abs_path, path, node, depth, 0); + ret= Xorriso_findi_action(xorriso, job, iter, + abs_path, path, node, depth, 0); if(ret<=0) { if(Xorriso_eval_problem_status(xorriso, ret, 1|2)<0) goto ex; @@ -3882,7 +3906,7 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job, } if(S_ISDIR(stbuf.st_mode)) { - ret= Xorriso_findi(xorriso, job, (void *) node, path, + ret= Xorriso_findi(xorriso, job, (void *) iter, (void *) node, path, &stbuf, depth+1, flag); if(ret<0) goto ex; diff --git a/xorriso/xorrisoburn.h b/xorriso/xorrisoburn.h index 0e882389..21588e4f 100644 --- a/xorriso/xorrisoburn.h +++ b/xorriso/xorrisoburn.h @@ -40,11 +40,14 @@ int Xorriso_give_up_drive(struct XorrisO *xorriso, int flag); int Xorriso_write_session(struct XorrisO *xorriso, int flag); -/* @param flag bit0=graft in as empty directory, not as copy from disk - @return <=0 = error , 1 = added simple node , 2 = added directory +/* @param boss_iter Opaque handle to be forwarded to actions in ISO image + Set to NULL if calling this function from outside ISO world + @param flag bit0= mkdir: graft in as empty directory, not as copy from disk + bit1= do not report added files + @return <=0 = error , 1 = added simple node , 2 = added directory */ -int Xorriso_graft_in(struct XorrisO *xorriso, char *disk_path, char *img_path, - int flag); +int Xorriso_graft_in(struct XorrisO *xorriso, void *boss_iter, + char *disk_path, char *img_path, int flag); int Xorriso__text_to_sev(char *severity_name, int *severity_number,int flag); @@ -107,7 +110,11 @@ int Xorriso_ls(struct XorrisO *xorriso, int flag); int Xorriso_normalize_img_path(struct XorrisO *xorriso, char *wd, char *img_path, char eff_path[], int flag); -int Xorriso_rename(struct XorrisO *xorriso, char *origin, char *dest,int flag); +/* @param boss_iter Opaque handle to be forwarded to actions in ISO image + Set to NULL if calling this function from outside ISO world +*/ +int Xorriso_rename(struct XorrisO *xorriso, void *boss_iter, + char *origin, char *dest, int flag); /* @param flag bit0= do not produce info message on success @return 1=success, 0=was already directory, -1=was other type, -2=bad path @@ -133,6 +140,7 @@ int Xorriso_set_time(struct XorrisO *xorriso, char *in_path, time_t t, int flag); int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job, + void *boss_iter, void *dir_node_generic, char *dir_path, struct stat *dir_stbuf, int depth, int flag);