From 95381ce258aa0a9c91bb2eaada2d271bb7b6f0a0 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Fri, 1 May 2009 12:49:37 +0200 Subject: [PATCH] Made directory inodes persistent during multi-session. The reason is to produce a continued ino history for eventual incremental backups from ISO images. --- libisofs/ecma119_tree.c | 13 +++++++++++++ libisofs/ecma119_tree.h | 4 ++++ libisofs/fs_image.c | 15 +++++---------- libisofs/image.c | 2 +- libisofs/libisofs.h | 14 ++++++++++++++ 5 files changed, 37 insertions(+), 11 deletions(-) diff --git a/libisofs/ecma119_tree.c b/libisofs/ecma119_tree.c index c0c68c5..bbc9feb 100644 --- a/libisofs/ecma119_tree.c +++ b/libisofs/ecma119_tree.c @@ -850,6 +850,19 @@ int ecma119_tree_create(Ecma119Image *img) } img->root = root; +#ifdef Libisofs_hardlink_matcheR + + /* ts A90430 */ + + /* >>> if there are Ecma119Node.ino == 0 : */ + >>> Sort tree according to id tuples and IsoFileSrc identity. + >>> Hand out image inode numbers to all Ecma119Node.ino == 0 . + Same sorting rank gets same inode number. + >>> Set Ecma119Node.nlink according to final ino outcome + */ + +#endif /* ! Libisofs_hardlink_matcheR */ + iso_msg_debug(img->image->id, "Sorting the low level tree..."); sort_tree(root); diff --git a/libisofs/ecma119_tree.h b/libisofs/ecma119_tree.h index 0cd05ee..f1ba0a4 100644 --- a/libisofs/ecma119_tree.h +++ b/libisofs/ecma119_tree.h @@ -63,7 +63,11 @@ struct ecma119_node IsoNode *node; /*< reference to the iso node */ /* TODO #00009 : add true support for harlinks and inode numbers */ + + /* >>> ts A90501 : Shouldn't this be uint32_t + as this is what PX will take ? */ ino_t ino; + nlink_t nlink; /**< file, symlink, special, directory or placeholder */ diff --git a/libisofs/fs_image.c b/libisofs/fs_image.c index 1e49b53..a917ab3 100644 --- a/libisofs/fs_image.c +++ b/libisofs/fs_image.c @@ -2788,12 +2788,7 @@ int image_builder_create_node(IsoNodeBuilder *builder, IsoImage *image, /* ts A90428 */ /* Attach ino as xinfo if valid and no IsoStream is involved */ - if (info.st_ino != 0 && (info.st_mode & S_IFMT) != S_IFREG - && (info.st_mode & S_IFMT) != S_IFDIR) { - - /* >>> ??? is there any sense in equipping directories with - persistent inode numbers ? */ - + if (info.st_ino != 0 && (info.st_mode & S_IFMT) != S_IFREG) { ret = iso_node_set_ino(new, info.st_ino, 0); if (ret < 0) goto failure; @@ -3054,11 +3049,11 @@ int iso_image_import(IsoImage *image, IsoDataSource *src, /* ts A90426 */ if ((data->px_ino_status & (2 | 4 | 8)) || opts->make_new_ino) { - - /* >>> ??? is there any benefit with stable ino for directories ? - if so: add 4 to img_make_inos(flag) + /* Attach new inode numbers to any node which doe not have one, + resp. to all nodes in case of opts->make_new_ino */ - ret = img_make_inos(image, image->root, 8 | 2 | !!opts->make_new_ino); + ret = img_make_inos(image, image->root, + 8 | 4 | 2 | !!opts->make_new_ino); if (ret < 0) { iso_node_builder_unref(image->builder); goto import_revert; diff --git a/libisofs/image.c b/libisofs/image.c index 8bc1211..65615b8 100644 --- a/libisofs/image.c +++ b/libisofs/image.c @@ -495,7 +495,7 @@ int img_update_ino(IsoImage *image, IsoNode *node, int flag) if (ret == 0) ino = 0; if (((flag & 1) || ino == 0) && - (iso_node_get_type(node) == LIBISO_FILE || (flag & 2)) && + (iso_node_get_type(node) == LIBISO_FILE || (flag & (2 | 4))) && ((flag & 4) || iso_node_get_type(node) != LIBISO_DIR)) { ret = iso_node_set_unique_id(node, image, 0); if (ret < 0) diff --git a/libisofs/libisofs.h b/libisofs/libisofs.h index be06e3d..0c54404 100644 --- a/libisofs/libisofs.h +++ b/libisofs/libisofs.h @@ -5285,6 +5285,20 @@ struct burn_source { /* ---------------------------- Experiments ---------------------------- */ +/* Hardlinks : During image generation accompany the ree of IsoFileSrc + by a sorted structure of Ecma119Node. + The sorting order shall bring together candidates for being + hardlink siblings resp. having identical content. + + This has to be in sync with the IsoFileSrc unification by + IsoRBTree and iso_file_src_cmp() which cannot be obsoleted + because Joliet and ISO1999 depend on it. + + ! INCOMPLETE AND UNDECIDED ! DO NOT USE YET ! + +#define Libisofs_hardlink_matcheR yes +*/ + /* Hardlinks : Override Libisofs_new_fs_image_inO and preserve inode numbers from session to session.