Installed pacifier for data reading

This commit is contained in:
Thomas Schmitt 2008-02-27 18:58:21 +00:00
parent 69faba4371
commit 88c1431fdc
2 changed files with 24 additions and 5 deletions

View File

@ -4189,6 +4189,7 @@ much_too_long:;
/* @param flag bit0= compare atime /* @param flag bit0= compare atime
bit1= compare ctime bit1= compare ctime
bit29= do not issue pacifier messages
bit30= omit adr_common_tail in report messages bit30= omit adr_common_tail in report messages
bit31= do not issue result messages bit31= do not issue result messages
@return 1=files match properly , 0=difference detected , -1=error @return 1=files match properly , 0=difference detected , -1=error
@ -4207,7 +4208,7 @@ int Xorriso_compare_2_files(struct XorrisO *xorriso, char *disk_adr,
respt= xorriso->result_line; respt= xorriso->result_line;
ret= lstat(disk_adr, &s1); ret= lstat(disk_adr, &s1);
if(ret==-1) { if(ret==-1) {
sprintf(respt , "? %s : cannot lstat() : %s", sprintf(respt , "? %s : cannot lstat() : %s\n",
Text_shellsafe(disk_adr, sfe, 0), strerror(errno)); Text_shellsafe(disk_adr, sfe, 0), strerror(errno));
if(!(flag&(1<<31))) if(!(flag&(1<<31)))
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
@ -4332,7 +4333,6 @@ int Xorriso_compare_2_files(struct XorrisO *xorriso, char *disk_adr,
/* Content */ /* Content */
done= 0; done= 0;
while(!done) { while(!done) {
/* fd1 is a regular file and should deliver full buffers */ /* fd1 is a regular file and should deliver full buffers */
r1= read(fd1, buf1, sizeof(buf1)); r1= read(fd1, buf1, sizeof(buf1));
@ -4399,6 +4399,11 @@ int Xorriso_compare_2_files(struct XorrisO *xorriso, char *disk_adr,
diffcount++; diffcount++;
} }
} }
if(!(flag&(1<<29))) {
xorriso->pacifier_count+= r1;
Xorriso_pacifier_callback(xorriso, "content bytes read",
xorriso->pacifier_count, 0, "", 0);
}
} }
if(diffcount>0 || r1count!=r2count) { if(diffcount>0 || r1count!=r2count) {
if(first_diff<0) if(first_diff<0)
@ -7624,18 +7629,32 @@ int Xorriso_option_commit_eject(struct XorrisO *xorriso, char *which, int flag)
/* Option -compare /* Option -compare
@param flag bit0= issue summary message @param flag bit0= issue summary message
bit1= do not reset pacifier, no final pacifier message
bit2= do not issue pacifier messages at all
*/ */
int Xorriso_option_compare(struct XorrisO *xorriso, char *disk_path, int Xorriso_option_compare(struct XorrisO *xorriso, char *disk_path,
char *iso_path, int flag) char *iso_path, int flag)
{ {
int ret; int ret, mem_pci;
double mem_lut;
char *ipth; char *ipth;
ipth= iso_path; ipth= iso_path;
if(ipth[0]==0) if(ipth[0]==0)
ipth= disk_path; ipth= disk_path;
ret= Xorriso_compare_2_files(xorriso, disk_path, ipth, "", 2|(1<<30)); if(!(flag&2)) {
Xorriso_pacifier_reset(xorriso, 0);
mem_lut= xorriso->last_update_time;
}
mem_pci= xorriso->pacifier_interval;
xorriso->pacifier_interval= 5.0;
ret= Xorriso_compare_2_files(xorriso, disk_path, ipth, "",
2| (1<<30) | ((flag&4)<<27));
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) { if(ret>0) {
sprintf(xorriso->result_line, sprintf(xorriso->result_line,
"Ok. Both files match as far as expectable.\n"); "Ok. Both files match as far as expectable.\n");

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.02.26.213437" #define Xorriso_timestamP "2008.02.27.185744"