From 5009d1038d3fd871fc377e75c977dcbaef68961d Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 26 Apr 2009 12:57:17 +0200 Subject: [PATCH] Made early preparations for implementation of hard link persistence --- libisofs/ecma119_tree.c | 4 ++++ libisofs/filesrc.c | 7 +++++++ libisofs/fs_image.c | 2 ++ libisofs/libisofs.h | 9 +++++++++ libisofs/util_rbtree.c | 11 ++++++++++- 5 files changed, 32 insertions(+), 1 deletion(-) diff --git a/libisofs/ecma119_tree.c b/libisofs/ecma119_tree.c index d56b4fc..31745b8 100644 --- a/libisofs/ecma119_tree.c +++ b/libisofs/ecma119_tree.c @@ -108,6 +108,10 @@ int create_ecma119_node(Ecma119Image *img, IsoNode *iso, Ecma119Node **node) /* TODO #00009 : add true support for harlinks and inode numbers */ ecma->nlink = 1; + + /* >>> ts A90426 : unite this with fs_give_ino_number() when it gets + an inode recycling mode + */ ecma->ino = ++img->ino; *node = ecma; diff --git a/libisofs/filesrc.c b/libisofs/filesrc.c index 0e69728..b66c41d 100644 --- a/libisofs/filesrc.c +++ b/libisofs/filesrc.c @@ -30,6 +30,13 @@ int iso_file_src_cmp(const void *n1, const void *n2) iso_stream_get_id(f1->stream, &fs_id1, &dev_id1, &ino_id1); iso_stream_get_id(f2->stream, &fs_id2, &dev_id2, &ino_id2); +#ifdef Libisofs_file_src_cmp_non_zerO + if (fs_id1 == 0 && dev_id1 == 0 && ino_id1 == 0) + return -1; + if (fs_id2 == 0 && dev_id2 == 0 && ino_id2 == 0) + return 1; +#endif + if (fs_id1 < fs_id2) { return -1; } else if (fs_id1 > fs_id2) { diff --git a/libisofs/fs_image.c b/libisofs/fs_image.c index 6363490..7a68119 100644 --- a/libisofs/fs_image.c +++ b/libisofs/fs_image.c @@ -2786,6 +2786,8 @@ int create_boot_img_filesrc(IsoImageFilesystem *fs, IsoFileSource **src) #else /* Libisofs_new_fs_image_inO */ + /* ts A90426 : >>> need a unique inode for El-Torito boot image */ + atts.st_ino = fsdata->imgblock; /* not the best solution, but... */ #endif /* ! Libisofs_new_fs_image_inO */ diff --git a/libisofs/libisofs.h b/libisofs/libisofs.h index 6229916..45878a7 100644 --- a/libisofs/libisofs.h +++ b/libisofs/libisofs.h @@ -5283,6 +5283,15 @@ struct burn_source { #define Libisofs_ino_from_lbA yes */ +/* Experiment: Regarding (fs_id == 0 && dev_id == 0 && ino_id == 0) + as always unique. + WAS DANGEROUS: In a previous experiment iso_rbtree_insert() needed equality. + Now i changed the test in there, so that identical IsoFileSrc + objects are considered equal regardless of their id. + STILL UNTESTED. + + #define Libisofs_file_src_cmp_non_zerO yes +*/ /* Experiment: Write obsolete RR entries with Rock Ridge. I suspect Solaris wants to see them. diff --git a/libisofs/util_rbtree.c b/libisofs/util_rbtree.c index 7a30fc2..8f26d23 100644 --- a/libisofs/util_rbtree.c +++ b/libisofs/util_rbtree.c @@ -198,7 +198,16 @@ int iso_rbtree_insert(IsoRBTree *tree, void *data, void **item) } } - comp = tree->compare(q->data, data); + /* ts A90424 : Maybe one can try again to introduce an id + tuple which is not considered equal to itself + by the compare test. + The last attempt caused a loop here. + */ + if (q->data == data) { + comp = 0; + } else { + comp = tree->compare(q->data, data); + } /* Stop if found */ if (comp == 0) {