Improvements about -update_r and -compare_r

This commit is contained in:
2008-03-04 18:08:14 +00:00
parent 7ba6078291
commit 544e6849ff
3 changed files with 65 additions and 22 deletions

View File

@ -3821,6 +3821,22 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
}
int Xorriso__node_lba_cmp(const void *node1, const void *node2)
{
uint32_t lba1= 0, lba2= 0;
int ret;
ret = iso_node_get_old_image_lba(*((IsoNode **) node1), &lba1, 0);
if(ret!=1)
lba1= 0;
ret = iso_node_get_old_image_lba(*((IsoNode **) node2), &lba2, 0);
if(ret!=1)
lba1= 0;
return(lba1-lba2);
}
/* The caller shall make no assumptions about the meaning of iter, node_array,
node_count, node_idx ! They are just opaque handles for which the caller
provides the memory of proper type.
@ -3890,6 +3906,9 @@ cannot_iter:;
*iter= NULL;
*node_count= *node_idx;
*node_idx= 0;
if(*node_count>1)
qsort(*node_array, *node_count, sizeof(IsoNode *),
Xorriso__node_lba_cmp);
}
}
@ -4002,7 +4021,7 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job,
mem= boss_mem;
ret= Xorriso_findi_iter(xorriso, dir_node, &mem,
&iter, &node_array, &node_count, &node_idx,
&node, 1|((action==17)<<1));
&node, 1|((action==14 || action==17)<<1));
if(ret<=0)
goto ex;
while(1) {
@ -4470,6 +4489,10 @@ int Xorriso_iso_file_open(struct XorrisO *xorriso, char *pathname,
IsoFile *filenode= NULL;
IsoStream *iso_stream= NULL;
#ifdef Libisofs_lba_tesT
uint32_t lba;
#endif
*stream= NULL;
ret= Xorriso_get_node_by_path(xorriso, pathname, eff_path, &node, 0);
if(ret<=0)
@ -4480,6 +4503,14 @@ int Xorriso_iso_file_open(struct XorrisO *xorriso, char *pathname,
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
}
#ifdef Libisofs_lba_tesT
ret = iso_node_get_old_image_lba(node, &lba, 0);
sprintf(xorriso->info_text, "%s : ret= %d , LBA= %lx",
pathname, ret, (unsigned long) lba);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
#endif
filenode= (IsoFile *) node;
iso_stream= iso_file_get_stream(filenode);
if(iso_stream==NULL) {