New option -update (not yet completed)

This commit is contained in:
Thomas Schmitt 2008-02-29 20:09:12 +00:00
parent 803062692d
commit 0c73f1ecac
6 changed files with 295 additions and 65 deletions

View File

@ -542,6 +542,20 @@ as files to add, if they are not parameters to appropriate commands.
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
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
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.
.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\-cpr\fR disk_path [***] iso_rr_path
Insert the given files or directory trees from filesystem
into the ISO image.
@ -1253,7 +1267,7 @@ 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 it will except two
-findx accepts the -exec actions as does -find. But except two
other actions it will allways perform action "echo".
.br
"in_iso" iso_rr_path_start reports the path if its counterpart exist in
@ -1263,7 +1277,8 @@ by iso_rr_path_start. E.g.:
-find /home -exec in_iso /
.br
"not_in_iso" iso_rr_path_start reports the path if its counterpart does
not exist in the ISO image. The format is the same as with command -compare.
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 /

View File

@ -4195,42 +4195,65 @@ much_too_long:;
return(1);
}
/* @param flag bit0= compare atime
/*
@param result Bitfield indicationg type of mismatch
bit0= disk_adr not existing
bit1= iso_adr not existing
bit2= access permissions
bit3= file type
bit4= user id
bit5= group id
bit6= minor, major with device file
bit7= size
bit8= mtime
bit9= atime
bit10= ctime
bit11= cannot open regular disk file
bit12= cannot open iso file
bit13= early eof of disk file
bit14= early eof of iso file
bit15= content bytes differ
bit16= symbolic link on disk pointing to dir, dir in iso
@param flag bit0= compare atime
bit1= compare ctime
bit2= check only existence of both file objects
count one or both missing as "difference"
bit28= examine eventual disk_path link target rather than link
bit29= do not issue pacifier messages
bit30= omit adr_common_tail in report messages
bit31= do not issue result messages
@return 1=files match properly , 0=difference detected , -1=error
*/
int Xorriso_compare_2_files(struct XorrisO *xorriso, char *disk_adr,
char *iso_adr, char *adr_common_tail, int flag)
char *iso_adr, char *adr_common_tail,
int *result, int flag)
{
struct stat s1, s2;
int ret, differs= 0, r1, r2, fd1= -1, i, done, wanted, missing= 0;
struct stat s1, s2, stbuf;
int ret, r1, r2, fd1= -1, i, done, wanted, missing= 0;
void *stream2= NULL;
char *respt;
char buf1[32*1024], buf2[32*1024], a[5*SfileadrL], sfe[5*SfileadrL];
char ttx1[40], ttx2[40];
off_t r1count= 0, r2count= 0, diffcount= 0, first_diff= -1;
*result= 0;
respt= xorriso->result_line;
ret= lstat(disk_adr, &s1);
if(flag&(1<<28))
ret= stat(disk_adr, &s1);
else
ret= lstat(disk_adr, &s1);
if(ret==-1) {
sprintf(respt , "? %s (DISK) : cannot lstat() : %s\n",
Text_shellsafe(disk_adr, sfe, 0), strerror(errno));
if(!(flag&(1<<31)))
Xorriso_result(xorriso,0);
missing= 1;
if(!(flag&4))
return(0);
(*result)|= 1;
}
strcpy(a, Ftypetxt(s1.st_mode, 1));
strcat(a, " ");
if(adr_common_tail[0])
sprintf(a, Text_shellsafe(adr_common_tail, sfe, 0));
strcat(a, Text_shellsafe(adr_common_tail, sfe, 0));
else
strcat(a, "'.'");
strcat(a, " :");
@ -4244,11 +4267,10 @@ int Xorriso_compare_2_files(struct XorrisO *xorriso, char *disk_adr,
if(!(flag&(1<<31)))
Xorriso_result(xorriso,0);
missing= 1;
if(!(flag&4))
return(0);
(*result)|= 2;
}
if(flag&4)
if((flag&4)||missing)
return(!missing);
/* Attributes */
@ -4258,26 +4280,34 @@ int Xorriso_compare_2_files(struct XorrisO *xorriso, char *disk_adr,
a, s1.st_mode, s2.st_mode);
if(!(flag&(1<<31)))
Xorriso_result(xorriso,0);
(*result)|= 4;
}
if((s1.st_mode&S_IFMT)!=(s2.st_mode&S_IFMT)) {
sprintf(respt, "%s type : %s <> %s\n",
a, Ftypetxt(s1.st_mode, 0), Ftypetxt(s2.st_mode, 0));
if(!(flag&(1<<31)))
Xorriso_result(xorriso,0);
(*result)|= 8;
if((s1.st_mode&S_IFMT) == S_IFLNK) {
/* check whether link target type matches */
ret= stat(disk_adr, &stbuf);
if(ret!=-1)
if(S_ISDIR(stbuf.st_mode) && S_ISDIR(s2.st_mode))
(*result)|= (1<<16);
}
}
differs= 1;
}
if(s1.st_uid != s2.st_uid) {
sprintf(respt, "%s st_uid : %d <> %d\n", a, s1.st_uid, s2.st_uid);
if(!(flag&(1<<31)))
Xorriso_result(xorriso,0);
differs= 1;
(*result)|= 16;
}
if(s1.st_gid != s2.st_gid) {
sprintf(respt, "%s st_gid : %d <> %d\n", a, s1.st_gid, s2.st_gid);
if(!(flag&(1<<31)))
Xorriso_result(xorriso,0);
differs= 1;
(*result)|= 32;
}
if((S_ISCHR(s1.st_mode) && S_ISCHR(s2.st_mode)) ||
(S_ISBLK(s1.st_mode) && S_ISBLK(s2.st_mode))) {
@ -4287,7 +4317,7 @@ int Xorriso_compare_2_files(struct XorrisO *xorriso, char *disk_adr,
(unsigned long) s1.st_rdev, (unsigned long) s1.st_rdev);
if(!(flag&(1<<31)))
Xorriso_result(xorriso,0);
differs= 1;
(*result)|= 64;
}
}
if(S_ISREG(s2.st_mode) && s1.st_size != s2.st_size) {
@ -4296,7 +4326,7 @@ int Xorriso_compare_2_files(struct XorrisO *xorriso, char *disk_adr,
((double) s1.st_size) - (double) s2.st_size);
if(!(flag&(1<<31)))
Xorriso_result(xorriso,0);
differs= 1;
(*result)|= 128;
}
if(s1.st_mtime != s2.st_mtime) {
sprintf(respt, "%s st_mtime : %s <> %s diff= %.f s\n",
@ -4305,7 +4335,7 @@ int Xorriso_compare_2_files(struct XorrisO *xorriso, char *disk_adr,
((double) s1.st_mtime) - (double) s2.st_mtime);
if(!(flag&(1<<31)))
Xorriso_result(xorriso,0);
differs= 1;
(*result)|= 256;
}
if(flag&1) {
if(s1.st_atime != s2.st_atime) {
@ -4315,7 +4345,7 @@ int Xorriso_compare_2_files(struct XorrisO *xorriso, char *disk_adr,
((double) s1.st_atime) - (double) s2.st_atime);
if(!(flag&(1<<31)))
Xorriso_result(xorriso,0);
differs= 1;
(*result)|= 512;
}
}
if(flag&2) {
@ -4326,7 +4356,7 @@ int Xorriso_compare_2_files(struct XorrisO *xorriso, char *disk_adr,
((double) s1.st_ctime) - (double) s2.st_ctime);
if(!(flag&(1<<31)))
Xorriso_result(xorriso,0);
differs= 1;
(*result)|= 1024;
}
}
if(S_ISREG(s1.st_mode) && S_ISREG(s2.st_mode)) {
@ -4336,6 +4366,7 @@ int Xorriso_compare_2_files(struct XorrisO *xorriso, char *disk_adr,
disk_adr, strerror(errno));
if(!(flag&(1<<31)))
Xorriso_result(xorriso,0);
(*result)|= 2048;
return(0);
}
@ -4345,6 +4376,7 @@ int Xorriso_compare_2_files(struct XorrisO *xorriso, char *disk_adr,
if(!(flag&(1<<31)))
Xorriso_result(xorriso,0);
close(fd1);
(*result)|= 4096;
return(0);
}
@ -4382,8 +4414,9 @@ I thought to have seen a libisofs bug here but it seems that it was an illusion
disk_adr, (double) r1count);
if(!(flag&(1<<31)))
Xorriso_result(xorriso,0);
(*result)|= 8196;
}
differs= 1;
(*result)|= (1<<15);
}
r1count+= r1;
if(r2==EOF || r2<r1) {
@ -4393,9 +4426,10 @@ I thought to have seen a libisofs bug here but it seems that it was an illusion
sprintf(respt, "- %s (ISO) : early EOF after %.f bytes\n",
iso_adr, (double) r2count);
if(!(flag&(1<<31)))
Xorriso_result(xorriso,0);
Xorriso_result(xorriso,0);
(*result)|= (1<<14);
}
differs= 1;
(*result)|= (1<<15);
done= 1;
}
if(r2>r1) {
@ -4404,8 +4438,9 @@ I thought to have seen a libisofs bug here but it seems that it was an illusion
disk_adr, (double) r1count);
if(!(flag&(1<<31)))
Xorriso_result(xorriso,0);
(*result)|= 8196;
}
differs= 1;
(*result)|= (1<<15);
done= 1;
}
r2count+= r2;
@ -4432,38 +4467,37 @@ I thought to have seen a libisofs bug here but it seems that it was an illusion
(double) (diffcount + abs(r1count-r2count)), (double) first_diff);
if(!(flag&(1<<31)))
Xorriso_result(xorriso,0);
differs= 1;
(*result)|= (1<<15);
}
}
if(fd1!=-1)
close(fd1);
Xorriso_iso_file_close(xorriso, &stream2, 0);
return(!differs);
return((*result)==0);
}
int Xorriso_find_compare(struct XorrisO *xorriso, char *iso_path,
char *iso_prefix, char *disk_prefix, int flag)
{
int ret;
int ret, result;
char disk_path[SfileadrL], adrc[SfileadrL];
if(strncmp(iso_path, iso_prefix, strlen(iso_prefix))!=0)
return(-1);
if(strlen(disk_prefix)+strlen(iso_path)-strlen(iso_prefix)>=SfileadrL)
return(-1);
strcpy(adrc, iso_path+strlen(iso_prefix));
if(iso_path[strlen(iso_prefix)]=='/')
strcpy(adrc, iso_path+strlen(iso_prefix)+1);
else
strcpy(adrc, iso_path+strlen(iso_prefix));
#ifdef NIX
sprintf(disk_path, "%s%s%s",
disk_prefix, (adrc[0]=='/' || adrc[0]==0 ? "" : "/"), adrc);
#else
ret= Xorriso_make_abs_adr(xorriso, disk_prefix, adrc, disk_path, 4|8);
if(ret<=0)
return(ret);
#endif
ret= Xorriso_compare_2_files(xorriso, disk_path, iso_path, adrc, 2|(1<<29));
ret= Xorriso_compare_2_files(xorriso, disk_path, iso_path, adrc, &result,
2|(1<<29));
if(ret<xorriso->find_compare_result)
xorriso->find_compare_result= ret;
return(ret);
@ -6044,7 +6078,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;
int ret= 0, type, action= 0, dpl= 0, compare_result;
uid_t user= 0;
gid_t group= 0;
time_t date= 0;
@ -6066,16 +6100,11 @@ int Xorriso_findx_action(struct XorrisO *xorriso, struct FindjoB *job,
dpl= strlen(disk_prefix);
if(strlen(target)+strlen(abs_path)-dpl >= SfileadrL)
return(-1);
#ifdef NIX
sprintf(iso_path, "%s%s%s",
target, (abs_path[dpl] =='/' || abs_path[dpl]==0 ? "" : "/"),
abs_path+dpl);
#else
if(abs_path[dpl]=='/')
dpl++;
ret= Xorriso_make_abs_adr(xorriso, target, abs_path+dpl, iso_path, 4);
if(ret<=0)
return(ret);
#endif
}
if(action==15) {
@ -6086,7 +6115,8 @@ int Xorriso_findx_action(struct XorrisO *xorriso, struct FindjoB *job,
Xorriso_result(xorriso, 0);
ret= 1;
} else if(action==16) {
ret= Xorriso_compare_2_files(xorriso, abs_path, iso_path, abs_path+dpl, 4);
ret= Xorriso_compare_2_files(xorriso, abs_path, iso_path, abs_path+dpl,
&compare_result, 4);
if(ret<xorriso->find_compare_result)
xorriso->find_compare_result= ret;
if(ret>=0)
@ -7017,6 +7047,59 @@ ex:;
return(ret);
}
int Xorriso_update_interpreter(struct XorrisO *xorriso, int compare_result,
char *disk_path, char *iso_rr_path,
int flag)
{
int ret;
char sfe[5*SfileadrL];
if(compare_result&((1<<11)|(1<<13))) {
/* 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->find_compare_result= -1;
return(1);
}
xorriso->info_text[0]= 0;
if((compare_result&(8|64)) && !(compare_result&(1<<16)) ) {
/* file type, minor+major with device file */
/* <<< 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);
if(ret>0)
ret= Xorriso_graft_in(xorriso, 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);
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);
sprintf(xorriso->info_text, "Added/overwrote ");
} else if(compare_result&(4|16|32|256|512|1024)) {
/* access permissions, user id, group id, mtime, atime, ctime */
ret= Xorriso_copy_properties(xorriso, disk_path, iso_rr_path, 0);
sprintf(xorriso->info_text, "Adjusted attributes ");
} else
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);
}
return(ret);
}
/* ---------------------------- Options API ------------------------ */
@ -7751,7 +7834,7 @@ int Xorriso_option_commit_eject(struct XorrisO *xorriso, char *which, int flag)
}
/* Option -compare
/* Options -compare and -compare_r
@param flag bit0= issue summary message
bit1= do not reset pacifier, no final pacifier message
bit2= do not issue pacifier messages at all
@ -7760,8 +7843,8 @@ int Xorriso_option_commit_eject(struct XorrisO *xorriso, char *which, int flag)
int Xorriso_option_compare(struct XorrisO *xorriso, char *disk_path,
char *iso_path, int flag)
{
int ret, mem_pci, zero= 0;
double mem_lut;
int ret, mem_pci, zero= 0, result;
double mem_lut= 0.0;
char *ipth, *argv[4];
ipth= iso_path;
@ -7797,7 +7880,7 @@ int Xorriso_option_compare(struct XorrisO *xorriso, char *disk_path,
} else
ret= -1;
} else {
ret= Xorriso_compare_2_files(xorriso, disk_path, ipth, "",
ret= Xorriso_compare_2_files(xorriso, disk_path, ipth, "", &result,
2| (1<<30) | ((flag&4)<<27));
}
@ -7807,11 +7890,11 @@ int Xorriso_option_compare(struct XorrisO *xorriso, char *disk_path,
xorriso->pacifier_count, 0, "", 1);
if(ret>0) {
sprintf(xorriso->result_line,
"Ok. Both file objects match as far as expectable.\n");
"Both file objects match as far as expectable.\n");
} else if(ret==0) {
sprintf(xorriso->result_line, "Not ok. Differences detected.\n");
sprintf(xorriso->result_line, "Differences detected.\n");
} else {
sprintf(xorriso->result_line, "Not ok. Comparison failed due to error.\n");
sprintf(xorriso->result_line, "Comparison failed due to error.\n");
}
if(flag&1)
Xorriso_result(xorriso,0);
@ -8552,6 +8635,10 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" iso_rr_path=disk_path . Only \"off\" allows eventual",
" -disk_pattern expansion.",
"",
" -update disk_path iso_rr_path",
" Compare both file objects and do what is necessary to make",
" iso_rr_path a matching copy of disk_path.",
"",
" -cpr disk_path [...] iso_rr_path",
" Insert the given files or directory trees from filesystem",
" into the ISO image.",
@ -8587,8 +8674,8 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" If -type is given then only files with matching type are",
" processed. Types: block,char,dir,pipe,file,link,socket.",
" action may be one of: echo, chown, chown_r, chgrp, chgrp_r",
" chmod, chmod_r, alter_date, alter_date_r, lsdl, find.",
" params are their arguments except iso_rr_path.",
" chmod, chmod_r, alter_date, alter_date_r, lsdl, compare,",
" find. params are their arguments except iso_rr_path.",
" I.e. echo and lsdl have no params at all.",
" -mkdir iso_rr_path [...]",
" Create empty directories if they do not exist yet.",
@ -8677,8 +8764,11 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" -findx disk_path [-name pattern] like -find but in local filesystem.",
" Any -exec option is ignored. Action is always echo.",
"",
" -compare disk_path iso_rr_path compare attributes and in case of regular",
" data files the content of filesystem object and ISO object.",
" -compare disk_path iso_rr_path",
" compare attributes and in case of regular data files the",
" content of filesystem object and ISO object.",
" -compare_r disk_path iso_rr_path ",
" Like -compare but affecting all files below directories.",
"",
"Compatibility emulation (argument list may be ended by --):",
" -as mkisofs [-help|-o|-R|-J|-V|-P|-f|-graft-points|-path-list|pathspecs]",
@ -9593,7 +9683,7 @@ int Xorriso_option_return_with(struct XorrisO *xorriso, char *severity,
/* Options -rm alias -rmi , -rm_r alias -rm_ri , -rmdir alias -rmdiri */
/* @param flag bit0=recursive , bit2= remove empty directory: rmdir */
/* @param flag bit0=recursive , bit1= remove empty directory: rmdir */
int Xorriso_option_rmi(struct XorrisO *xorriso, int argc, char **argv,
int *idx, int flag)
{
@ -9847,6 +9937,82 @@ int Xorriso_option_uid(struct XorrisO *xorriso, char *uid, int flag)
}
/* Options -update and -update_r
@param flag bit0= issue summary message
bit1= do not reset pacifier, no final pacifier message
bit2= do not issue pacifier messages at all
bit3= recursive: -update_r
*/
int Xorriso_option_update(struct XorrisO *xorriso, char *disk_path,
char *iso_path, int flag)
{
int ret, mem_pci, zero= 0, result, uret;
double mem_lut= 0.0;
char *ipth, *argv[4];
ipth= iso_path;
if(ipth[0]==0)
ipth= disk_path;
if(!(flag&2)) {
Xorriso_pacifier_reset(xorriso, 0);
mem_lut= xorriso->last_update_time;
}
mem_pci= xorriso->pacifier_interval;
xorriso->pacifier_interval= 5.0;
if(flag&8) {
xorriso->find_compare_result= 1;
argv[0]= ipth;
argv[1]= "-exec";
argv[2]= "update";
argv[3]= disk_path;
zero= 0;
ret= Xorriso_option_find(xorriso, 4, argv, &zero, 2); /* -findi */
if(ret>0) {
argv[0]= disk_path;
argv[1]= "-exec";
argv[2]= "add_missing";
argv[3]= ipth;
zero= 0;
ret= Xorriso_option_find(xorriso, 4, argv, &zero, 1|2); /* -findx */
if(ret>0)
ret= xorriso->find_compare_result;
else
ret= -1;
} else
ret= -1;
} else {
/* compare ctime too, no filename reporting, eventually silent */
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);
if(uret<=0)
ret= -1;
}
}
xorriso->pacifier_interval= mem_pci;
if(mem_lut!=xorriso->last_update_time && !(flag&2))
Xorriso_pacifier_callback(xorriso, "content bytes read",
xorriso->pacifier_count, 0, "", 1);
if(ret>0) {
sprintf(xorriso->result_line,
"No file object needed update.\n");
} else if(ret==0) {
sprintf(xorriso->result_line, "Differences detected and updated.\n");
} else {
sprintf(xorriso->result_line,
"Not ok. Comparison or update failed due to error.\n");
}
if(flag&1)
Xorriso_result(xorriso,0);
if(ret<0)
return(ret);
return(1);
}
/* Option -use_readline */
int Xorriso_option_use_readline(struct XorrisO *xorriso, char *mode, int flag)
{
@ -10354,6 +10520,10 @@ next_command:;
(*idx)++;
ret= Xorriso_option_uid(xorriso,arg1,0);
} else if(strcmp(cmd,"update")==0) {
(*idx)+= 2;
ret= Xorriso_option_update(xorriso, arg1, arg2, 1);
} else if(strcmp(cmd,"volid")==0) {
(*idx)++;
ret= Xorriso_option_volid(xorriso,arg1,0);

View File

@ -220,6 +220,15 @@ int Xorriso_option_commit(struct XorrisO *xorriso, int flag);
*/
int Xorriso_option_commit_eject(struct XorrisO *xorriso, char *which, int flag);
/* Option -compare and -compare_r
@param flag bit0= issue summary message
bit1= do not reset pacifier, no final pacifier message
bit2= do not issue pacifier messages at all
bit3= recursive: -compare_r
*/
int Xorriso_option_compare(struct XorrisO *xorriso, char *disk_path,
char *iso_path, int flag);
/* Option -cpr alias -cpri */
int Xorriso_option_cpri( struct XorrisO *xorriso, int argc, char **argv,
int *idx, int flag);
@ -270,6 +279,8 @@ int Xorriso_option_follow(struct XorrisO *xorriso, char *mode, int flag);
/* Option -find alias -findi, and -findx */
/* @param flag bit0= -findx rather than -findi
bit1= do not reset pacifier, no final pacifier message
do not reset find_compare_result
*/
int Xorriso_option_find(struct XorrisO *xorriso, int argc, char **argv,
int *idx, int flag);
@ -415,7 +426,16 @@ int Xorriso_option_temp_mem_limit(struct XorrisO *xorriso, char *size,
int Xorriso_option_toc(struct XorrisO *xorriso, int flag);
/* Option -uid */
int Xorriso_option_use_readline(struct XorrisO *xorriso, char *uid, int flag);
int Xorriso_option_uid(struct XorrisO *xorriso, char *uid, int flag);
/* Options -update and -update_r
@param flag bit0= issue summary message
bit1= do not reset pacifier, no final pacifier message
bit2= do not issue pacifier messages at all
bit3= recursive: -update_r
*/
int Xorriso_option_update(struct XorrisO *xorriso, char *disk_path,
char *iso_path, int flag);
/* Option -use_readline */
int Xorriso_option_use_readline(struct XorrisO *xorriso, char *mode, int flag);

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.02.28.215343"
#define Xorriso_timestamP "2008.02.29.200510"

View File

@ -1433,7 +1433,9 @@ int Xorriso_transfer_properties(struct XorrisO *xorriso, struct stat *stbuf,
}
/* @param flag bit0= recursion is active */
/* @param flag bit0= recursion is active
bit1= do not report added files
*/
int Xorriso_add_tree(struct XorrisO *xorriso, IsoDir *dir,
char *img_dir_path, char *disk_dir_path,
struct LinkiteM *link_stack, int flag)
@ -1668,7 +1670,7 @@ cannot_lstat:;
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
} else {
ret= Xorriso_add_tree(xorriso, (IsoDir *) node,
img_path, disk_path, own_link_stack, 1);
img_path, disk_path, own_link_stack, 1|(flag&2));
}
if(ret<=0)
goto was_problem;
@ -1754,7 +1756,28 @@ int Xorriso_copy_implict_properties(struct XorrisO *xorriso, IsoDir *dir,
}
/* @param bit0= copy link target properties rather than link properties
*/
int Xorriso_copy_properties(struct XorrisO *xorriso,
char *disk_path, char *img_path, int flag)
{
int ret;
IsoNode *node;
struct stat stbuf;
ret= Xorriso_get_node_by_path(xorriso, img_path, NULL, &node, 0);
if(ret<=0)
return(ret);
if(lstat(disk_path, &stbuf)==-1)
return(0);
Xorriso_transfer_properties(xorriso, &stbuf, node, 0);
xorriso->volset_change_pending= 1;
return(1);
}
/** @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)
@ -1914,8 +1937,6 @@ handle_path_node:;
iso_node_set_uid((IsoNode *) dir, geteuid());
iso_node_set_gid((IsoNode *) dir, getegid());
/* >>> copy properties from correspondent directory in disk_path
if there is any */;
if(!done)
Xorriso_copy_implict_properties(xorriso, dir, img_path, path, disk_path,
0);
@ -1924,7 +1945,7 @@ handle_path_node:;
if(done) {
attach_source:;
xorriso->pacifier_count++;
if(xorriso->pacifier_count%100)
if(xorriso->pacifier_count%100 && !(flag&2))
Xorriso_pacifier_callback(xorriso, "files added",
xorriso->pacifier_count,
xorriso->pacifier_total, "", 0);
@ -1933,7 +1954,7 @@ attach_source:;
} else if(is_dir) {
Xorriso_transfer_properties(xorriso, &stbuf, (IsoNode *) dir, 0);
ret= Xorriso_add_tree(xorriso, dir, img_path, disk_path, NULL, 0);
ret= Xorriso_add_tree(xorriso, dir, img_path, disk_path, NULL, flag&2);
if(ret<=0)
return(ret);

View File

@ -174,6 +174,10 @@ int Xorriso_iso_file_read(struct XorrisO *xorriso, void *stream, char *buf,
int Xorriso_iso_file_close(struct XorrisO *xorriso, void **stream, int flag);
/* @param bit0= copy link target properties rather than link properties
*/
int Xorriso_copy_properties(struct XorrisO *xorriso,
char *disk_path, char *img_path, int flag);
#endif /* Xorrisoburn_includeD */