Based the iso_stream_cmp_ino() comparison of streams from the loaded

ISO filesystem on their data extents rather than on their inode numbers.
This commit is contained in:
2015-03-09 19:49:39 +01:00
parent e29cd723dd
commit 9e17516e0d
3 changed files with 65 additions and 30 deletions

View File

@ -6298,25 +6298,46 @@ int iso_file_get_old_image_sections(IsoFile *file, int *section_count,
/* Rank two IsoFileSource by their eventual old image LBAs.
Other IsoFileSource classes will be ranked only roughly.
*/
int iso_ifs_sections_cmp(IsoFileSource *s1, IsoFileSource *s2, int flag)
int iso_ifs_sections_cmp(IsoFileSource *s1, IsoFileSource *s2, int *cmp_ret,
int flag)
{
int i;
ImageFileSourceData *d1, *d2;
if (s1->class != s2->class)
return (s1->class < s2->class ? -1 : 1);
if (s1->class != &ifs_class)
return(0);
d1= s1->data;
d2= s2->data;
for (i = 0; i < d1->nsections; i++) {
if (i >= d2->nsections)
return 1;
if (d1->sections[i].block != d2->sections[i].block)
return (d1->sections[i].block < d2->sections[i].block ? -1 : 1);
if (d1->sections[i].size != d2->sections[i].size)
return (d1->sections[i].size < d2->sections[i].size ? -1 : 1);
if (s1->class != s2->class) {
*cmp_ret = (s1->class < s2->class ? -1 : 1);
return 0;
}
return(0);
if (s1->class != &ifs_class) {
*cmp_ret = 0;
return 0;
}
d1 = s1->data;
d2 = s2->data;
if (d1->nsections < 1)
return 0;
if (d1->sections[0].size < 1)
return 0;
for (i = 0; i < d1->nsections; i++) {
if (i >= d2->nsections) {
*cmp_ret = 1;
return 1;
}
if (d1->sections[i].block != d2->sections[i].block) {
*cmp_ret = (d1->sections[i].block < d2->sections[i].block ? -1 : 1);
return 1;
}
if (d1->sections[i].size != d2->sections[i].size) {
*cmp_ret = (d1->sections[i].size < d2->sections[i].size ? -1 : 1);
return 1;
}
}
if (i < d2->nsections) {
*cmp_ret = -1;
return 1;
}
*cmp_ret = 0;
return 1;
}