Made directory inodes persistent during multi-session.

The reason is to produce a continued ino history for eventual incremental
backups from ISO images.
This commit is contained in:
Thomas Schmitt 2009-05-01 12:49:37 +02:00
parent 19fd87ef7b
commit 95381ce258
5 changed files with 37 additions and 11 deletions

View File

@ -850,6 +850,19 @@ int ecma119_tree_create(Ecma119Image *img)
} }
img->root = root; 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..."); iso_msg_debug(img->image->id, "Sorting the low level tree...");
sort_tree(root); sort_tree(root);

View File

@ -63,7 +63,11 @@ struct ecma119_node
IsoNode *node; /*< reference to the iso node */ IsoNode *node; /*< reference to the iso node */
/* TODO #00009 : add true support for harlinks and inode numbers */ /* 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; ino_t ino;
nlink_t nlink; nlink_t nlink;
/**< file, symlink, special, directory or placeholder */ /**< file, symlink, special, directory or placeholder */

View File

@ -2788,12 +2788,7 @@ int image_builder_create_node(IsoNodeBuilder *builder, IsoImage *image,
/* ts A90428 */ /* ts A90428 */
/* Attach ino as xinfo if valid and no IsoStream is involved */ /* Attach ino as xinfo if valid and no IsoStream is involved */
if (info.st_ino != 0 && (info.st_mode & S_IFMT) != S_IFREG 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 ? */
ret = iso_node_set_ino(new, info.st_ino, 0); ret = iso_node_set_ino(new, info.st_ino, 0);
if (ret < 0) if (ret < 0)
goto failure; goto failure;
@ -3054,11 +3049,11 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
/* ts A90426 */ /* ts A90426 */
if ((data->px_ino_status & (2 | 4 | 8)) || opts->make_new_ino) { if ((data->px_ino_status & (2 | 4 | 8)) || opts->make_new_ino) {
/* Attach new inode numbers to any node which doe not have one,
/* >>> ??? is there any benefit with stable ino for directories ? resp. to all nodes in case of opts->make_new_ino
if so: add 4 to img_make_inos(flag)
*/ */
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) { if (ret < 0) {
iso_node_builder_unref(image->builder); iso_node_builder_unref(image->builder);
goto import_revert; goto import_revert;

View File

@ -495,7 +495,7 @@ int img_update_ino(IsoImage *image, IsoNode *node, int flag)
if (ret == 0) if (ret == 0)
ino = 0; ino = 0;
if (((flag & 1) || 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)) { ((flag & 4) || iso_node_get_type(node) != LIBISO_DIR)) {
ret = iso_node_set_unique_id(node, image, 0); ret = iso_node_set_unique_id(node, image, 0);
if (ret < 0) if (ret < 0)

View File

@ -5285,6 +5285,20 @@ struct burn_source {
/* ---------------------------- Experiments ---------------------------- */ /* ---------------------------- 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 /* Hardlinks : Override Libisofs_new_fs_image_inO and preserve inode numbers
from session to session. from session to session.