Registering fs,dev,ino of nodes which stem from outside the imported image

and using fs,dev,ino of IsoSymlink and IsoSpecial.
This commit is contained in:
Thomas Schmitt 2009-05-05 22:03:44 +02:00
parent 46a947b602
commit f8d3bca20a
2 changed files with 52 additions and 3 deletions

View File

@ -92,6 +92,7 @@ int default_create_node(IsoNodeBuilder *builder, IsoImage *image,
int ret;
struct stat info;
IsoNode *new;
IsoFilesystem *fs;
char *name;
unsigned char *aa_string;
char *a_text = NULL, *d_text = NULL;
@ -111,6 +112,7 @@ int default_create_node(IsoNodeBuilder *builder, IsoImage *image,
}
name = iso_file_source_get_name(src);
fs = iso_file_source_get_filesystem(src);
new = NULL;
switch (info.st_mode & S_IFMT) {
@ -154,6 +156,13 @@ int default_create_node(IsoNodeBuilder *builder, IsoImage *image,
}
ret = iso_node_new_symlink(name, strdup(dest), &link);
new = (IsoNode*) link;
if (fs != NULL) {
link->fs_id = fs->get_id(fs);
if (link->fs_id != 0) {
link->st_ino = info.st_ino;
link->st_dev = info.st_dev;
}
}
}
break;
case S_IFSOCK:
@ -166,6 +175,13 @@ int default_create_node(IsoNodeBuilder *builder, IsoImage *image,
ret = iso_node_new_special(name, info.st_mode, info.st_rdev,
&special);
new = (IsoNode*) special;
if (fs != NULL) {
special->fs_id = fs->get_id(fs);
if (special->fs_id != 0) {
special->st_ino = info.st_ino;
special->st_dev = info.st_dev;
}
}
}
break;
}

View File

@ -2279,6 +2279,8 @@ int iso_node_get_id(IsoNode *node, unsigned int *fs_id, dev_t *dev_id,
{
int ret;
IsoFile *file;
IsoSymlink *symlink;
IsoSpecial *special;
void *xipt;
ret = iso_node_get_xinfo(node, iso_px_ino_xinfo_func, &xipt);
@ -2302,7 +2304,25 @@ int iso_node_get_id(IsoNode *node, unsigned int *fs_id, dev_t *dev_id,
#ifdef Libisofs_hardlink_matcheR
/* >>> check for id tuples of LIBISO_SYMLINK and LIBISO_SPECIAL */;
} else if (node->type == LIBISO_SYMLINK) {
symlink = (IsoSymlink *) node;
if (symlink->fs_id != ISO_IMAGE_FS_ID && (flag & 1)) {
ret = 0;
goto no_id;
}
*fs_id = symlink->fs_id;
*dev_id = symlink->st_dev;
*ino_id = symlink->st_ino;
} else if (node->type == LIBISO_SPECIAL) {
special = (IsoSpecial *) node;
if (special->fs_id != ISO_IMAGE_FS_ID && (flag & 1)) {
ret = 0;
goto no_id;
}
*fs_id = special->fs_id;
*dev_id = special->st_dev;
*ino_id = special->st_ino;
#endif
@ -2344,6 +2364,8 @@ int iso_node_set_ino(IsoNode *node, ino_t ino, int flag)
{
int ret;
IsoFile *file;
IsoSymlink *symlink;
IsoSpecial *special;
void *xipt;
ret = iso_node_get_xinfo(node, iso_px_ino_xinfo_func, &xipt);
@ -2363,8 +2385,19 @@ int iso_node_set_ino(IsoNode *node, ino_t ino, int flag)
#ifdef Libisofs_hardlink_matcheR
/* >>> check for id tuples of LIBISO_SYMLINK and LIBISO_SPECIAL :
if fs_id = ISO_IMAGE_FS_ID then overwite .st_ino */;
} else if (node->type == LIBISO_SYMLINK) {
symlink = (IsoSymlink *) node;
if (symlink->fs_id == ISO_IMAGE_FS_ID) {
symlink->st_ino = ino;
return 1;
}
} else if (node->type == LIBISO_SPECIAL) {
special = (IsoSpecial *) node;
if (special->fs_id == ISO_IMAGE_FS_ID) {
special->st_ino = ino;
return 1;
}
#endif