Browse Source

Made sure that IsoStream from old image are equivalent only if their

data extents have same LBAs and sizes.
release-1.5.4.branch
Thomas Schmitt 13 years ago
parent
commit
e12d409b80
  1. 27
      libisofs/fs_image.c
  2. 7
      libisofs/fsource.h
  3. 2
      libisofs/libisofs.h
  4. 12
      libisofs/stream.c

27
libisofs/fs_image.c

@ -3510,3 +3510,30 @@ int iso_file_get_old_image_sections(IsoFile *file, int *section_count,
}
return 0;
}
/* ts A90524 */
/* 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 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);
}
return(0);
}

7
libisofs/fsource.h

@ -30,4 +30,11 @@
*/
int iso_local_filesystem_new(IsoFilesystem **fs);
/* ts A90524 */
/* 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);
#endif /*LIBISO_FSOURCE_H_*/

2
libisofs/libisofs.h

@ -2640,7 +2640,7 @@ int iso_node_remove(IsoNode *node);
* If node is the root node, the same node will be returned as its parent.
*
* This returns NULL if the node doesn't pertain to any tree
* (it was removed/take).
* (it was removed/taken).
*
* @since 0.6.2
*/

12
libisofs/stream.c

@ -737,6 +737,7 @@ int iso_stream_cmp_ino(IsoStream *s1, IsoStream *s2, int flag)
dev_t dev_id1, dev_id2;
ino_t ino_id1, ino_id2;
off_t size1, size2;
FSrcStreamData *fssd1, *fssd2;
/* <<< */
static int report_counter = 0;
@ -802,6 +803,17 @@ int iso_stream_cmp_ino(IsoStream *s1, IsoStream *s2, int flag)
return 1;
}
if (s1->class != s2->class)
return (s1->class < s2->class ? -1 : 1);
if (s1->class == &fsrc_stream_class) {
/* Compare eventual image data section LBA and sizes */
fssd1= (FSrcStreamData *) s1->data;
fssd2= (FSrcStreamData *) s2->data;
ret = iso_ifs_sections_cmp(fssd1->src, fssd2->src, 0);
if (ret != 0)
return ret;
}
#ifdef Libisofs_hardlink_matcheR
if (fs_id1 == 0 && dev_id1 == 0 && ino_id1 == 0) {
return (s1 < s2 ? -1 : 1);

Loading…
Cancel
Save